Mac: fix build scripts to be compatible with both bash and zsh shells

This commit is contained in:
Charlie Fenton 2021-05-19 02:35:29 -07:00
parent 786696199b
commit 6e3765440f
7 changed files with 57 additions and 42 deletions

View File

@ -34,6 +34,7 @@
# Updated 10/19/17 Special handling of screensaver build is no longer needed
# Updated 10/14/18 for Xcode 10 (use this script only with BOINC 7.15 or later)
# Updated 3/31/21 To eliminate redundant -c++11 arg since C++11 build is now standard
# Updated 5/19/21 for compatibility with zsh
#
## This script requires OS 10.8 or later
#
@ -100,7 +101,7 @@ while [ $# -gt 0 ]; do
-all ) buildall=1 ; shift 1 ;;
-lib ) buildlibs=1 ; shift 1 ;;
-client ) buildclient=1 ; shift 1 ;;
-target ) shift 1 ; targets="-target $1" ; buildzip=0 ; shift 1 ;;
-target ) shift 1 ; targets="$targets -target $1" ; buildzip=0 ; shift 1 ;;
-setting ) shift 1 ; name="$1" ;
shift 1 ; unset value ; value=("$1");
settings+=("$name=""${value[@]}") ;
@ -161,7 +162,9 @@ echo ""
SDKPATH=`xcodebuild -version -sdk macosx Path`
result=0
xcodebuild -project boinc.xcodeproj ${targets} -configuration ${style} -sdk "${SDKPATH}" ${doclean} build ${uselibcplusplus} "${settings[@]}"
## For unknown reasons, this xcodebuild call generates syntax errors under zsh unless
## we enclose the command in quotes and invoke it with eval
eval "xcodebuild -project boinc.xcodeproj ${targets} -configuration ${style} -sdk \"${SDKPATH}\" ${doclean} build ${uselibcplusplus} ${settings[@]}"
result=$?
if [ $result -eq 0 ]; then

View File

@ -28,6 +28,7 @@
# Updated 2/8/18 to fix linker warning for Xcode 9.2 under OS 10.13
# Updated 1/23/19 use libc++ instead of libstdc++ for Xcode 10 compatibility
# Updated 8/22/20 TO build Apple Silicon / arm64 and x86_64 Universal binary
# Updated 5/18/21 for compatibility with zsh
#
## This script requires OS 10.8 or later
#
@ -92,18 +93,18 @@ fi
GCC_can_build_x86_64="no"
GCC_can_build_arm64="no"
GCC_archs=`lipo -info "${GCCPATH}"`
if [[ "${GCC_archs}" == *"x86_64"* ]]; then GCC_can_build_x86_64="yes"; fi
if [[ "${GCC_archs}" == *"arm64"* ]]; then GCC_can_build_arm64="yes"; fi
if [[ "${GCC_archs}" = *"x86_64"* ]]; then GCC_can_build_x86_64="yes"; fi
if [[ "${GCC_archs}" = *"arm64"* ]]; then GCC_can_build_arm64="yes"; fi
if [ "${doclean}" != "yes" ]; then
if [ -f "${libPath}/libftgl.a" ]; then
alreadyBuilt=1
if [ $GCC_can_build_x86_64 == "yes" ]; then
if [ $GCC_can_build_x86_64 = "yes" ]; then
lipo "${libPath}/libftgl.a" -verify_arch x86_64
if [ $? -ne 0 ]; then alreadyBuilt=0; doclean="yes"; fi
fi
if [ $alreadyBuilt -eq 1 ] && [ $GCC_can_build_arm64 == "yes" ]; then
if [ $alreadyBuilt -eq 1 ] && [ $GCC_can_build_arm64 = "yes" ]; then
lipo "${libPath}/libftgl.a" -verify_arch arm64
if [ $? -ne 0 ]; then alreadyBuilt=0; doclean="yes"; fi
fi
@ -160,7 +161,7 @@ else
fi
if [ $? -ne 0 ]; then return 1; fi
if [ "${doclean}" == "yes" ]; then
if [ "${doclean}" = "yes" ]; then
make clean 1>$stdout_target
fi
@ -180,7 +181,7 @@ cd "${SRCDIR}" || return 1
# Now see if we can build for arm64
# Note: Some versions of Xcode 12 don't support building for arm64
if [ $GCC_can_build_arm64 == "yes" ]; then
if [ $GCC_can_build_arm64 = "yes" ]; then
export CC="${GCCPATH}";export CXX="${GPPPATH}"
export LDFLAGS="-Wl,-syslibroot,${SDKPATH},-arch,arm64"

