diff --git a/MacOSX-Framework b/MacOSX-Framework index 032d5dfc7..0c97acdc5 100755 --- a/MacOSX-Framework +++ b/MacOSX-Framework @@ -1,26 +1,76 @@ #!/bin/bash # This script performs all of the steps needed to build a # universal binary libcurl.framework for Mac OS X 10.4 or greater. +# +# Hendrik Visage: +# Generalizations added since Snowleopard (10.6) do not include +# the 10.4u SDK. +# +# Also note: +# 10.5 is the *ONLY* SDK that support PPC64 :( -- 10.6 do not have ppc64 support +#If you need to have PPC64 support then change below to 1 +PPC64_NEEDED=0 + +# For me the default is to develop for the platform I am on, and if you +#desire compatibility with older versions then change USE_OLD to 1 :) +USE_OLD=0 VERSION=`/usr/bin/sed -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' include/curl/curlver.h` +FRAMEWORK_VERSION=Versions/Release-$VERSION -SDK32='/Developer/SDKs/MacOSX10.4u.sdk' +#I also wanted to "copy over" the system, and thus the reason I added the +# version to Versions/Release-7.20.1 etc. +# now a simple rsync -vaP libcurl.framework /Library/Frameworks will install it +# and setup the right paths to this version, leaving the system version +# "intact", so you can "fix" it later with the links to Versions/A/... -MINVER32='-mmacosx-version-min=10.4' -ARCHES32='-arch ppc -arch i386' +OLD_SDK=`ls /Developer/SDKs|head -1` +NEW_SDK=`ls -r /Developer/SDKs|head -1` -SDK64='/Developer/SDKs/MacOSX10.5.sdk' +if test "0"$USE_OLD -gt 0 +then + SDK32=$OLD_SDK +else + SDK32=$NEW_SDK +fi -MINVER64='-mmacosx-version-min=10.5' +MACVER=`echo $SDK32|sed -e s/[a-zA-Z]//g -e s/.\$//` -ARCHES64='-arch ppc64 -arch x86_64' +SDK32_DIR='/Developer/SDKs/'$SDK32 +MINVER32='-mmacosx-version-min='$MACVER +ARCHES32='-arch i386 -arch ppc' -if test -d $SDK32; then + +if test $PPC64_NEEDED -gt 0 +then + SDK64=10.5 + ARCHES64='-arch x86_64 -arch ppc64' + SDK64=`ls /Developer/SDKs|grep 10.5|head -1` +else + ARCHES64='-arch x86_64' + #We "know" that 10.4 and earlier do not support 64bit + OLD_SDK64=`ls /Developer/SDKs|egrep -v "10.[0-4]"|head -1` + NEW_SDK64=`ls -r /Developer/SDKs|egrep -v "10.[0-4]"|head -1` + if test $USE_OLD -gt 0 + then + SDK64=$OLD_SDK64 + else + SDK64=$NEW_SDK64 + fi +fi + +SDK64_DIR='/Developer/SDKs/'$SDK64 +MACVER64=`echo $SDK64|sed -e s/[a-zA-Z]//g -e s/.\$//` + +MINVER64='-mmacosx-version-min='$MACVER64 + +if test ! -z $SDK32; then echo "----Configuring libcurl for 32 bit universal framework..." + make clean ./configure --disable-dependency-tracking --disable-static --with-gssapi \ - CFLAGS="-Os -isysroot $SDK32 $ARCHES32 $MINVER32" \ - LDFLAGS="-Wl,-syslibroot,$SDK32 $ARCHES32 $MINVER32 -Wl,-headerpad_max_install_names" \ + CFLAGS="-Os -isysroot $SDK32_DIR $ARCHES32 $MINVER32" \ + LDFLAGS="-Wl,-syslibroot,$SDK32_DIR $ARCHES32 $MINVER32 -Wl,-headerpad_max_install_names" \ CC=$CC echo "----Building 32 bit libcurl..." @@ -28,40 +78,43 @@ if test -d $SDK32; then echo "----Creating 32 bit framework..." rm -r libcurl.framework - mkdir -p libcurl.framework/Versions/A/Resources - cp lib/.libs/libcurl.dylib libcurl.framework/Versions/A/libcurl - install_name_tool -id @executable_path/../Frameworks/libcurl.framework/Versions/A/libcurl libcurl.framework/Versions/A/libcurl - /usr/bin/sed -e "s/7\.12\.3/$VERSION/" lib/libcurl.plist >libcurl.framework/Versions/A/Resources/Info.plist - mkdir -p libcurl.framework/Versions/A/Headers/curl - cp include/curl/*.h libcurl.framework/Versions/A/Headers/curl + mkdir -p libcurl.framework/${FRAMEWORK_VERSION}/Resources + cp lib/.libs/libcurl.dylib libcurl.framework/${FRAMEWORK_VERSION}/libcurl + install_name_tool -id @executable_path/../Frameworks/libcurl.framework/${FRAMEWORK_VERSION}/libcurl libcurl.framework/${FRAMEWORK_VERSION}/libcurl + /usr/bin/sed -e "s/7\.12\.3/$VERSION/" lib/libcurl.plist >libcurl.framework/${FRAMEWORK_VERSION}/Resources/Info.plist + mkdir -p libcurl.framework/${FRAMEWORK_VERSION}/Headers/curl + cp include/curl/*.h libcurl.framework/${FRAMEWORK_VERSION}/Headers/curl pushd libcurl.framework - ln -fs Versions/A/libcurl libcurl - ln -fs Versions/A/Resources Resources - ln -fs Versions/A/Headers Headers + ln -fs ${FRAMEWORK_VERSION}/libcurl libcurl + ln -fs ${FRAMEWORK_VERSION}/Resources Resources + ln -fs ${FRAMEWORK_VERSION}/Headers Headers cd Versions - ln -fs A Current + ln -fs ${FRAMEWORK_VERSION} Current - if test -d $SDK64; then + echo TEsting for SDK64 + if test -d $SDK64_DIR; then + echo entering... popd make clean echo "----Configuring libcurl for 64 bit universal framework..." ./configure --disable-dependency-tracking --disable-static --with-gssapi \ - CFLAGS="-Os -isysroot $SDK64 $ARCHES64 $MINVER64" \ - LDFLAGS="-Wl,-syslibroot,$SDK64 $ARCHES64 $MINVER64 -Wl,-headerpad_max_install_names" \ + CFLAGS="-Os -isysroot $SDK64_DIR $ARCHES64 $MINVER64" \ + LDFLAGS="-Wl,-syslibroot,$SDK64_DIR $ARCHES64 $MINVER64 -Wl,-headerpad_max_install_names" \ CC=$CC echo "----Building 64 bit libcurl..." make echo "----Appending 64 bit framework to 32 bit framework..." - cp lib/.libs/libcurl.dylib libcurl.framework/Versions/A/libcurl64 - install_name_tool -id @executable_path/../Frameworks/libcurl.framework/Versions/A/libcurl libcurl.framework/Versions/A/libcurl64 - cp libcurl.framework/Versions/A/libcurl libcurl.framework/Versions/A/libcurl32 - lipo libcurl.framework/Versions/A/libcurl32 libcurl.framework/Versions/A/libcurl64 -create -output libcurl.framework/Versions/A/libcurl - rm libcurl.framework/Versions/A/libcurl32 libcurl.framework/Versions/A/libcurl64 - cp libcurl.framework/Versions/A/Headers/curl/curlbuild.h libcurl.framework/Versions/A/Headers/curl/curlbuild32.h - cp include/curl/curlbuild.h libcurl.framework/Versions/A/Headers/curl/curlbuild64.h - cat >libcurl.framework/Versions/A/Headers/curl/curlbuild.h <libcurl.framework/${FRAMEWORK_VERSION}/Headers/curl/curlbuild.h <