From 161a63de64d70f8759e0772ea48cb2b45e42ad4b Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Sat, 28 Nov 2015 04:50:05 -0800 Subject: [PATCH] Mac: Modify build script to allow building Screensaver with Xcode 6 or later. It will build as "Fat" 32-bit / 64-bit binary with Garbage Collection under Xcode 5 and earlier (for backward compatibility to OS 10.6) or as 64-bit only binary with Automatic Reference Counting under Xcode 6 or later. Xcode 6 and later won't build objective-C sources with GC and so will build screensaver only as a 64-bit binary. --- mac_build/BuildMacBOINC.sh | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/mac_build/BuildMacBOINC.sh b/mac_build/BuildMacBOINC.sh index ac7278307e..175248e3c4 100644 --- a/mac_build/BuildMacBOINC.sh +++ b/mac_build/BuildMacBOINC.sh @@ -2,7 +2,7 @@ # This file is part of BOINC. # http://boinc.berkeley.edu -# Copyright (C) 2014 University of California +# Copyright (C) 2015 University of California # # BOINC is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License @@ -26,6 +26,7 @@ # Updated for OS 10.7 Lion and XCode 4.2 on 10/19/11 # Updated 7/9/12 for Xcode 4.3 and later which are not at a fixed address # Updated 2/7/14 to also build libboinc_zip.a +# Updated 11/28/15 to build ScreenSaver with ARC under Xcode 6 or later # ## This script requires OS 10.8 or later # @@ -71,6 +72,14 @@ buildall=0 buildlibs=0 buildclient=0 style="Deployment" +isXcode6orLater=0 + +xcodeversion=`xcodebuild -version` +xcodeMajorVersion=`echo $xcodeversion | cut -d ' ' -f 2 | cut -d '.' -f 1` + +if [ "$xcodeMajorVersion" -gt "5" ]; then +isXcode6orLater=1 +fi while [ $# -gt 0 ]; do case "$1" in @@ -97,7 +106,13 @@ fi ## "-all" overrides "-lib" and "-client" since it includes those targets if [ "${buildall}" = "1" ] || [ "${targets}" = "" ]; then - targets="-target Build_All" + if [ $isXcode6orLater = 0 ]; then + ## We can build the screensaver using our standard settings (with Garbage Collection) + targets="-target Build_All" + else + ## We must modify the build settings for the screensaver only, to build it with ARC + targets="-target SetVersion -target libboinc -target gfx2libboinc -target api_libboinc -target boinc_opencl -target jpeg -target MakeAppIcon_h -target BOINC_Client -target switcher -target setprojectgrp -target cmd_boinc -target mgr_boinc -target Install_BOINC -target PostInstall -target Uninstaller -target SetUpSecurity -target AddRemoveUser -target WaitPermissions -target ss_app -target gfx_switcher" + fi fi version=`uname -r`; @@ -133,7 +148,23 @@ echo "" SDKPATH=`xcodebuild -version -sdk macosx Path` -xcodebuild -project boinc.xcodeproj ${targets} -configuration ${style} -sdk "${SDKPATH}" ${doclean} build +if [ $isXcode6orLater = 0 ]; then + ## echo "Xcode version < 6" + ## Build the screensaver using our standard settings (with Garbage Collection) + xcodebuild -project boinc.xcodeproj ${targets} -configuration ${style} -sdk "${SDKPATH}" ${doclean} build +else + ## echo "Xcode version > 5" + ## We must modify the build settings for the screensaver only, to build it with ARC + xcodebuild -project boinc.xcodeproj ${targets} -configuration ${style} -sdk "${SDKPATH}" ${doclean} build + + result=$? + + if [ $result -eq 0 ]; then + xcodebuild -project boinc.xcodeproj -target ScreenSaver -configuration ${style} -sdk "${SDKPATH}" ${doclean} build ARCHS=x86_64 GCC_ENABLE_OBJC_GC=unsupported + fi +fi + + result=$?