|
|
|
compile_cmake() {
|
|
|
|
local olddir="$PWD"
|
|
|
|
local builddir='build'
|
|
|
|
local noinstall=false
|
|
|
|
|
|
|
|
local OPTIND=1
|
|
|
|
local opt
|
|
|
|
while getopts 'b:I' opt; do case "$opt" in
|
|
|
|
b) local builddir="$OPTARG" ;;
|
|
|
|
I) local noinstall=true ;;
|
|
|
|
esac; done
|
|
|
|
shift $(expr $OPTIND - 1)
|
|
|
|
[ "$1" = '--' ] && shift || true
|
|
|
|
|
|
|
|
mkdir -p "$builddir"; cd "$builddir"
|
|
|
|
cmake "$olddir" \
|
|
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
|
|
-DCMAKE_INSTALL_PREFIX="/$dir_prefix" \
|
|
|
|
-DCMAKE_INSTALL_FULL_SYSCONFDIR="/$dir_prefix/$dir_sysconf" \
|
|
|
|
-DCMAKE_INSTALL_FULL_BINDIR="/$dir_prefix/$dir_bin" \
|
|
|
|
-DCMAKE_INSTALL_FULL_SBINDIR="/$dir_prefix/$dir_sbin" \
|
|
|
|
-DCMAKE_INSTALL_FULL_LIBEXECDIR="/$dir_prefix/$dir_libexec" \
|
|
|
|
-DCMAKE_INSTALL_FULL_LIBDIR="/$dir_prefix/$dir_lib" \
|
|
|
|
-DCMAKE_INSTALL_FULL_INCLUDEDIR="/$dir_prefix/$dir_include" \
|
|
|
|
-DCMAKE_INSTALL_FULL_DATADIR="/$dir_prefix/$dir_data" \
|
|
|
|
-DCMAKE_INSTALL_FULL_MANDIR="/$dir_prefix/$dir_man" \
|
|
|
|
-DCMAKE_INSTALL_FULL_DOCDIR="/$dir_prefix/$dir_doc/$name" \
|
|
|
|
-DCMAKE_INSTALL_FULL_INFODIR="/$dir_prefix/$dir_info" \
|
|
|
|
-DCMAKE_INSTALL_FULL_LOCALEDIR="/$dir_prefix/$dir_locale" \
|
|
|
|
"$@"
|
|
|
|
make
|
|
|
|
|
|
|
|
if [ "$noinstall" = false ]; then
|
|
|
|
make DESTDIR="$dir_install" install
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd "$olddir"
|
|
|
|
}
|