@@ -14,104 +14,80 @@ VERSION=$1
1414ARCHIVE=curl.tar.gz
1515if [ ! -f " ${ARCHIVE} " ]; then
1616 echo " Downloading curl ${VERSION} "
17- curl " https://curl.haxx. se/download/curl-${VERSION} .tar.gz" > " ${ARCHIVE} "
17+ curl " https://curl.se/download/curl-${VERSION} .tar.gz" > " ${ARCHIVE} "
1818fi
1919
2020# ##########
2121# COMPILE #
2222# ##########
2323
24- export OUTDIR=output
25- export BUILDDIR=build
26- export IPHONEOS_DEPLOYMENT_TARGET=" 9.3"
24+ BUILDDIR=build
2725
2826function build() {
2927 ARCH=$1
3028 HOST=$2
31- SDKDIR=$3
32- LOG=" ../${ARCH} _build.log"
33- echo " Building libcurl for ${ARCH} ..."
29+ SDK=$3
30+ SDKDIR=$( xcrun --sdk ${SDK} --show-sdk-path)
31+ LOG=" ../${ARCH} -${SDK} _build.log"
32+ echo " Building libcurl for ${ARCH} -${SDK} ..."
3433
35- WORKDIR=curl_${ARCH}
34+ WORKDIR=curl_${ARCH} - ${SDK}
3635 mkdir " ${WORKDIR} "
3736 tar -xzf " ../${ARCHIVE} " -C " ${WORKDIR} " --strip-components 1
3837 cd " ${WORKDIR} "
3938
40- for FILE in $( find ../../patches -name ' *.patch' ) ; do
39+ for FILE in $( find ../../patches -name ' *.patch' 2> /dev/null ) ; do
4140 patch -p1 < ${FILE}
4241 done
4342
44- unset CFLAGS
45- unset LDFLAGS
46- CFLAGS=" -arch ${ARCH} -pipe -Os -gdwarf-2 -isysroot ${SDKDIR} -I${SDKDIR} /usr/include -miphoneos-version-min=${IPHONEOS_DEPLOYMENT_TARGET} -fembed-bitcode"
47- LDFLAGS=" -arch ${ARCH} -isysroot ${SDKDIR} "
48- export CFLAGS
49- export LDFLAGS
50- ./configure --host=" ${HOST} -apple-darwin" \
43+ export CC=$( xcrun -find -sdk ${SDK} gcc)
44+ export CFLAGS=" -arch ${ARCH} -pipe -Os -gdwarf-2 -isysroot ${SDKDIR} -m${SDK} -version-min=12.0"
45+ export LDFLAGS=" -arch ${ARCH} -isysroot ${SDKDIR} "
46+
47+ ./configure \
48+ --host=" ${HOST} -apple-darwin" \
5149 --disable-shared \
5250 --enable-static \
53- --disable-smtp \
54- --disable-pop3 \
55- --disable-imap \
56- --disable-ftp \
57- --disable-tftp \
58- --disable-telnet \
59- --disable-rtsp \
60- --disable-ldap \
61- --with-darwinssl > " ${LOG} " 2>&1
51+ --without-libidn2 \
52+ --without-nghttp2 \
53+ --without-nghttp3 \
54+ --with-secure-transport \
55+ --prefix $( pwd) /artifacts > " ${LOG} " 2>&1
56+
6257 make -j` sysctl -n hw.logicalcpu_max` >> " ${LOG} " 2>&1
63- cp lib/.libs/libcurl.a ../../ $OUTDIR /libcurl- ${ARCH} .a
58+ make install >> " ${LOG} " 2>&1
6459 cd ../
6560}
6661
67- rm -rf $OUTDIR $BUILDDIR
68- mkdir $OUTDIR
69- mkdir $BUILDDIR
70- cd $BUILDDIR
62+ rm -rf ${BUILDDIR}
63+ mkdir ${BUILDDIR}
64+ cd ${BUILDDIR}
7165
72- build armv7 armv7 ` xcrun --sdk iphoneos --show-sdk-path`
73- build armv7s armv7s ` xcrun --sdk iphoneos --show-sdk-path`
74- build arm64 arm ` xcrun --sdk iphoneos --show-sdk-path`
75- build x86_64 x86_64 ` xcrun --sdk iphonesimulator --show-sdk-path`
66+ build arm64 arm iphoneos
67+ build arm64 arm iphonesimulator
68+ build x86_64 x86_64 iphonesimulator
7669
7770cd ../
7871
79- rm ${ARCHIVE}
80-
81- lipo -arch armv7 $OUTDIR /libcurl-armv7.a \
82- -arch armv7s $OUTDIR /libcurl-armv7s.a \
83- -arch arm64 $OUTDIR /libcurl-arm64.a \
84- -arch x86_64 $OUTDIR /libcurl-x86_64.a \
85- -create -output $OUTDIR /libcurl_all.a
86-
8772# ##########
8873# PACKAGE #
8974# ##########
9075
91- FWNAME=curl
92-
93- if [ -d $FWNAME .framework ]; then
94- echo " Removing previous $FWNAME .framework copy"
95- rm -rf $FWNAME .framework
96- fi
97-
98- LIBTOOL_FLAGS=" -static"
99-
100- echo " Creating $FWNAME .framework"
101- mkdir -p $FWNAME .framework/Headers
102- libtool -no_warning_for_no_symbols $LIBTOOL_FLAGS -o $FWNAME .framework/$FWNAME $OUTDIR /libcurl_all.a
103- cp -r $BUILDDIR /curl_arm64/include/$FWNAME /* .h $FWNAME .framework/Headers/
104-
105- rm -rf $BUILDDIR
106- rm -rf $OUTDIR
107-
108- cp " Info.plist" $FWNAME .framework/Info.plist
109-
110- set +e
111- check_bitcode=$( otool -arch arm64 -l $FWNAME .framework/$FWNAME | grep __bitcode)
112- if [ -z " $check_bitcode " ]
113- then
114- echo " INFO: $FWNAME .framework doesn't contain Bitcode"
115- else
116- echo " INFO: $FWNAME .framework contains Bitcode"
117- fi
76+ lipo \
77+ -arch arm64 ${BUILDDIR} /curl_arm64-iphonesimulator/artifacts/lib/libcurl.a \
78+ -arch x86_64 ${BUILDDIR} /curl_x86_64-iphonesimulator/artifacts/lib/libcurl.a \
79+ -create -output ${BUILDDIR} /libcurl.a
80+
81+ rm -rf ${BUILDDIR} /iphoneos/curl.framework ${BUILDDIR} /iphonesimulator/curl.framework
82+ mkdir -p ${BUILDDIR} /iphoneos/curl.framework/Headers ${BUILDDIR} /iphonesimulator/curl.framework/Headers
83+ libtool -no_warning_for_no_symbols -static -o ${BUILDDIR} /iphoneos/curl.framework/curl ${BUILDDIR} /curl_arm64-iphoneos/artifacts/lib/libcurl.a
84+ cp -r ${BUILDDIR} /curl_arm64-iphoneos/artifacts/include/curl/* .h ${BUILDDIR} /iphoneos/curl.framework/Headers
85+ libtool -no_warning_for_no_symbols -static -o ${BUILDDIR} /iphonesimulator/curl.framework/curl ${BUILDDIR} /libcurl.a
86+ cp -r ${BUILDDIR} /curl_arm64-iphonesimulator/artifacts/include/curl/* .h ${BUILDDIR} /iphonesimulator/curl.framework/Headers
87+
88+ rm -rf curl.xcframework
89+ xcodebuild -create-xcframework \
90+ -framework ${BUILDDIR} /iphoneos/curl.framework \
91+ -framework ${BUILDDIR} /iphonesimulator/curl.framework \
92+ -output curl.xcframework
93+ plutil -insert CFBundleVersion -string ${VERSION} curl.xcframework/Info.plist
0 commit comments