From 7b13fbbc65e8bcb48409d9a1454f60bd2c7b0773 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Tue, 4 Dec 2007 13:42:02 +0000 Subject: [PATCH] Mac: Update build scripts and documentation for x86_64 support. svn path=/trunk/boinc/; revision=14350 --- checkin_notes | 9 +++++ mac_build/BuildMacBOINC.sh | 77 ++++++++++++++++++++------------------ mac_build/buildcurl.sh | 23 +++--------- mac_build/buildjpeg.sh | 64 ++++++++++++++++++++++++++++--- 4 files changed, 114 insertions(+), 59 deletions(-) diff --git a/checkin_notes b/checkin_notes index 49c2e06629..f2b9d47c94 100644 --- a/checkin_notes +++ b/checkin_notes @@ -12077,3 +12077,12 @@ Rom 3 Dec 2007 client/ http_curl.C, .h + +Charlie 4 Dec 2007 + Mac: Update build scripts and documentation for x86_64 support. + + mac_build/ + buildcurl.sh + buildjpeg.sh + BuildMacBOINC.sh + HowToBuildBOINC_XCode copy.rtf diff --git a/mac_build/BuildMacBOINC.sh b/mac_build/BuildMacBOINC.sh index d5f3ab386a..5471852d1e 100644 --- a/mac_build/BuildMacBOINC.sh +++ b/mac_build/BuildMacBOINC.sh @@ -22,7 +22,7 @@ # ## # Script for building Macintosh BOINC Manager, Core Client and libraries -# by Charlie Fenton 2/17/06 +# by Charlie Fenton 12/4/07 # with thanks to Reinhard Prix for his assistance ## @@ -31,10 +31,10 @@ ## cd [path]/boinc/mac_build ## ## then invoke this script as follows: -## source BuildMacBOINC.sh [-dev] [-noclean] [-all] [-lib] [-client] [-help] +## source BuildMacBOINC.sh [-dev] [-noclean] [-no64bit] [-all] [-lib] [-client] [-help] ## or ## chmod +x BuildMacBOINC.sh -## ./BuildMacBOINC.sh [-dev] [-noclean] [-all] [-lib] [-client] +## ./BuildMacBOINC.sh [-dev] [-noclean] [-no64bit] [-all] [-lib] [-client] [-help] ## ## optional arguments ## -dev build the development (debug) version (native architecture only). @@ -43,6 +43,8 @@ ## -noclean don't do a "clean" of each target before building. ## default is to clean all first. ## +## -no64bit build 32-bit binaries only, no x86_64 architecture +## ## The following arguments determine which targets to build ## ## -all build all targets (i.e. target "Build_All" -- this is the default) @@ -60,26 +62,8 @@ doclean="clean" buildall=0 buildlibs=0 buildclient=0 - -DarwinVersion=`uname -r`; -DarwinMajorVersion=`echo $DarwinVersion | sed 's/\([0-9]*\)[.].*/\1/' `; -# DarwinMinorVersion=`echo $version | sed 's/[0-9]*[.]\([0-9]*\).*/\1/' `; -# -# echo "major = $DarwinMajorVersion" -# echo "minor = $DarwinMinorVersion" -# -# Darwin version 9.x.y corresponds to OS 10.5.x -# Darwin version 8.x.y corresponds to OS 10.4.x -# Darwin version 7.x.y corresponds to OS 10.3.x -# Darwin version 6.x corresponds to OS 10.2.x - -if [ "$DarwinMajorVersion" = "9" ]; then - # OS 10.5 - style="Deployment" -else - style="Deployment-no64" - fi -fi +no64bit=0 +style="Deployment" while [ $# -gt 0 ]; do case "$1" in @@ -88,16 +72,11 @@ while [ $# -gt 0 ]; do -all ) buildall=1 ; shift 1 ;; -lib ) buildlibs=1 ; shift 1 ;; -client ) buildclient=1 ; shift 1 ;; - * ) echo "usage:" ; echo "cd {path}/mac_build/" ; echo "source BuildMacBOINC.sh [-dev] [-noclean] [-all] [-lib] [-client] [-help]" ; return 1 ;; + -no64bit ) no64bit=1 ; shift 1 ;; + * ) echo "usage:" ; echo "cd {path}/mac_build/" ; echo "source BuildMacBOINC.sh [-dev] [-noclean] [-no64bit] [-all] [-lib] [-client] [-help]" ; return 1 ;; esac done -if [ "${style}" = "Development" ]; then - echo "Development (debug) build" -else - echo "Deployment (release) build" -fi - if [ "${doclean}" = "clean" ]; then echo "Clean each target before building" fi @@ -118,28 +97,54 @@ fi version=`uname -r`; major=`echo $version | sed 's/\([0-9]*\)[.].*/\1/' `; -minor=`echo $version | sed 's/[0-9]*[.]\([0-9]*\).*/\1/' `; +# minor=`echo $version | sed 's/[0-9]*[.]\([0-9]*\).*/\1/' `; # echo "major = $major" # echo "minor = $minor" # +# Darwin version 9.x.y corresponds to OS 10.5.x # Darwin version 8.x.y corresponds to OS 10.4.x # Darwin version 7.x.y corresponds to OS 10.3.x # Darwin version 6.x corresponds to OS 10.2.x -if [ "$major" = "8" ]; then -echo "Building BOINC under System 10.4" +if [ "$major" -lt "8" ]; then + echo "ERROR: Building BOINC requires System 10.4 or later. For details, see build instructions at " + echo "boinc/mac_build/HowToBuildBOINC_XCode.rtf or http://boinc.berkeley.edu/mac_build.html" + return 1 +fi + +if [ "$major" -gt "8" ]; then + echo "Building BOINC under System 10.5" +else + echo "Building BOINC under System 10.4" +fi + if [ ! -d /Developer/SDKs/MacOSX10.3.9.sdk/ ]; then echo "ERROR: System 10.3.9 SDK is missing. For details, see build instructions at " echo "boinc/mac_build/HowToBuildBOINC_XCode.rtf or http://boinc.berkeley.edu/mac_build.html" return 1 fi + +if [ "${style}" = "Development" ]; then + echo "Development (debug) build" +elif [ "${no64bit}" = "1" ]; then + style="Deployment-no64" + echo "Deployment (release) build for architectures ppc, i386" +elif [ ! -d /Developer/SDKs/MacOSX10.5.sdk/ ]; then + echo "************************************************************************" + echo "** **" + echo "** WARNING: System 10.5 SDK not found. Building 32-bit binaries only **" + echo "** **" + echo "************************************************************************" + style="Deployment-no64" + echo "Deployment (release) build for architectures: i386, ppc" else - echo "ERROR: Building BOINC requires System 10.4 or later. For details, see build instructions at " - echo "boinc/mac_build/HowToBuildBOINC_XCode.rtf or http://boinc.berkeley.edu/mac_build.html" - return 1 + style="Deployment" + echo "Deployment (release) build for architectures: i386, ppc, x86_64" fi +echo "" + xcodebuild -project boinc.xcodeproj ${targets} -configuration ${style} ${doclean} build return $? diff --git a/mac_build/buildcurl.sh b/mac_build/buildcurl.sh index cebb546dfe..f574b57ce5 100644 --- a/mac_build/buildcurl.sh +++ b/mac_build/buildcurl.sh @@ -24,7 +24,7 @@ # use in building BOINC. # # by Charlie Fenton 7/21/06 -# Updated for curl-7.17.1 11/15/07 +# Updated 12/4/07 # ## In Terminal, CD to the curl-7.17.1 directory. ## cd [path]/curl-7.17.1/ @@ -42,18 +42,6 @@ ## Build with gcc-4.0 to link with the BOINC client # -DarwinVersion=`uname -r`; -DarwinMajorVersion=`echo $DarwinVersion | sed 's/\([0-9]*\)[.].*/\1/' `; -# DarwinMinorVersion=`echo $version | sed 's/[0-9]*[.]\([0-9]*\).*/\1/' `; -# -# echo "major = $DarwinMajorVersion" -# echo "minor = $DarwinMinorVersion" -# -# Darwin version 9.x.y corresponds to OS 10.5.x -# Darwin version 8.x.y corresponds to OS 10.4.x -# Darwin version 7.x.y corresponds to OS 10.3.x -# Darwin version 6.x corresponds to OS 10.2.x - AlreadyBuilt=0 if [ "$1" != "-clean" ]; then @@ -62,14 +50,13 @@ if [ "$1" != "-clean" ]; then fi fi - if [ "$DarwinMajorVersion" = "9" ]; then - # OS 10.5 + if [ -d /Developer/SDKs/MacOSX10.5.sdk/ ]; then + # Build for x86_64 architecture if OS 10.5 SDK is present if [ ! -f lib/.libs/libcurl_x86_64.a ]; then AlreadyBuilt=0 fi fi - if [ $AlreadyBuilt -ne 0 ]; then echo "curl-7.17.1 already built" return 0 @@ -151,7 +138,7 @@ export CPPFLAGS="" export CFLAGS="" export SDKROOT="" -if [ "$DarwinMajorVersion" != "9" ]; then +if [ ! -d /Developer/SDKs/MacOSX10.5.sdk/ ]; then mv -f lib/.libs/libcurl.a lib/.libs/libcurl_i386.a mv -f lib/libcurl_ppc.a lib/.libs/ lipo -create lib/.libs/libcurl_i386.a lib/.libs/libcurl_ppc.a -output lib/.libs/libcurl.a @@ -160,7 +147,7 @@ if [ "$DarwinMajorVersion" != "9" ]; then fi -# OS 10.5 +# Build for x86_64 architecture if OS 10.5 SDK is present mv -f lib/.libs/libcurl.a lib/libcurl_i386.a diff --git a/mac_build/buildjpeg.sh b/mac_build/buildjpeg.sh index 8dff2598ce..09f66cb5cf 100644 --- a/mac_build/buildjpeg.sh +++ b/mac_build/buildjpeg.sh @@ -23,7 +23,7 @@ # Script to build Macintosh Universal Binary library of jpeg-6b for # use in building BOINC. # -# by Charlie Fenton 7/21/06 +# by Charlie Fenton 12/4/07 # ## In Terminal, CD to the jpeg-6b directory. ## cd [path]/jpeg-6b/ @@ -33,11 +33,24 @@ # the -clean argument will force a full rebuild. # +AlreadyBuilt=0 + if [ "$1" != "-clean" ]; then - if [ -f libjpeg_ppc.a ] && [ -f libjpeg_i386.a ] && [ -f libjpeg.a ]; then + if [ -f libjpeg_ppc.a ] && [ -f libjpeg_i386.a ] && [ -f libjpeg.a ]; then + AlreadyBuilt=1 + fi +fi + +if [ -d /Developer/SDKs/MacOSX10.5.sdk/ ]; then + # Build for x86_64 architecture if OS 10.5 SDK is present + if [ ! -f libjpeg_x86_64.a ]; then + AlreadyBuilt=0 + fi +fi + +if [ $AlreadyBuilt -ne 0 ]; then echo "jpeg-6b already built" return 0 - fi fi export PATH=/usr/local/bin:$PATH @@ -51,6 +64,7 @@ if [ $? -ne 0 ]; then return 1; fi rm -f libjpeg_ppc.a rm -f libjpeg_i386.a +rm -f libjpeg_x86_64.a rm -f libjpeg.a make clean @@ -70,13 +84,53 @@ export SDKROOT="/Developer/SDKs/MacOSX10.4u.sdk" ./configure --disable-shared --host=i386 if [ $? -ne 0 ]; then return 1; fi -export LDFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386" +if [ -d /Developer/SDKs/MacOSX10.5.sdk/ ]; then + export LDFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -L/Developer/SDKs/MacOSX10.4u.sdk/ -L/Developer/SDKs/MacOSX10.5.sdk/usr/lib/ -arch i386" +else + export LDFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386" +fi export CPPFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386" make -e if [ $? -ne 0 ]; then return 1; fi mv libjpeg.a libjpeg_i386.a -lipo -create libjpeg_i386.a libjpeg_ppc.a -output libjpeg.a + +if [ ! -d /Developer/SDKs/MacOSX10.5.sdk/ ]; then + lipo -create libjpeg_i386.a libjpeg_ppc.a -output libjpeg.a + + if [ $? -ne 0 ]; then return 1; fi + + export CC="";export CXX="" + export LDFLAGS="" + export CPPFLAGS="" + export SDKROOT="" + + return 0 +fi + +# Build for x86_64 architecture if OS 10.5 SDK is present +make clean +if [ $? -ne 0 ]; then return 1; fi + +export PATH=/usr/local/bin:$PATH +export CC=/usr/bin/gcc-4.0;export CXX=/usr/bin/g++-4.0 +export LDFLAGS="" +export CPPFLAGS="" +export SDKROOT="/Developer/SDKs/MacOSX10.5.sdk" + +./configure --disable-shared --host=x86_64 +if [ $? -ne 0 ]; then return 1; fi + +export LDFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk -arch x86_64" +export CPPFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk -arch x86_64" + +make -e +if [ $? -ne 0 ]; then return 1; fi + +mv libjpeg.a libjpeg_x86_64.a + + +lipo -create libjpeg_i386.a libjpeg_ppc.a libjpeg_x86_64.a -output libjpeg.a if [ $? -ne 0 ]; then return 1; fi