MacOSX-Framework 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #!/bin/bash
  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.
  4. VERSION=`/usr/bin/sed -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' include/curl/curlver.h`
  5. SDK32='/Developer/SDKs/MacOSX10.4u.sdk'
  6. MINVER32='-mmacosx-version-min=10.4'
  7. ARCHES32='-arch ppc -arch i386'
  8. SDK64='/Developer/SDKs/MacOSX10.5.sdk'
  9. MINVER64='-mmacosx-version-min=10.5'
  10. ARCHES64='-arch ppc64 -arch x86_64'
  11. if test -d $SDK32; then
  12. echo "----Configuring libcurl for 32 bit universal framework..."
  13. ./configure --disable-dependency-tracking --disable-static --with-gssapi \
  14. CFLAGS="-Os -isysroot $SDK32 $ARCHES32 $MINVER32" \
  15. LDFLAGS="-Wl,-syslibroot,$SDK32 $ARCHES32 $MINVER32 -Wl,-headerpad_max_install_names" \
  16. CC=$CC
  17. echo "----Building 32 bit libcurl..."
  18. make
  19. echo "----Creating 32 bit framework..."
  20. rm -r libcurl.framework
  21. mkdir -p libcurl.framework/Versions/A/Resources
  22. cp lib/.libs/libcurl.dylib libcurl.framework/Versions/A/libcurl
  23. install_name_tool -id @executable_path/../Frameworks/libcurl.framework/Versions/A/libcurl libcurl.framework/Versions/A/libcurl
  24. /usr/bin/sed -e "s/7\.12\.3/$VERSION/" lib/libcurl.plist >libcurl.framework/Versions/A/Resources/Info.plist
  25. mkdir -p libcurl.framework/Versions/A/Headers/curl
  26. cp include/curl/*.h libcurl.framework/Versions/A/Headers/curl
  27. pushd libcurl.framework
  28. ln -fs Versions/A/libcurl libcurl
  29. ln -fs Versions/A/Resources Resources
  30. ln -fs Versions/A/Headers Headers
  31. cd Versions
  32. ln -fs A Current
  33. if test -d $SDK64; then
  34. popd
  35. make clean
  36. echo "----Configuring libcurl for 64 bit universal framework..."
  37. ./configure --disable-dependency-tracking --disable-static --with-gssapi \
  38. CFLAGS="-Os -isysroot $SDK64 $ARCHES64 $MINVER64" \
  39. LDFLAGS="-Wl,-syslibroot,$SDK64 $ARCHES64 $MINVER64 -Wl,-headerpad_max_install_names" \
  40. CC=$CC
  41. echo "----Building 64 bit libcurl..."
  42. make
  43. echo "----Appending 64 bit framework to 32 bit framework..."
  44. cp lib/.libs/libcurl.dylib libcurl.framework/Versions/A/libcurl64
  45. install_name_tool -id @executable_path/../Frameworks/libcurl.framework/Versions/A/libcurl libcurl.framework/Versions/A/libcurl64
  46. cp libcurl.framework/Versions/A/libcurl libcurl.framework/Versions/A/libcurl32
  47. lipo libcurl.framework/Versions/A/libcurl32 libcurl.framework/Versions/A/libcurl64 -create -output libcurl.framework/Versions/A/libcurl
  48. rm libcurl.framework/Versions/A/libcurl32 libcurl.framework/Versions/A/libcurl64
  49. cp libcurl.framework/Versions/A/Headers/curl/curlbuild.h libcurl.framework/Versions/A/Headers/curl/curlbuild32.h
  50. cp include/curl/curlbuild.h libcurl.framework/Versions/A/Headers/curl/curlbuild64.h
  51. cat >libcurl.framework/Versions/A/Headers/curl/curlbuild.h <<EOF
  52. #ifdef __LP64__
  53. #include "curl/curlbuild64.h"
  54. #else
  55. #include "curl/curlbuild32.h"
  56. #endif
  57. EOF
  58. fi
  59. lipo -info libcurl.framework/Versions/A/libcurl
  60. echo "libcurl.framework is built and can now be included in other projects."
  61. echo "Copy libcurl.framework to your bundle's Contents/Frameworks folder, ~/Library/Frameworks or /Library/Frameworks."
  62. else
  63. echo "Building libcurl.framework requires Mac OS X 10.4 or later with the MacOSX10.4u SDK installed."
  64. fi