From a3ab609c6915d9307a983e39f31b0ee84163112f Mon Sep 17 00:00:00 2001 From: poikilos <7557867+poikilos@users.noreply.github.com> Date: Sun, 24 May 2020 02:08:53 -0400 Subject: [PATCH] Improve configurability and comments. --- build-minetest-here.sh | 58 +++++++++++++++++++++++++++++++++++------ install-mts.sh | 2 +- minetestenv-in-place.rc | 3 ++- 3 files changed, 53 insertions(+), 10 deletions(-) diff --git a/build-minetest-here.sh b/build-minetest-here.sh index fef6fd8..4121de7 100755 --- a/build-minetest-here.sh +++ b/build-minetest-here.sh @@ -9,21 +9,63 @@ customExit(){ # echo #fi # cd $mybuild || customExit "$0: cd build failed in '`pwd`'." +if [ -z "$KEEP_MAKE" ]; then + KEEP_MAKE=0 +fi if [ -f bin/minetest ]; then - make clean || customExit "$0: make clean failed in '`pwd`'." + if [ "$KEEP_MAKE" != "1" ]; then + echo "* running 'make clean' in `pwd`..." + make clean || customExit "$0: make clean failed in '`pwd`'." + else + echo "* keeping existing intermediate build files in `pwd` (KEEP_MAKE=$KEEP_MAKE)..." + fi fi +# echo "BREAKPOINT 20s..." +# sleep 20 if [ -z "$RUN_IN_PLACE" ]; then RUN_IN_PLACE=0 fi -cmake . -DENABLE_GETTEXT=1 -DENABLE_FREETYPE=1 -DENABLE_LEVELDB=1 -DENABLE_REDIS=1 -DRUN_IN_PLACE=$RUN_IN_PLACE && make -j$(grep -c processor /proc/cpuinfo) || customExit "$0: Build failed in '`pwd`'." -echo -if [ "@$RUN_IN_PLACE" = "@1" ]; then - echo "WARNING: do not do make install with -DRUN_IN_PLACE=$RUN_IN_PLACE!" -fi + if [ "@$RUN_IN_PLACE" = "@true" ]; then - echo "WARNING: do not do make install with -DRUN_IN_PLACE=$RUN_IN_PLACE!" + RUN_IN_PLACE=1 +elif [ "@$RUN_IN_PLACE" = "@on" ]; then + RUN_IN_PLACE=1 +elif [ "@$RUN_IN_PLACE" = "@yes" ]; then + RUN_IN_PLACE=1 +elif [ "@$RUN_IN_PLACE" = "@1" ]; then + RUN_IN_PLACE=1 +elif [ "@$RUN_IN_PLACE" = "@off" ]; then + RUN_IN_PLACE=0 +elif [ "@$RUN_IN_PLACE" = "@false" ]; then + RUN_IN_PLACE=0 +elif [ "@$RUN_IN_PLACE" = "@no" ]; then + RUN_IN_PLACE=0 +elif [ "@$RUN_IN_PLACE" = "@0" ]; then + RUN_IN_PLACE=0 +else + echo "ERROR: There is an unknown value for RUN_IN_PLACE: '$RUN_IN_PLACE'" + exit 1 +fi +echo "RUN_IN_PLACE=$RUN_IN_PLACE" +if [ "$RUN_IN_PLACE" = "0" ]; then + echo "3..." + sleep 1 + echo "2..." + sleep 1 + echo "1..." + sleep 1 +fi + +if [ ! -z "$BUILD_CLIENT" ]; then + client_line="-DBUILD_CLIENT=$BUILD_CLIENT" fi -if [ "@$RUN_IN_PLACE" = "@on" ]; then +if [ ! -z "$BUILD_SERVER" ]; then + server_line="-DBUILD_SERVER=$BUILD_SERVER" +fi + +cmake . $server_line $client_line -DOpenGL_GL_PREFERENCE=GLVND -DENABLE_GETTEXT=1 -DENABLE_FREETYPE=1 -DENABLE_LEVELDB=1 -DENABLE_REDIS=1 -DRUN_IN_PLACE=$RUN_IN_PLACE && make -j$(grep -c processor /proc/cpuinfo) || customExit "$0: Build failed in '`pwd`'." +echo +if [ "@$RUN_IN_PLACE" = "@1" ]; then echo "WARNING: do not do make install with -DRUN_IN_PLACE=$RUN_IN_PLACE!" fi echo diff --git a/install-mts.sh b/install-mts.sh index 23cdeaf..47a8d93 100755 --- a/install-mts.sh +++ b/install-mts.sh @@ -227,7 +227,7 @@ END if [ ! -f "$PATCH_BUILD" ]; then customExit "$PATCH_BUILD must exist when using the --MT_SRC= (custom local copy of minetest source) option" fi - echo "* starting PATCH_BUILD ($PATCH_BUILD build $server_option $extra_options $custom_src_option" + echo "* running PATCH_BUILD ($PATCH_BUILD build $server_option $extra_options $custom_src_option (writing output to `pwd`/program.log). This may take a while..." $PATCH_BUILD build $server_option $client_option $extra_options $custom_src_option >& program.log elif [ -f "mtcompile-program.pl" ]; then # perl mtcompile-program.pl build >& program.log diff --git a/minetestenv-in-place.rc b/minetestenv-in-place.rc index 6ba08b5..d77a3de 100644 --- a/minetestenv-in-place.rc +++ b/minetestenv-in-place.rc @@ -51,8 +51,9 @@ ERROR: $1 +Waiting 3s before exit... END - sleep 10 + sleep 3 exit $errorCode }