2017-03-17 14:38:58 +00:00
|
|
|
#!/bin/bash
|
2005-09-30 08:58:22 +00:00
|
|
|
|
2009-02-21 02:42:50 +00:00
|
|
|
# This file is part of BOINC.
|
2006-02-18 05:49:24 +00:00
|
|
|
# http://boinc.berkeley.edu
|
2023-01-07 01:48:18 +00:00
|
|
|
# Copyright (C) 2023 University of California
|
2006-02-18 05:49:24 +00:00
|
|
|
#
|
2009-02-21 02:42:50 +00:00
|
|
|
# BOINC is free software; you can redistribute it and/or modify it
|
|
|
|
# under the terms of the GNU Lesser General Public License
|
|
|
|
# as published by the Free Software Foundation,
|
|
|
|
# either version 3 of the License, or (at your option) any later version.
|
2006-02-18 05:49:24 +00:00
|
|
|
#
|
2009-02-21 02:42:50 +00:00
|
|
|
# BOINC is distributed in the hope that it will be useful,
|
2006-02-18 05:49:24 +00:00
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
# See the GNU Lesser General Public License for more details.
|
|
|
|
#
|
2009-02-21 02:42:50 +00:00
|
|
|
# You should have received a copy of the GNU Lesser General Public License
|
|
|
|
# along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
2006-02-18 05:49:24 +00:00
|
|
|
#
|
|
|
|
#
|
2005-09-30 08:58:22 +00:00
|
|
|
##
|
|
|
|
# Script for building Macintosh BOINC Manager, Core Client and libraries
|
2008-03-27 09:44:59 +00:00
|
|
|
# by Charlie Fenton 3/27/08
|
2005-10-13 00:20:38 +00:00
|
|
|
# with thanks to Reinhard Prix for his assistance
|
2010-02-12 00:53:05 +00:00
|
|
|
#
|
2011-10-19 09:26:52 +00:00
|
|
|
# Updated for OS 10.7 Lion and XCode 4.2 on 10/19/11
|
2012-07-10 09:28:17 +00:00
|
|
|
# Updated 7/9/12 for Xcode 4.3 and later which are not at a fixed address
|
2014-02-07 14:02:07 +00:00
|
|
|
# Updated 2/7/14 to also build libboinc_zip.a
|
2015-11-28 12:50:05 +00:00
|
|
|
# Updated 11/28/15 to build ScreenSaver with ARC under Xcode 6 or later
|
2016-02-15 10:31:56 +00:00
|
|
|
# Updated 2/15/16 to allow optional use of libc++ and C++11 dialect
|
2017-03-12 00:24:35 +00:00
|
|
|
# Updated 3/11/16 to remove obsolete targets MakeAppIcon_h & WaitPermissions
|
2017-03-17 14:38:58 +00:00
|
|
|
# Updated 3/13/16 to add -target and -setting optional arguments
|
2017-10-18 07:00:01 +00:00
|
|
|
# Updated 10/17/17 to fix bug when -all argument is implied but not explicitly passed
|
2017-10-19 13:37:44 +00:00
|
|
|
# Updated 10/19/17 Special handling of screensaver build is no longer needed
|
2018-10-14 10:31:00 +00:00
|
|
|
# Updated 10/14/18 for Xcode 10 (use this script only with BOINC 7.15 or later)
|
2021-03-31 11:18:31 +00:00
|
|
|
# Updated 3/31/21 To eliminate redundant -c++11 arg since C++11 build is now standard
|
2021-05-19 09:35:29 +00:00
|
|
|
# Updated 5/19/21 for compatibility with zsh
|
2022-07-11 22:26:44 +00:00
|
|
|
# Updated 7/12/22 result is moved out of eval string to get correct status on CI if build fails
|
2023-02-14 13:01:41 +00:00
|
|
|
# Updated 2/14/23 refactoring made to build zip apps (-zipapps), uc2 samples (-uc2) and vboxwrapper (-vboxwrapper)
|
2012-07-06 12:11:28 +00:00
|
|
|
#
|
2014-02-12 12:54:28 +00:00
|
|
|
## This script requires OS 10.8 or later
|
2012-07-10 09:28:17 +00:00
|
|
|
#
|
2017-03-17 14:38:58 +00:00
|
|
|
## If you drag-install Xcode 4.3 or later, you must have opened Xcode
|
|
|
|
## and clicked the Install button on the dialog which appears to
|
2012-07-10 09:28:17 +00:00
|
|
|
## complete the Xcode installation before running this script.
|
2005-09-30 08:58:22 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
## Usage:
|
|
|
|
## cd to the mac_build directory of the boinc tree, for example:
|
|
|
|
## cd [path]/boinc/mac_build
|
|
|
|
##
|
|
|
|
## then invoke this script as follows:
|
2023-01-07 01:48:18 +00:00
|
|
|
## source BuildMacBOINC.sh [-dev] [-noclean] [-libstdc++] [-all] [-lib] [-client] [-zipapps] [-uc2] [-vboxwrapper] [-target targetName] [-setting name value] [-help]
|
2005-10-13 00:39:12 +00:00
|
|
|
## or
|
|
|
|
## chmod +x BuildMacBOINC.sh
|
2023-01-07 01:48:18 +00:00
|
|
|
## ./BuildMacBOINC.sh [-dev] [-noclean] [-libstdc++] [-all] [-lib] [-client] [-zipapps] [-uc2] [-vboxwrapper] [-target targetName] [-setting name value] [-help]
|
2005-09-30 08:58:22 +00:00
|
|
|
##
|
|
|
|
## optional arguments
|
2017-03-17 14:38:58 +00:00
|
|
|
## -dev build the development (debug) version.
|
2012-07-06 12:11:28 +00:00
|
|
|
## default is deployment (release) version.
|
2005-09-30 08:58:22 +00:00
|
|
|
##
|
2006-02-08 10:28:32 +00:00
|
|
|
## -noclean don't do a "clean" of each target before building.
|
2005-09-30 08:58:22 +00:00
|
|
|
## default is to clean all first.
|
|
|
|
##
|
2018-10-14 10:31:00 +00:00
|
|
|
## -libstdc++ build using libstdc++ instead of libc++
|
2016-02-03 10:35:38 +00:00
|
|
|
##
|
|
|
|
##
|
2006-02-08 10:28:32 +00:00
|
|
|
## The following arguments determine which targets to build
|
|
|
|
##
|
|
|
|
## -all build all targets (i.e. target "Build_All" -- this is the default)
|
2023-01-07 01:48:18 +00:00
|
|
|
## except boinc_zip_test, testzlibconflict, UpperCase2 targets
|
|
|
|
## (UC2-x86_64, UC2Gfx-x86_64 and slide_show-x86_64) and VBoxWrapper
|
2006-02-08 10:28:32 +00:00
|
|
|
##
|
2014-02-07 14:02:07 +00:00
|
|
|
## -lib build the six libraries: libboinc_api.a, libboinc_graphics2.a,
|
2017-03-17 14:38:58 +00:00
|
|
|
## libboinc.a, libboinc_opencl.a, libboinc_zip.a, jpeglib.a.
|
2006-02-08 10:28:32 +00:00
|
|
|
##
|
|
|
|
## -client build two targets: boinc client and command-line utility boinc_cmd
|
|
|
|
## (also builds libboinc.a if needed, since boinc_cmd requires it.)
|
|
|
|
##
|
2023-01-07 01:48:18 +00:00
|
|
|
## -zipapps build two zip samples: boinc_zip_test and testzlibconflict
|
|
|
|
##
|
2023-02-14 13:01:41 +00:00
|
|
|
## -uc2 build the UpperCase2 targets: UC2-x86_64, UC2Gfx-x86_64 and
|
|
|
|
## slide_show-x86_64
|
2023-01-07 01:48:18 +00:00
|
|
|
##
|
|
|
|
## -vboxwrapper build the VBoxWrapper target
|
|
|
|
##
|
2014-02-07 14:02:07 +00:00
|
|
|
## Both -lib and -client may be specified to build seven targets (no BOINC Manager)
|
2006-02-08 10:28:32 +00:00
|
|
|
##
|
2017-03-17 14:38:58 +00:00
|
|
|
## The following are used mainly for building the daily test builds:
|
|
|
|
##
|
|
|
|
## -target targetName build ONLY the one target specified by targetName
|
|
|
|
##
|
|
|
|
## -setting name value override setting 'name' to have the value 'value'
|
|
|
|
## Usually used along with -target, You can pass multipe -setting arguments.
|
|
|
|
##
|
2006-02-08 10:28:32 +00:00
|
|
|
|
|
|
|
targets=""
|
|
|
|
doclean="clean"
|
2016-02-03 10:35:38 +00:00
|
|
|
uselibcplusplus=""
|
2006-02-08 10:28:32 +00:00
|
|
|
buildall=0
|
|
|
|
buildlibs=0
|
|
|
|
buildclient=0
|
2023-01-07 01:48:18 +00:00
|
|
|
buildzipapps=0
|
|
|
|
builduc2=0
|
|
|
|
buildvboxwrapper=0
|
2007-12-04 13:42:02 +00:00
|
|
|
style="Deployment"
|
2017-03-17 14:38:58 +00:00
|
|
|
unset settings
|
2015-11-28 12:50:05 +00:00
|
|
|
|
2006-02-08 10:28:32 +00:00
|
|
|
while [ $# -gt 0 ]; do
|
2017-03-17 14:38:58 +00:00
|
|
|
case "$1" in
|
2006-02-08 10:28:32 +00:00
|
|
|
-noclean ) doclean="" ; shift 1 ;;
|
|
|
|
-dev ) style="Development" ; shift 1 ;;
|
2018-10-14 10:31:00 +00:00
|
|
|
-libstdc++ ) uselibcplusplus="CLANG_CXX_LIBRARY=libstdc++" ; shift 1 ;;
|
2006-02-08 10:28:32 +00:00
|
|
|
-all ) buildall=1 ; shift 1 ;;
|
|
|
|
-lib ) buildlibs=1 ; shift 1 ;;
|
|
|
|
-client ) buildclient=1 ; shift 1 ;;
|
2023-01-07 01:48:18 +00:00
|
|
|
-zipapps ) buildzipapps=1 ; buildlibs=1 ; shift 1 ;;
|
|
|
|
-uc2 ) builduc2=1 ; buildlibs=1 ; shift 1 ;;
|
|
|
|
-vboxwrapper ) buildvboxwrapper=1 ; buildlibs=1 ; shift 1 ;;
|
|
|
|
-target ) shift 1 ; targets="$targets -target $1" ; shift 1 ;;
|
2017-03-17 14:38:58 +00:00
|
|
|
-setting ) shift 1 ; name="$1" ;
|
|
|
|
shift 1 ; unset value ; value=("$1");
|
2021-05-19 12:08:45 +00:00
|
|
|
settings+=("$name=""\"${value[@]}\"") ;
|
2017-03-17 14:38:58 +00:00
|
|
|
shift 1 ;;
|
2023-01-07 01:48:18 +00:00
|
|
|
* ) echo "usage:" ; echo "cd {path}/mac_build/" ; echo "source BuildMacBOINC.sh [-dev] [-noclean] [-libstdc++] [-all] [-lib] [-client] [-zipapps] [-uc2] [-vboxwrapper] [-target targetName] [-setting name value] [-help]" ; return 1 ;;
|
2006-02-08 10:28:32 +00:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ "${doclean}" = "clean" ]; then
|
|
|
|
echo "Clean each target before building"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${buildlibs}" = "1" ]; then
|
2017-03-12 00:24:35 +00:00
|
|
|
targets="$targets -target libboinc -target gfx2libboinc -target api_libboinc -target boinc_opencl -target jpeg"
|
2006-02-08 10:28:32 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${buildclient}" = "1" ]; then
|
2014-02-07 14:02:07 +00:00
|
|
|
targets="$targets -target BOINC_Client -target cmd_boinc"
|
2006-02-08 10:28:32 +00:00
|
|
|
fi
|
|
|
|
|
2023-01-07 01:48:18 +00:00
|
|
|
if [ "x${targets}" = "x" ] && [ "${buildlibs}" = "0" ] && [ "${buildclient}" = "0" ] && [ "${buildzipapps}" = "0" ] && [ "${builduc2}" = "0" ] && [ "${buildvboxwrapper}" = "0" ]; then
|
2017-10-18 07:00:01 +00:00
|
|
|
buildall=1
|
2023-01-07 01:48:18 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
## "-all" overrides "-lib" and "-client" and "-zipaps" and "-uc2" and "-vboxwrapper" since it includes those targets
|
|
|
|
if [ "${buildall}" = "1" ]; then
|
2017-10-19 13:37:44 +00:00
|
|
|
targets="-target Build_All"
|
2005-09-30 08:58:22 +00:00
|
|
|
fi
|
|
|
|
|
2005-10-13 00:20:38 +00:00
|
|
|
version=`uname -r`;
|
|
|
|
|
|
|
|
major=`echo $version | sed 's/\([0-9]*\)[.].*/\1/' `;
|
2007-12-04 13:42:02 +00:00
|
|
|
# minor=`echo $version | sed 's/[0-9]*[.]\([0-9]*\).*/\1/' `;
|
2005-10-13 00:20:38 +00:00
|
|
|
|
|
|
|
# echo "major = $major"
|
|
|
|
# echo "minor = $minor"
|
|
|
|
#
|
2012-07-06 12:11:28 +00:00
|
|
|
# Darwin version 12.x.y corresponds to OS 10.8.x
|
|
|
|
# Darwin version 11.x.y corresponds to OS 10.7.x
|
2010-02-12 00:53:05 +00:00
|
|
|
# Darwin version 10.x.y corresponds to OS 10.6.x
|
2007-12-04 13:42:02 +00:00
|
|
|
# Darwin version 9.x.y corresponds to OS 10.5.x
|
2005-10-13 00:20:38 +00:00
|
|
|
# Darwin version 8.x.y corresponds to OS 10.4.x
|
|
|
|
# Darwin version 7.x.y corresponds to OS 10.3.x
|
2007-05-22 01:08:53 +00:00
|
|
|
# Darwin version 6.x corresponds to OS 10.2.x
|
2005-10-13 00:20:38 +00:00
|
|
|
|
2018-10-14 10:12:38 +00:00
|
|
|
if [ "$major" -lt "11" ]; then
|
|
|
|
echo "ERROR: Building BOINC requires System 10.7 or later. For details, see build instructions at"
|
2023-01-07 01:48:18 +00:00
|
|
|
echo "boinc/mac_build/HowToBuildBOINC_XCode.rtf or https://boinc.berkeley.edu/trac/wiki/MacBuild"
|
2006-02-08 10:28:32 +00:00
|
|
|
return 1
|
2005-10-13 00:20:38 +00:00
|
|
|
fi
|
2007-12-04 13:42:02 +00:00
|
|
|
|
|
|
|
if [ "${style}" = "Development" ]; then
|
|
|
|
echo "Development (debug) build"
|
|
|
|
else
|
|
|
|
style="Deployment"
|
2018-10-14 10:12:38 +00:00
|
|
|
echo "Deployment (release) build for architecture: x86_64"
|
2007-12-04 13:42:02 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
|
2012-07-10 09:28:17 +00:00
|
|
|
SDKPATH=`xcodebuild -version -sdk macosx Path`
|
2017-03-17 14:38:58 +00:00
|
|
|
result=0
|
2007-12-20 00:19:59 +00:00
|
|
|
|
2021-05-19 12:08:45 +00:00
|
|
|
## Passing "${settings[@]}" to xcodebuild generates an error under zsh if
|
|
|
|
## the settings array is empty, so we build a single string from the array.
|
|
|
|
theSettings=""
|
|
|
|
for f in "${settings[@]}"; do
|
|
|
|
theSettings+="${f}"
|
|
|
|
theSettings+=" "
|
|
|
|
done
|
|
|
|
|
|
|
|
## For unknown reasons, this xcodebuild call generates syntax errors under zsh
|
2022-07-11 22:26:44 +00:00
|
|
|
## unless we enclose the command in quotes and invoke it with eval.
|
2023-01-07 01:48:18 +00:00
|
|
|
## That is why all the other xcodebuild calls are invoked this way.
|
|
|
|
|
|
|
|
if [ "${buildall}" = "1" ] || [ "${buildlibs}" = "1" ] || [ "${buildclient}" = "1" ] || [ "x${targets}" != "x" ]; then
|
|
|
|
# build all or specified targets from the boinc.xcodeproj project for -all, -libs, -client, or -target
|
|
|
|
eval "xcodebuild -project boinc.xcodeproj ${targets} -configuration ${style} -sdk \"${SDKPATH}\" ${doclean} build ${uselibcplusplus} ${theSettings}"
|
|
|
|
result=$?
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $result -eq 0 ]; then
|
|
|
|
# build libboinc_zip.a for -all or -lib or -zipapps
|
|
|
|
if [ "${buildall}" = "1" ] || [ "${buildlibs}" = "1" ] || [ "${buildzipapps}" = "1" ]; then
|
|
|
|
eval "xcodebuild -project ../zip/boinc_zip.xcodeproj -target boinc_zip -configuration ${style} -sdk \"${SDKPATH}\" ${doclean} build ${uselibcplusplus} ${theSettings}"
|
|
|
|
result=$?
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $result -eq 0 ]; then
|
|
|
|
# build zip sample apps for -zipapps
|
|
|
|
if [ "${buildzipapps}" = "1" ]; then
|
|
|
|
eval "xcodebuild -project ../zip/boinc_zip.xcodeproj -target boinc_zip_test -target testzlibconflict -configuration ${style} -sdk \"${SDKPATH}\" ${doclean} build ${uselibcplusplus} ${theSettings}"
|
|
|
|
result=$?
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $result -eq 0 ]; then
|
|
|
|
# build UC2 sample apps for -uc2
|
|
|
|
if [ "${builduc2}" = "1" ]; then
|
|
|
|
eval "xcodebuild -project ../samples/mac_build/UpperCase2.xcodeproj -target Build_All -configuration ${style} -sdk \"${SDKPATH}\" ${doclean} build ${uselibcplusplus} ${theSettings}"
|
|
|
|
result=$?
|
|
|
|
fi
|
|
|
|
fi
|
2015-11-28 12:50:05 +00:00
|
|
|
|
2014-02-07 14:02:07 +00:00
|
|
|
if [ $result -eq 0 ]; then
|
2023-01-07 01:48:18 +00:00
|
|
|
# build vboxwrapper app for -vboxwrapper
|
|
|
|
if [ "${buildvboxwrapper}" = "1" ]; then
|
|
|
|
eval "xcodebuild -project ../samples/vboxwrapper/vboxwrapper.xcodeproj -target Build_All -configuration ${style} -sdk \"${SDKPATH}\" ${doclean} build ${uselibcplusplus} ${theSettings}"
|
|
|
|
result=$?
|
2014-02-07 14:02:07 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
return $result
|