commit 941b90a1b9d64eb7ea1664262cf1cb2976687500 Author: Bochun Bai Date: Fri Mar 28 23:39:06 2014 -0700 First version of scripts for iOS SDK 7.1 diff --git a/build_libcurl_dist.sh b/build_libcurl_dist.sh new file mode 100755 index 0000000..94e0bf1 --- /dev/null +++ b/build_libcurl_dist.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +export DEVROOT=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain + +function build_for_arch() { + ARCH=$1 + HOST=$2 + SYSROOT=$3 + PREFIX=$4 + IPHONEOS_DEPLOYMENT_TARGET="4.3" + export CC="${DEVROOT}/usr/bin/clang" + export CFLAGS="-arch ${ARCH} -pipe -Os -gdwarf-2 -isysroot ${SYSROOT} -miphoneos-version-min=${IPHONEOS_DEPLOYMENT_TARGET}" + export LDFLAGS="-arch ${ARCH} -isysroot ${SYSROOT}" + ./configure --disable-shared --enable-static --host="${HOST}" --prefix=${PREFIX} && make -j8 && make install +} + +TMP_DIR=/tmp/build_libcurl_$$ + +build_for_arch i386 i386-apple-darwin /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk ${TMP_DIR}/i386 +build_for_arch x86_64 x86_64-apple-darwin /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk ${TMP_DIR}/x86_64 +build_for_arch arm64 arm-apple-darwin /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk ${TMP_DIR}/arm64 +build_for_arch armv7s armv7s-apple-darwin /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk ${TMP_DIR}/armv7s +build_for_arch armv7 armv7-apple-darwin /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk ${TMP_DIR}/armv7 + +${DEVROOT}/usr/bin/lipo \ + -arch i386 ${TMP_DIR}/i386/lib/libcurl.a \ + -arch x86_64 ${TMP_DIR}/x86_64/lib/libcurl.a \ + -arch armv7 ${TMP_DIR}/armv7/lib/libcurl.a \ + -arch armv7s ${TMP_DIR}/armv7s/lib/libcurl.a \ + -arch arm64 ${TMP_DIR}/arm64/lib/libcurl.a \ + -output ${TMP_DIR}/libcurl.a -create + +cp -r ${TMP_DIR}/armv7s/include ${TMP_DIR}/ +curl -O https://raw.githubusercontent.com/sinofool/build-curl-ios/master/patch-include.patch +patch ${TMP_DIR}/include/curl/curlbuild.h < patch-include.patch + +DIST_DIR=${HOME}/libcurl-ios-dist +mkdir ${DIST_DIR} +cp -r ${TMP_DIR}/include ${TMP_DIR}/libcurl.a ${DIST_DIR} + diff --git a/patch-include.patch b/patch-include.patch new file mode 100644 index 0000000..ef5afcf --- /dev/null +++ b/patch-include.patch @@ -0,0 +1,55 @@ +diff include/curl/curlbuild.h armv7s/include/curl/curlbuild.h +136,138d135 +< #ifdef __LP64__ +< /* #undef CURL_PULL_STDINT_H */ +< #else +140d136 +< #endif +147,149d142 +< #ifdef __LP64__ +< /* #undef CURL_PULL_INTTYPES_H */ +< #else +151d143 +< #endif +171,173d162 +< #ifdef __LP64__ +< #define CURL_SIZEOF_LONG 8 +< #else +175d163 +< #endif +187,189d174 +< #ifdef __LP64__ +< #define CURL_TYPEOF_CURL_OFF_T long +< #else +191d175 +< #endif +197,199d180 +< #ifdef __LP64__ +< #define CURL_FORMAT_CURL_OFF_T "ld" +< #else +201d181 +< #endif +204,206d183 +< #ifdef __LP64__ +< #define CURL_FORMAT_CURL_OFF_TU "lu" +< #else +208d184 +< #endif +211,213d186 +< #ifdef __LP64__ +< #define CURL_FORMAT_OFF_T "%ld" +< #else +215d187 +< #endif +221,223d192 +< #ifdef __LP64__ +< #define CURL_SUFFIX_CURL_OFF_T L +< #else +225d193 +< #endif +228,230d195 +< #ifdef __LP64__ +< #define CURL_SUFFIX_CURL_OFF_TU UL +< #else +232d196 +< #endif