diff options
author | Mingye Wang (Arthur2e5) <arthur200126@gmail.com> | 2016-03-16 02:53:26 +0100 |
---|---|---|
committer | Mingye Wang (Arthur2e5) <arthur200126@gmail.com> | 2016-03-16 03:01:28 +0100 |
commit | d346ec2cf7e9189f16cf49eef3694f3f728ea37d (patch) | |
tree | 372de19bb5705c3690d5d6c2470b4578491eaace | |
parent | compile: some portability-related tweaks (diff) | |
download | cuberite-d346ec2cf7e9189f16cf49eef3694f3f728ea37d.tar cuberite-d346ec2cf7e9189f16cf49eef3694f3f728ea37d.tar.gz cuberite-d346ec2cf7e9189f16cf49eef3694f3f728ea37d.tar.bz2 cuberite-d346ec2cf7e9189f16cf49eef3694f3f728ea37d.tar.lz cuberite-d346ec2cf7e9189f16cf49eef3694f3f728ea37d.tar.xz cuberite-d346ec2cf7e9189f16cf49eef3694f3f728ea37d.tar.zst cuberite-d346ec2cf7e9189f16cf49eef3694f3f728ea37d.zip |
Diffstat (limited to '')
-rwxr-xr-x | compile.sh | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/compile.sh b/compile.sh index af9120278..43b5fa337 100755 --- a/compile.sh +++ b/compile.sh @@ -17,7 +17,7 @@ error () echo echo "-----------------" echo "Script aborted, reason:" - echo $1 + echo "$@" exit 1 } @@ -76,9 +76,8 @@ fi # Depdendency check. checkPackages () { - echo "$PROGRAMS" | while read line; do - EXE_NAME=`echo "$line" | cut -f 1` - PACKAGE_NAME=`echo "$line" | cut -f 2` + # note that IFS is a TAB here! + echo "$PROGRAMS" | while IFS=' ' read EXE_NAME PACKAGE_NAME __trash__; do command -v $EXE_NAME > /dev/null 2> /dev/null || printf %s " $PACKAGE_NAME" done } @@ -93,23 +92,23 @@ if [ "$MISSING_PACKAGES" != "" ]; then # apt-get guide. apt-get --help > /dev/null 2> /dev/null && \ - missingDepsExit "sudo apt-get install$MISSING_PACKAGES" + missingDepsExit "sudo apt-get install $MISSING_PACKAGES" # yum guide. yum --help > /dev/null 2> /dev/null && \ - missingDepsExit "sudo yum install$MISSING_PACKAGES" + missingDepsExit "sudo yum install $MISSING_PACKAGES" # zypper guide. zypper --help > /dev/null 2> /dev/null && \ - missingDepsExit "sudo zypper install$MISSING_PACKAGES" + missingDepsExit "sudo zypper install $MISSING_PACKAGES" # pacman guide. pacman --help > /dev/null 2> /dev/null && \ - missingDepsExit "sudo pacman -S$MISSING_PACKAGES" + missingDepsExit "sudo pacman -S $MISSING_PACKAGES" # urpmi guide. urpmi --help > /dev/null 2> /dev/null && \ - missingDepsExit "sudo urpmi$MISSING_PACKAGES" + missingDepsExit "sudo urpmi $MISSING_PACKAGES" missingDepsExit "" fi @@ -203,9 +202,9 @@ else # Git: Fetch. cd cuberite echo " --- Updating the $BRANCH branch..." - git fetch origin $BRANCH || error "git fetch failed" - git checkout $BRANCH || error "git checkout failed" - git merge origin/$BRANCH || error "git merge failed" + git fetch origin "$BRANCH" || error "git fetch failed" + git checkout "$BRANCH" || error "git checkout failed" + git merge "origin/$BRANCH" || error "git merge failed" fi # Git: Submodules. @@ -217,7 +216,7 @@ git submodule update --init echo " --- Running cmake..." if [ ! -d build-cuberite ]; then mkdir build-cuberite; fi cd build-cuberite -cmake .. -DCMAKE_BUILD_TYPE=$BUILDTYPE || error "cmake failed" +cmake .. -DCMAKE_BUILD_TYPE="$BUILDTYPE" || error "cmake failed" # Make. @@ -234,9 +233,9 @@ echo "Compilation done!" echo echo "Cuberite awaits you at:" if [ "$BUILDTYPE" = "Debug" ]; then - echo "`pwd`/Cuberite_debug" + echo "$PWD/Cuberite_debug" else - echo "`pwd`/Cuberite" + echo "$PWD/Cuberite" fi cd .. echo " @@ -247,7 +246,11 @@ Enjoy :)" exit 0 :windows_detected -echo "This script is not available for Windows yet, sorry." -echo "You can still download the Windows binaries from: http://cuberite.org" -echo "You can also manually compile for Windows. See: https://github.com/cuberite/cuberite" +@echo off +rem Putting echo "Foo" in Windows CMD gives you "Foo" -- with quotes. +echo This script is not available for Windows yet, sorry. +echo You can still download the Windows binaries from: http://cuberite.org +echo You can also manually compile for Windows. See: https://github.com/cuberite/cuberite +rem windows_exit +exit } |