View File

@ -40,6 +40,7 @@
# Update for compatibility with Xcode 10 (this script for BOINC 7.15+ only) 10/14/18
# Add patches to build with Xcode 11 and OS 10.15 sdk 3/1/20
# Updated 8/4/20 TO build Apple Silicon / arm64 and x86_64 Universal binary
# Updated 5/18/21 for compatibility with zsh
#
## This script requires OS 10.6 or later
##
@ -309,14 +310,14 @@ if [ "${doclean}" != "clean" ] && [ -f "${libPathRel}/libwx_osx_cocoa_static.a"
GCC_can_build_arm64="no"
GCC_archs=`lipo -archs "${GCCPATH}"`
if [[ "${GCC_archs}" == *"x86_64"* ]]; then GCC_can_build_x86_64="yes"; fi
if [[ "${GCC_archs}" == *"arm64"* ]]; then GCC_can_build_arm64="yes"; fi
if [ $GCC_can_build_x86_64 == "yes" ]; then
if [[ "${GCC_archs}" = *"x86_64"* ]]; then GCC_can_build_x86_64="yes"; fi
if [[ "${GCC_archs}" = *"arm64"* ]]; then GCC_can_build_arm64="yes"; fi
if [ $GCC_can_build_x86_64 = "yes" ]; then
lipo "${libPathRel}/libwx_osx_cocoa_static.a" -verify_arch x86_64
if [ $? -ne 0 ]; then alreadyBuilt=0; doclean="clean"; fi
fi
if [ $alreadyBuilt -eq 1 ] && [ $GCC_can_build_arm64 == "yes" ]; then
if [ $alreadyBuilt -eq 1 ] && [ $GCC_can_build_arm64 = "yes" ]; then
lipo "${libPathRel}/libwx_osx_cocoa_static.a" -verify_arch arm64
if [ $? -ne 0 ]; then alreadyBuilt=0; doclean="clean"; fi
fi
@ -348,7 +349,7 @@ else
fi
fi
if [ "${nodebug}" == "yes" ]; then
if [ "${nodebug}" = "yes" ]; then
return 0
fi
@ -359,14 +360,14 @@ if [ "${doclean}" != "clean" ] && [ -f "${libPathDbg}/libwx_osx_cocoa_static.a"
GCC_can_build_arm64="no"
GCC_archs=`lipo -archs "${GCCPATH}"`
if [[ "${GCC_archs}" == *"x86_64"* ]]; then GCC_can_build_x86_64="yes"; fi
if [[ "${GCC_archs}" == *"arm64"* ]]; then GCC_can_build_arm64="yes"; fi
if [ GCC_can_build_x86_64 == "yes" ]; then
if [[ "${GCC_archs}" = *"x86_64"* ]]; then GCC_can_build_x86_64="yes"; fi
if [[ "${GCC_archs}" = *"arm64"* ]]; then GCC_can_build_arm64="yes"; fi
if [ GCC_can_build_x86_64 = "yes" ]; then
lipo "${libPathDbg}/libwx_osx_cocoa_static.a" -verify_arch x86_64
if [ $? -ne 0 ]; then alreadyBuilt=0; doclean="clean"; fi
fi
if [ $alreadyBuilt -eq 1 ] && [ GCC_can_build_arm64 == "yes" ]; then
if [ $alreadyBuilt -eq 1 ] && [ GCC_can_build_arm64 = "yes" ]; then
lipo "${libPathDbg}/libwx_osx_cocoa_static.a" -verify_arch arm64
if [ $? -ne 0 ]; then alreadyBuilt=0; doclean="clean"; fi
fi

View File

@ -31,7 +31,8 @@
# Updated 1/25/18 for bulding c-ares 1.13.0 (updated comemnts only)
# Updated 2/22/18 to avoid APIs not available in earlier versions of OS X
# Updated 1/23/19 use libc++ instead of libstdc++ for Xcode 10 compatibility
# Updated 8/22/20 TO build Apple Silicon / arm64 and x86_64 Universal binary
# Updated 8/22/20 to build Apple Silicon / arm64 and x86_64 Universal binary
# Updated 5/18/21 for compatibility with zsh
#
## This script requires OS 10.8 or later
#
@ -106,19 +107,19 @@ fi
GCC_can_build_x86_64="no"
GCC_can_build_arm64="no"
GCC_archs=`lipo -info "${GCCPATH}"`
if [[ "${GCC_archs}" == *"x86_64"* ]]; then GCC_can_build_x86_64="yes"; fi
if [[ "${GCC_archs}" == *"arm64"* ]]; then GCC_can_build_arm64="yes"; fi
if [[ "${GCC_archs}" = *"x86_64"* ]]; then GCC_can_build_x86_64="yes"; fi
if [[ "${GCC_archs}" = *"arm64"* ]]; then GCC_can_build_arm64="yes"; fi
if [ "${doclean}" != "yes" ]; then
if [ -f "${libPath}/libcares.a" ]; then
alreadyBuilt=1
if [ $GCC_can_build_x86_64 == "yes" ]; then
if [ $GCC_can_build_x86_64 = "yes" ]; then
lipo "${libPath}/libcares.a" -verify_arch x86_64
if [ $? -ne 0 ]; then alreadyBuilt=0; doclean="yes"; fi
fi
if [ $alreadyBuilt -eq 1 ] && [ $GCC_can_build_arm64 == "yes" ]; then
if [ $alreadyBuilt -eq 1 ] && [ $GCC_can_build_arm64 = "yes" ]; then
lipo "${libPath}/libcares.a" -verify_arch arm64
if [ $? -ne 0 ]; then alreadyBuilt=0; doclean="yes"; fi
fi
@ -178,7 +179,7 @@ if [ $? -ne 0 ]; then return 1; fi
patch_ares_config
if [ "${doclean}" == "yes" ]; then
if [ "${doclean}" = "yes" ]; then
make clean
fi
@ -189,7 +190,7 @@ if [ $? -ne 0 ]; then return 1; fi
# Now see if we can build for arm64
# Note: Some versions of Xcode 12 don't support building for arm64
if [ $GCC_can_build_arm64 == "yes" ]; then
if [ $GCC_can_build_arm64 = "yes" ]; then
export CC="${GCCPATH}";export CXX="${GPPPATH}"
export CPPFLAGS=""

View File

@ -38,6 +38,7 @@
# Updated 1/23/19 use libc++ instead of libstdc++ for Xcode 10 compatibility
# Updated 8/22/20 TO build Apple Silicon / arm64 and x86_64 Universal binary
# Updated 12/24/20 for curl 7.73.0
# Updated 5/18/21 for compatibility with zsh
#
## This script requires OS 10.8 or later
#
@ -134,19 +135,19 @@ fi
GCC_can_build_x86_64="no"
GCC_can_build_arm64="no"
GCC_archs=`lipo -info "${GCCPATH}"`
if [[ "${GCC_archs}" == *"x86_64"* ]]; then GCC_can_build_x86_64="yes"; fi
if [[ "${GCC_archs}" == *"arm64"* ]]; then GCC_can_build_arm64="yes"; fi
if [[ "${GCC_archs}" = *"x86_64"* ]]; then GCC_can_build_x86_64="yes"; fi
if [[ "${GCC_archs}" = *"arm64"* ]]; then GCC_can_build_arm64="yes"; fi
if [ "${doclean}" != "yes" ]; then
if [ -f "${libPath}/libcurl.a" ]; then
alreadyBuilt=1
if [ $GCC_can_build_x86_64 == "yes" ]; then
if [ $GCC_can_build_x86_64 = "yes" ]; then
lipo "${libPath}/libcurl.a" -verify_arch x86_64
if [ $? -ne 0 ]; then alreadyBuilt=0; doclean="yes"; fi
fi
if [ $alreadyBuilt -eq 1 ] && [ $GCC_can_build_arm64 == "yes" ]; then
if [ $alreadyBuilt -eq 1 ] && [ $GCC_can_build_arm64 = "yes" ]; then
lipo "${libPath}/libcurl.a" -verify_arch arm64
if [ $? -ne 0 ]; then alreadyBuilt=0; doclean="yes"; fi
fi
@ -214,6 +215,9 @@ else
# Get the names of the current versions of c-ares and openssl from
# the dependencyNames.sh file in the same directory as this script.
myScriptPath="${BASH_SOURCE[0]}"
if [ -z ${myScriptPath} ]; then
myScriptPath="$0" # for zsh
fi
myScriptDir="${myScriptPath%/*}"
source "${myScriptDir}/dependencyNames.sh"
if [ $? -ne 0 ]; then return 1; fi
@ -239,7 +243,7 @@ fi
patch_curl_config
if [ "${doclean}" == "yes" ]; then
if [ "${doclean}" = "yes" ]; then
make clean
fi
@ -253,7 +257,7 @@ fi
# Now see if we can build for arm64
# Note: Some versions of Xcode 12 don't support building for arm64
if [ $GCC_can_build_arm64 == "yes" ]; then
if [ $GCC_can_build_arm64 = "yes" ]; then
# c-ares configure creates a different ares_build.h file for each architecture
# for a sanity check on size of long and socklen_t. But these are identical for

View File

@ -32,6 +32,7 @@
# Updated 1/25/18 for any version of FreeType (changed only comments)
# Updated 1/23/19 use libc++ instead of libstdc++ for Xcode 10 compatibility
# Updated 8/22/20 TO build Apple Silicon / arm64 and x86_64 Universal binary
# Updated 5/18/21 for compatibility with zsh
#
## This script requires OS 10.8 or later
#
@ -97,19 +98,19 @@ fi
GCC_can_build_x86_64="no"
GCC_can_build_arm64="no"
GCC_archs=`lipo -info "${GCCPATH}"`
if [[ "${GCC_archs}" == *"x86_64"* ]]; then GCC_can_build_x86_64="yes"; fi
if [[ "${GCC_archs}" == *"arm64"* ]]; then GCC_can_build_arm64="yes"; fi
if [[ "${GCC_archs}" = *"x86_64"* ]]; then GCC_can_build_x86_64="yes"; fi
if [[ "${GCC_archs}" = *"arm64"* ]]; then GCC_can_build_arm64="yes"; fi
if [ "${doclean}" != "yes" ]; then
if [ -f "${libPath}/libfreetype.a" ]; then
alreadyBuilt=1
if [ $GCC_can_build_x86_64 == "yes" ]; then
if [ $GCC_can_build_x86_64 = "yes" ]; then
lipo "${libPath}/libfreetype.a" -verify_arch x86_64
if [ $? -ne 0 ]; then alreadyBuilt=0; doclean="yes"; fi
fi
if [ $alreadyBuilt -eq 1 ] && [ $GCC_can_build_arm64 == "yes" ]; then
if [ $alreadyBuilt -eq 1 ] && [ $GCC_can_build_arm64 = "yes" ]; then
lipo "${libPath}/libfreetype.a" -verify_arch arm64
if [ $? -ne 0 ]; then alreadyBuilt=0; doclean="yes"; fi
fi
@ -164,7 +165,7 @@ export MACOSX_DEPLOYMENT_TARGET=10.7
./configure --enable-shared=NO --prefix=${lprefix} --without-png --host=x86_64
if [ $? -ne 0 ]; then return 1; fi
if [ "${doclean}" == "yes" ]; then
if [ "${doclean}" = "yes" ]; then
make clean
fi
@ -173,7 +174,7 @@ if [ $? -ne 0 ]; then return 1; fi
# Now see if we can build for arm64
# Note: Some versions of Xcode 12 don't support building for arm64
if [ $GCC_can_build_arm64 == "yes" ]; then
if [ $GCC_can_build_arm64 = "yes" ]; then
export CC="${GCCPATH}";export CXX="${GPPPATH}"
export LDFLAGS="-Wl,-syslibroot,${SDKPATH},-arch,arm64"

View File

@ -36,6 +36,7 @@
# Updated 1/23/19 use libc++ instead of libstdc++ for Xcode 10 compatibility
# Updated 10/20/20 To build Apple Silicon / arm64 and x86_64 Universal binary
# Updated 12/24/20 for openssl-1.1.0l
# Updated 5/18/21 for compatibility with zsh
#
## This script requires OS 10.8 or later
#
@ -87,21 +88,21 @@ fi
GCC_can_build_x86_64="no"
GCC_can_build_arm64="no"
GCC_archs=`lipo -info "${GCCPATH}"`
if [[ "${GCC_archs}" == *"x86_64"* ]]; then GCC_can_build_x86_64="yes"; fi
if [[ "${GCC_archs}" == *"arm64"* ]]; then GCC_can_build_arm64="yes"; fi
if [[ "${GCC_archs}" = *"x86_64"* ]]; then GCC_can_build_x86_64="yes"; fi
if [[ "${GCC_archs}" = *"arm64"* ]]; then GCC_can_build_arm64="yes"; fi
if [ "${doclean}" != "yes" ]; then
if [ -f ${libPath}/libssl.a ] && [ -f ${libPath}/libcrypto.a ]; then
alreadyBuilt=1
if [ $GCC_can_build_x86_64 == "yes" ]; then
if [ $GCC_can_build_x86_64 = "yes" ]; then
lipo "${libPath}/libssl.a" -verify_arch x86_64
if [ $? -ne 0 ]; then alreadyBuilt=0; doclean="yes"; fi
lipo "${libPath}/libcrypto.a" -verify_arch x86_64
if [ $? -ne 0 ]; then alreadyBuilt=0; doclean="yes"; fi
fi
if [ $alreadyBuilt -eq 1 ] && [ $GCC_can_build_arm64 == "yes" ]; then
if [ $alreadyBuilt -eq 1 ] && [ $GCC_can_build_arm64 = "yes" ]; then
lipo "${libPath}/libssl.a" -verify_arch arm64
if [ $? -ne 0 ]; then alreadyBuilt=0; doclean="yes"; fi
lipo "${libPath}/libcrypto.a" -verify_arch arm64
@ -203,7 +204,7 @@ else
if [ $? -ne 0 ]; then return 1; fi
fi
if [ "${doclean}" == "yes" ]; then
if [ "${doclean}" = "yes" ]; then
make clean 1>$stdout_target
fi
@ -212,7 +213,7 @@ if [ $? -ne 0 ]; then return 1; fi
# Now see if we can build for arm64
# Note: Some versions of Xcode 12 don't support building for arm64
if [ $GCC_can_build_arm64 == "yes" ]; then
if [ $GCC_can_build_arm64 = "yes" ]; then
export CC="${GCCPATH}";export CXX="${GPPPATH}"
export LDFLAGS="-Wl,-syslibroot,${SDKPATH},-arch,arm64"
@ -270,6 +271,9 @@ if [ $GCC_can_build_arm64 == "yes" ]; then
# Get the names of the current versions of and openssl from the
# dependencyNames.sh file in the same directory as this script.
myScriptPath="${BASH_SOURCE[0]}"
if [ -z ${myScriptPath} ]; then
myScriptPath="$0" # for zsh
fi
myScriptDir="${myScriptPath%/*}"
source "${myScriptDir}/dependencyNames.sh"