2009-02-23 13:39:06 +01:00
|
|
|
#!/bin/bash
|
2010-02-14 20:40:18 +01:00
|
|
|
# This script performs all of the steps needed to build a
|
2009-02-23 13:39:06 +01:00
|
|
|
# universal binary libcurl.framework for Mac OS X 10.4 or greater.
|
|
|
|
|
|
|
|
VERSION=`/usr/bin/sed -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' include/curl/curlver.h`
|
|
|
|
|
2009-04-10 04:50:21 +02:00
|
|
|
SDK32='/Developer/SDKs/MacOSX10.4u.sdk'
|
2009-02-23 13:39:06 +01:00
|
|
|
|
2009-04-10 04:50:21 +02:00
|
|
|
MINVER32='-mmacosx-version-min=10.4'
|
2009-02-23 13:39:06 +01:00
|
|
|
|
2009-04-10 04:50:21 +02:00
|
|
|
ARCHES32='-arch ppc -arch i386'
|
2009-02-23 13:39:06 +01:00
|
|
|
|
2009-04-10 04:50:21 +02:00
|
|
|
SDK64='/Developer/SDKs/MacOSX10.5.sdk'
|
2009-02-23 13:39:06 +01:00
|
|
|
|
2009-04-10 04:50:21 +02:00
|
|
|
MINVER64='-mmacosx-version-min=10.5'
|
2009-02-23 13:39:06 +01:00
|
|
|
|
2009-04-10 04:50:21 +02:00
|
|
|
ARCHES64='-arch ppc64 -arch x86_64'
|
|
|
|
|
|
|
|
if test -d $SDK32; then
|
|
|
|
echo "----Configuring libcurl for 32 bit universal framework..."
|
2009-02-23 13:39:06 +01:00
|
|
|
./configure --disable-dependency-tracking --disable-static --with-gssapi \
|
2009-04-10 04:50:21 +02:00
|
|
|
CFLAGS="-Os -isysroot $SDK32 $ARCHES32 $MINVER32" \
|
|
|
|
LDFLAGS="-Wl,-syslibroot,$SDK32 $ARCHES32 $MINVER32 -Wl,-headerpad_max_install_names" \
|
|
|
|
CC=$CC
|
2010-02-14 20:40:18 +01:00
|
|
|
|
2009-04-10 04:50:21 +02:00
|
|
|
echo "----Building 32 bit libcurl..."
|
2009-02-23 13:39:06 +01:00
|
|
|
make
|
2010-02-14 20:40:18 +01:00
|
|
|
|
2009-04-10 04:50:21 +02:00
|
|
|
echo "----Creating 32 bit framework..."
|
2009-02-23 13:39:06 +01:00
|
|
|
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
|
2009-04-10 04:50:21 +02:00
|
|
|
mkdir -p libcurl.framework/Versions/A/Headers/curl
|
|
|
|
cp include/curl/*.h libcurl.framework/Versions/A/Headers/curl
|
|
|
|
pushd libcurl.framework
|
2009-02-23 13:39:06 +01:00
|
|
|
ln -fs Versions/A/libcurl libcurl
|
|
|
|
ln -fs Versions/A/Resources Resources
|
|
|
|
ln -fs Versions/A/Headers Headers
|
|
|
|
cd Versions
|
|
|
|
ln -fs A Current
|
2010-02-14 20:40:18 +01:00
|
|
|
|
2009-04-10 04:50:21 +02:00
|
|
|
if test -d $SDK64; then
|
|
|
|
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" \
|
|
|
|
CC=$CC
|
2010-02-14 20:40:18 +01:00
|
|
|
|
2009-04-10 04:50:21 +02:00
|
|
|
echo "----Building 64 bit libcurl..."
|
|
|
|
make
|
2010-02-14 20:40:18 +01:00
|
|
|
|
2009-04-10 04:50:21 +02:00
|
|
|
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 <<EOF
|
|
|
|
#ifdef __LP64__
|
|
|
|
#include "curl/curlbuild64.h"
|
|
|
|
#else
|
|
|
|
#include "curl/curlbuild32.h"
|
|
|
|
#endif
|
|
|
|
EOF
|
|
|
|
fi
|
2010-02-14 20:40:18 +01:00
|
|
|
|
2009-04-10 04:50:21 +02:00
|
|
|
lipo -info libcurl.framework/Versions/A/libcurl
|
2009-02-23 13:39:06 +01:00
|
|
|
echo "libcurl.framework is built and can now be included in other projects."
|
2009-04-10 04:50:21 +02:00
|
|
|
echo "Copy libcurl.framework to your bundle's Contents/Frameworks folder, ~/Library/Frameworks or /Library/Frameworks."
|
2009-02-23 13:39:06 +01:00
|
|
|
else
|
|
|
|
echo "Building libcurl.framework requires Mac OS X 10.4 or later with the MacOSX10.4u SDK installed."
|
|
|
|
fi
|