Revert "Tidy up and fix lint errors in build scripts"

This commit is contained in:
Adrian Lucrèce Céleste 2019-08-22 17:03:18 -04:00 committed by GitHub
parent 58f6c735ff
commit 70a4ece9e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 40 deletions

View File

@ -1,52 +1,28 @@
#!/bin/bash #!/bin/sh
cd "$(dirname $0)" || exit 1
set -eu # we set this to catch errors and terminate
cd "$(dirname "$0")" || exit 1
# some environments have cmake v2 as 'cmake' and v3 as 'cmake3' # some environments have cmake v2 as 'cmake' and v3 as 'cmake3'
# check for cmake3 first then fallback to just cmake # check for cmake3 first then fallback to just cmake
B_CMAKE=`type cmake3 2>/dev/null`
if type cmake3 2>/dev/null; then if [ $? -eq 0 ]; then
B_CMAKE=$(command -v "$(echo "$B_CMAKE" | cut -d' ' -f3)") B_CMAKE=`echo $B_CMAKE | cut -d' ' -f3`
else else
B_CMAKE=$(command -v cmake) B_CMAKE=cmake
fi fi
# default build configuration # default build configuration
B_BUILD_TYPE=${B_BUILD_TYPE:-Debug} B_BUILD_TYPE=${B_BUILD_TYPE:-Debug}
if [ "$(uname)" = "Darwin" ]; then
if [ "$(uname -s)" = "Darwin" ]; then
# OSX needs a lot of extra help, poor thing # OSX needs a lot of extra help, poor thing
# run the osx_environment.sh script to fix paths # run the osx_environment.sh script to fix paths
if [ -f "./osx_environment.sh" ]; then . ./osx_environment.sh
. ./osx_environment.sh
fi
B_CMAKE_FLAGS="-DCMAKE_OSX_SYSROOT=$(xcode-select --print-path)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 $B_CMAKE_FLAGS" B_CMAKE_FLAGS="-DCMAKE_OSX_SYSROOT=$(xcode-select --print-path)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 $B_CMAKE_FLAGS"
fi fi
# allow local customizations to build environment # allow local customizations to build environment
if [ -f "./build_env.sh" ]; then [ -r ./build_env.sh ] && . ./build_env.sh
. ./build_env.sh B_CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=$B_BUILD_TYPE $B_CMAKE_FLAGS"
fi
set +eu # disable this temporarily
if [ -n "${B_CMAKE_FLAGS}" ]; then
B_CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=$B_BUILD_TYPE ${B_CMAKE_FLAGS}"
else
B_CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=$B_BUILD_TYPE"
fi
set -eu # enable this
rm -rf build rm -rf build
mkdir build || exit 1 mkdir build || exit 1
cd build || exit 1 cd build || exit 1
echo Starting Barrier $B_BUILD_TYPE build...
echo "Starting Barrier build..." $B_CMAKE $B_CMAKE_FLAGS .. || exit 1
echo "Build type: ${B_BUILD_TYPE}"
"$B_CMAKE" "$B_CMAKE_FLAGS" .. || exit 1
make || exit 1 make || exit 1
echo "Build completed successfully"
echo "Build completed successfully."

View File

@ -1,7 +1,5 @@
#!/bin/bash #!/bin/bash
set +eu
# Checks if directory exists, otherwise asks to install package. # Checks if directory exists, otherwise asks to install package.
function check_dir_exists() { function check_dir_exists() {
local path=$1 local path=$1
@ -13,7 +11,7 @@ function check_dir_exists() {
fi fi
} }
if [ ! "$BARRIER_BUILD_ENV" ]; then if [ ! $BARRIER_BUILD_ENV ]; then
check_dir_exists '/Applications/Xcode.app' 'Xcode' check_dir_exists '/Applications/Xcode.app' 'Xcode'
printf "Modifying environment for Barrier build...\n" printf "Modifying environment for Barrier build...\n"