2 # This script performs all of the steps needed to build a
3 # universal binary libcurl.framework for Mac OS X 10.4 or greater.
6 # Generalizations added since Snowleopard (10.6) do not include
10 # 10.5 is the *ONLY* SDK that support PPC64 :( -- 10.6 do not have ppc64 support
11 #If you need to have PPC64 support then change below to 1
14 # For me the default is to develop for the platform I am on, and if you
15 #desire compatibility with older versions then change USE_OLD to 1 :)
18 VERSION=`/usr/bin/sed -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' include/curl/curlver.h`
19 FRAMEWORK_VERSION=Versions/Release-$VERSION
21 #I also wanted to "copy over" the system, and thus the reason I added the
22 # version to Versions/Release-7.20.1 etc.
23 # now a simple rsync -vaP libcurl.framework /Library/Frameworks will install it
24 # and setup the right paths to this version, leaving the system version
25 # "intact", so you can "fix" it later with the links to Versions/A/...
28 OLD_SDK=`ls /Developer/SDKs|head -1`
29 NEW_SDK=`ls -r /Developer/SDKs|head -1`
31 if test "0"$USE_OLD -gt 0
38 MACVER=`echo $SDK32|sed -e s/[a-zA-Z]//g -e s/.\$//`
40 SDK32_DIR='/Developer/SDKs/'$SDK32
41 MINVER32='-mmacosx-version-min='$MACVER
42 ARCHES32='-arch i386 -arch ppc'
45 if test $PPC64_NEEDED -gt 0
48 ARCHES64='-arch x86_64 -arch ppc64'
49 SDK64=`ls /Developer/SDKs|grep 10.5|head -1`
51 ARCHES64='-arch x86_64'
52 #We "know" that 10.4 and earlier do not support 64bit
53 OLD_SDK64=`ls /Developer/SDKs|egrep -v "10.[0-4]"|head -1`
54 NEW_SDK64=`ls -r /Developer/SDKs|egrep -v "10.[0-4]"|head -1`
55 if test $USE_OLD -gt 0
63 SDK64_DIR='/Developer/SDKs/'$SDK64
64 MACVER64=`echo $SDK64|sed -e s/[a-zA-Z]//g -e s/.\$//`
66 MINVER64='-mmacosx-version-min='$MACVER64
68 if test ! -z $SDK32; then
69 echo "----Configuring libcurl for 32 bit universal framework..."
71 ./configure --disable-dependency-tracking --disable-static --with-gssapi \
72 CFLAGS="-Os -isysroot $SDK32_DIR $ARCHES32 $MINVER32" \
73 LDFLAGS="-Wl,-syslibroot,$SDK32_DIR $ARCHES32 $MINVER32 -Wl,-headerpad_max_install_names" \
76 echo "----Building 32 bit libcurl..."
79 echo "----Creating 32 bit framework..."
80 rm -r libcurl.framework
81 mkdir -p libcurl.framework/${FRAMEWORK_VERSION}/Resources
82 cp lib/.libs/libcurl.dylib libcurl.framework/${FRAMEWORK_VERSION}/libcurl
83 install_name_tool -id @executable_path/../Frameworks/libcurl.framework/${FRAMEWORK_VERSION}/libcurl libcurl.framework/${FRAMEWORK_VERSION}/libcurl
84 /usr/bin/sed -e "s/7\.12\.3/$VERSION/" lib/libcurl.plist >libcurl.framework/${FRAMEWORK_VERSION}/Resources/Info.plist
85 mkdir -p libcurl.framework/${FRAMEWORK_VERSION}/Headers/curl
86 cp include/curl/*.h libcurl.framework/${FRAMEWORK_VERSION}/Headers/curl
87 pushd libcurl.framework
88 ln -fs ${FRAMEWORK_VERSION}/libcurl libcurl
89 ln -fs ${FRAMEWORK_VERSION}/Resources Resources
90 ln -fs ${FRAMEWORK_VERSION}/Headers Headers
92 ln -fs ${FRAMEWORK_VERSION} Current
94 echo TEsting for SDK64
95 if test -d $SDK64_DIR; then
99 echo "----Configuring libcurl for 64 bit universal framework..."
100 ./configure --disable-dependency-tracking --disable-static --with-gssapi \
101 CFLAGS="-Os -isysroot $SDK64_DIR $ARCHES64 $MINVER64" \
102 LDFLAGS="-Wl,-syslibroot,$SDK64_DIR $ARCHES64 $MINVER64 -Wl,-headerpad_max_install_names" \
105 echo "----Building 64 bit libcurl..."
108 echo "----Appending 64 bit framework to 32 bit framework..."
109 cp lib/.libs/libcurl.dylib libcurl.framework/${FRAMEWORK_VERSION}/libcurl64
110 install_name_tool -id @executable_path/../Frameworks/libcurl.framework/${FRAMEWORK_VERSION}/libcurl libcurl.framework/${FRAMEWORK_VERSION}/libcurl64
111 cp libcurl.framework/${FRAMEWORK_VERSION}/libcurl libcurl.framework/${FRAMEWORK_VERSION}/libcurl32
113 lipo libcurl.framework/${FRAMEWORK_VERSION}/libcurl32 libcurl.framework/${FRAMEWORK_VERSION}/libcurl64 -create -output libcurl.framework/${FRAMEWORK_VERSION}/libcurl
114 rm libcurl.framework/${FRAMEWORK_VERSION}/libcurl32 libcurl.framework/${FRAMEWORK_VERSION}/libcurl64
115 cp libcurl.framework/${FRAMEWORK_VERSION}/Headers/curl/curlbuild.h libcurl.framework/${FRAMEWORK_VERSION}/Headers/curl/curlbuild32.h
116 cp include/curl/curlbuild.h libcurl.framework/${FRAMEWORK_VERSION}/Headers/curl/curlbuild64.h
117 cat >libcurl.framework/${FRAMEWORK_VERSION}/Headers/curl/curlbuild.h <<EOF
119 #include "curl/curlbuild64.h"
121 #include "curl/curlbuild32.h"
127 lipo -info libcurl.framework/${FRAMEWORK_VERSION}/libcurl
128 echo "libcurl.framework is built and can now be included in other projects."
129 echo "Copy libcurl.framework to your bundle's Contents/Frameworks folder, ~/Library/Frameworks or /Library/Frameworks."
131 echo "Building libcurl.framework requires Mac OS X 10.4 or later with the MacOSX10.4/5/6 SDK installed."