2005-12-22 02:33:59 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2006-02-18 05:49:24 +00:00
|
|
|
# Berkeley Open Infrastructure for Network Computing
|
|
|
|
# http://boinc.berkeley.edu
|
|
|
|
# Copyright (C) 2005 University of California
|
|
|
|
#
|
|
|
|
# This 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 2.1 of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This software is distributed in the hope that it will be useful,
|
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
# To view the GNU Lesser General Public License visit
|
|
|
|
# http://www.gnu.org/copyleft/lesser.html
|
|
|
|
# or write to the Free Software Foundation, Inc.,
|
2007-10-09 11:35:47 +00:00
|
|
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2006-02-18 05:49:24 +00:00
|
|
|
#
|
|
|
|
#
|
2008-01-29 11:18:45 +00:00
|
|
|
# Script to build Macintosh Universal Binary library of curl-7.18.0 for
|
2005-12-22 02:33:59 +00:00
|
|
|
# use in building BOINC.
|
|
|
|
#
|
2006-07-22 09:30:34 +00:00
|
|
|
# by Charlie Fenton 7/21/06
|
2008-05-14 09:57:46 +00:00
|
|
|
# Updated 5/14/08
|
2005-12-22 02:33:59 +00:00
|
|
|
#
|
2008-01-29 11:18:45 +00:00
|
|
|
## In Terminal, CD to the curl-7.18.0 directory.
|
|
|
|
## cd [path]/curl-7.18.0/
|
2006-02-18 05:49:24 +00:00
|
|
|
## then run this script:
|
2007-10-27 11:19:12 +00:00
|
|
|
## source [path]/buildcurl.sh [ -clean ] [ -gcc33 ]
|
2006-02-18 05:49:24 +00:00
|
|
|
##
|
|
|
|
## the -clean argument will force a full rebuild.
|
2007-10-27 11:19:12 +00:00
|
|
|
##
|
|
|
|
## the -gcc33 argument will cause the PowerPC build to use gcc-3.3
|
|
|
|
## otherwise both architectures will be built using gcc_4.0
|
|
|
|
##
|
|
|
|
## Use -gcc33 if you need to link with a project application using BOINC
|
|
|
|
## libraries built with gcc-3.3 for backward compatibility to OS 10.3.0
|
|
|
|
##
|
|
|
|
## Build with gcc-4.0 to link with the BOINC client
|
2005-12-22 02:33:59 +00:00
|
|
|
#
|
|
|
|
|
2007-11-15 12:58:51 +00:00
|
|
|
AlreadyBuilt=0
|
|
|
|
|
2005-12-22 02:33:59 +00:00
|
|
|
if [ "$1" != "-clean" ]; then
|
2007-11-15 12:58:51 +00:00
|
|
|
if [ -f lib/.libs/libcurl_ppc.a ] && [ -f lib/.libs/libcurl_i386.a ] && [ -f lib/.libs/libcurl.a ]; then
|
|
|
|
AlreadyBuilt=1
|
|
|
|
fi
|
|
|
|
fi
|
2005-12-22 02:33:59 +00:00
|
|
|
|
2007-12-04 13:42:02 +00:00
|
|
|
if [ -d /Developer/SDKs/MacOSX10.5.sdk/ ]; then
|
|
|
|
# Build for x86_64 architecture if OS 10.5 SDK is present
|
2007-11-15 12:58:51 +00:00
|
|
|
if [ ! -f lib/.libs/libcurl_x86_64.a ]; then
|
|
|
|
AlreadyBuilt=0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $AlreadyBuilt -ne 0 ]; then
|
2008-01-29 11:18:45 +00:00
|
|
|
echo "curl-7.18.0 already built"
|
2005-12-22 02:33:59 +00:00
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
2007-10-27 11:19:12 +00:00
|
|
|
if [ "$1" = "-gcc33" ] || [ "$2" = "-gcc33" ]; then
|
2007-11-15 12:58:51 +00:00
|
|
|
usegcc33=1
|
2007-10-27 11:19:12 +00:00
|
|
|
else
|
2007-11-15 12:58:51 +00:00
|
|
|
usegcc33=0
|
2007-10-27 11:19:12 +00:00
|
|
|
fi
|
|
|
|
|
2008-02-27 12:01:55 +00:00
|
|
|
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/trac/wiki/MacBuild"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -d /Developer/SDKs/MacOSX10.4u.sdk/ ]; then
|
|
|
|
echo "ERROR: System 10.4u SDK is missing. For details, see build instructions at"
|
|
|
|
echo "boinc/mac_build/HowToBuildBOINC_XCode.rtf or http://boinc.berkeley.edu/trac/wiki/MacBuild"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
2005-12-22 02:33:59 +00:00
|
|
|
export PATH=/usr/local/bin:$PATH
|
2008-05-14 09:57:46 +00:00
|
|
|
|
|
|
|
CURL_DIR=`pwd`
|
|
|
|
# curl configure and make expect a path to _installed_ c-ares-1.5.1
|
|
|
|
# so temporarily install c-ares at a path that does not contain spaces.
|
|
|
|
cd ../c-ares-1.5.1
|
|
|
|
sudo make install
|
|
|
|
cd "${CURL_DIR}"
|
|
|
|
|
2006-05-05 10:11:06 +00:00
|
|
|
export SDKROOT="/Developer/SDKs/MacOSX10.3.9.sdk"
|
2007-12-05 01:02:10 +00:00
|
|
|
export MACOSX_DEPLOYMENT_TARGET=10.3
|
2006-05-05 10:11:06 +00:00
|
|
|
|
2007-12-05 01:02:10 +00:00
|
|
|
rm -f lib/.libs/libcurl.a
|
|
|
|
rm -f lib/.libs/libcurl_ppc.a
|
|
|
|
rm -f lib/.libs/libcurl_i386.a
|
|
|
|
rm -f lib/.libs/libcurl_x86_64.a
|
|
|
|
|
2007-10-27 11:19:12 +00:00
|
|
|
if [ $usegcc33 -ne 0 ]; then
|
|
|
|
|
|
|
|
export CC=/usr/bin/gcc-3.3;export CXX=/usr/bin/g++-3.3
|
2008-05-14 09:57:46 +00:00
|
|
|
export LDFLAGS="-arch ppc -D_NONSTD_SOURCE -isystem /Developer/SDKs/MacOSX10.3.9.sdk -Wl,-syslibroot,/Developer/SDKs/MacOSX10.3.9.sdk"
|
|
|
|
export CPPFLAGS="-arch ppc -D_NONSTD_SOURCE -isystem /Developer/SDKs/MacOSX10.3.9.sdk"
|
|
|
|
export CFLAGS="-arch ppc -D_NONSTD_SOURCE -isystem /Developer/SDKs/MacOSX10.3.9.sdk"
|
2005-12-22 02:33:59 +00:00
|
|
|
|
2007-10-27 11:19:12 +00:00
|
|
|
else
|
|
|
|
|
|
|
|
export CC=/usr/bin/gcc-4.0;export CXX=/usr/bin/g++-4.0
|
2008-05-14 09:57:46 +00:00
|
|
|
export LDFLAGS=" -isysroot /Developer/SDKs/MacOSX10.3.9.sdk -Wl,-syslibroot,/Developer/SDKs/MacOSX10.3.9.sdk -arch ppc"
|
|
|
|
export CPPFLAGS="-isysroot /Developer/SDKs/MacOSX10.3.9.sdk -arch ppc"
|
|
|
|
export CFLAGS="-isysroot /Developer/SDKs/MacOSX10.3.9.sdk -arch ppc"
|
2007-10-27 11:19:12 +00:00
|
|
|
|
|
|
|
fi
|
|
|
|
|
2008-05-14 09:57:46 +00:00
|
|
|
./configure --enable-shared=NO --enable-ares=/tmp/installed-c-ares --host=ppc
|
2007-10-27 11:19:12 +00:00
|
|
|
|
2008-01-29 11:18:45 +00:00
|
|
|
if [ $? -ne 0 ]; then return 1; fi
|
2007-10-27 11:19:12 +00:00
|
|
|
|
2005-12-22 02:33:59 +00:00
|
|
|
make clean
|
|
|
|
|
|
|
|
make
|
2006-07-22 03:35:48 +00:00
|
|
|
if [ $? -ne 0 ]; then return 1; fi
|
2005-12-22 02:33:59 +00:00
|
|
|
mv -f lib/.libs/libcurl.a lib/libcurl_ppc.a
|
|
|
|
|
|
|
|
make clean
|
2006-07-22 03:35:48 +00:00
|
|
|
if [ $? -ne 0 ]; then return 1; fi
|
2005-12-22 02:33:59 +00:00
|
|
|
|
2007-12-05 01:02:10 +00:00
|
|
|
##export PATH=/usr/local/bin:$PATH
|
2005-12-22 02:33:59 +00:00
|
|
|
export CC=/usr/bin/gcc-4.0;export CXX=/usr/bin/g++-4.0
|
2008-05-14 09:57:46 +00:00
|
|
|
export LDFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -arch i386"
|
|
|
|
export CPPFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386"
|
|
|
|
export CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386"
|
2006-05-05 10:11:06 +00:00
|
|
|
export SDKROOT="/Developer/SDKs/MacOSX10.4u.sdk"
|
2007-12-05 01:02:10 +00:00
|
|
|
export MACOSX_DEPLOYMENT_TARGET=10.4
|
2006-05-05 10:11:06 +00:00
|
|
|
|
2008-05-14 09:57:46 +00:00
|
|
|
./configure --enable-shared=NO --enable-ares=/tmp/installed-c-ares --host=i386
|
2006-07-22 03:35:48 +00:00
|
|
|
if [ $? -ne 0 ]; then return 1; fi
|
2005-12-22 02:33:59 +00:00
|
|
|
|
2007-11-14 13:27:01 +00:00
|
|
|
make
|
2006-07-22 03:35:48 +00:00
|
|
|
if [ $? -ne 0 ]; then return 1; fi
|
2007-11-15 12:58:51 +00:00
|
|
|
|
|
|
|
export CC="";export CXX=""
|
|
|
|
export LDFLAGS=""
|
|
|
|
export CPPFLAGS=""
|
|
|
|
export CFLAGS=""
|
|
|
|
export SDKROOT=""
|
|
|
|
|
2007-12-04 13:42:02 +00:00
|
|
|
if [ ! -d /Developer/SDKs/MacOSX10.5.sdk/ ]; then
|
2007-11-15 12:58:51 +00:00
|
|
|
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
|
|
|
|
if [ $? -ne 0 ]; then return 1; fi
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2007-12-04 13:42:02 +00:00
|
|
|
# Build for x86_64 architecture if OS 10.5 SDK is present
|
2007-11-15 12:58:51 +00:00
|
|
|
|
|
|
|
mv -f lib/.libs/libcurl.a lib/libcurl_i386.a
|
|
|
|
|
|
|
|
make clean
|
|
|
|
if [ $? -ne 0 ]; then return 1; fi
|
|
|
|
|
2007-12-05 01:02:10 +00:00
|
|
|
##export PATH=/usr/local/bin:$PATH
|
2007-11-15 12:58:51 +00:00
|
|
|
export CC=/usr/bin/gcc-4.0;export CXX=/usr/bin/g++-4.0
|
2008-05-14 09:57:46 +00:00
|
|
|
export LDFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk -Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk -arch x86_64"
|
|
|
|
export CPPFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk -arch x86_64"
|
|
|
|
export CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk -arch x86_64"
|
2007-12-05 01:02:10 +00:00
|
|
|
export SDKROOT="/Developer/SDKs/MacOSX10.5.sdk"
|
|
|
|
export MACOSX_DEPLOYMENT_TARGET=10.5
|
|
|
|
|
2008-05-14 09:57:46 +00:00
|
|
|
./configure --enable-shared=NO --enable-ares=/tmp/installed-c-ares --host=x86_64
|
2007-12-05 01:02:10 +00:00
|
|
|
if [ $? -ne 0 ]; then return 1; fi
|
2007-11-15 12:58:51 +00:00
|
|
|
|
|
|
|
make
|
2006-07-22 03:35:48 +00:00
|
|
|
if [ $? -ne 0 ]; then return 1; fi
|
2005-12-22 02:33:59 +00:00
|
|
|
|
|
|
|
export CC="";export CXX=""
|
|
|
|
export LDFLAGS=""
|
|
|
|
export CPPFLAGS=""
|
2006-05-05 10:11:06 +00:00
|
|
|
export CFLAGS=""
|
|
|
|
export SDKROOT=""
|
2005-12-22 02:33:59 +00:00
|
|
|
|
2007-11-15 12:58:51 +00:00
|
|
|
mv -f lib/.libs/libcurl.a lib/.libs/libcurl_x86_64.a
|
|
|
|
mv -f lib/libcurl_ppc.a lib/.libs/
|
|
|
|
mv -f lib/libcurl_i386.a lib/.libs/
|
|
|
|
lipo -create lib/.libs/libcurl_i386.a lib/.libs/libcurl_x86_64.a lib/.libs/libcurl_ppc.a -output lib/.libs/libcurl.a
|
|
|
|
if [ $? -ne 0 ]; then return 1; fi
|
|
|
|
|
2008-05-14 09:57:46 +00:00
|
|
|
# Delete temporarily installed c-ares.
|
|
|
|
sudo rm -Rf /tmp/installed-c-ares/
|
|
|
|
|
2005-12-22 02:33:59 +00:00
|
|
|
return 0
|