Skip to content

Commit bad995f

Browse files
committed
Update build script to work on newer versions of macOS
1 parent df7284c commit bad995f

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

build-ios.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ fi
1212

1313
VERSION=$1
1414
ARCHIVE=curl.tar.gz
15-
echo "Downloading curl ${VERSION}"
16-
curl "https://curl.haxx.se/download/curl-${VERSION}.tar.gz" > "${ARCHIVE}"
15+
if [ ! -f "${ARCHIVE}" ]; then
16+
echo "Downloading curl ${VERSION}"
17+
curl "https://curl.haxx.se/download/curl-${VERSION}.tar.gz" > "${ARCHIVE}"
18+
fi
1719

1820
###########
1921
# COMPILE #
@@ -22,7 +24,6 @@ curl "https://curl.haxx.se/download/curl-${VERSION}.tar.gz" > "${ARCHIVE}"
2224
export OUTDIR=output
2325
export BUILDDIR=build
2426
export IPHONEOS_DEPLOYMENT_TARGET="9.3"
25-
export CC=`xcrun -find -sdk iphoneos clang`
2627

2728
function build() {
2829
ARCH=$1
@@ -36,10 +37,12 @@ function build() {
3637
tar -xzf "../${ARCHIVE}" -C "${WORKDIR}" --strip-components 1
3738
cd "${WORKDIR}"
3839

39-
export CFLAGS="-arch ${ARCH} -pipe -Os -gdwarf-2 -isysroot ${SDKDIR} -miphoneos-version-min=${IPHONEOS_DEPLOYMENT_TARGET} -fembed-bitcode"
40-
41-
export LDFLAGS="-arch ${ARCH} -isysroot ${SDKDIR}"
42-
40+
unset CFLAGS
41+
unset LDFLAGS
42+
CFLAGS="-arch ${ARCH} -pipe -Os -gdwarf-2 -isysroot ${SDKDIR} -I${SDKDIR}/usr/include -miphoneos-version-min=${IPHONEOS_DEPLOYMENT_TARGET} -fembed-bitcode"
43+
LDFLAGS="-arch ${ARCH} -isysroot ${SDKDIR}"
44+
export CFLAGS
45+
export LDFLAGS
4346
./configure --host="${HOST}-apple-darwin" \
4447
--disable-shared \
4548
--enable-static \
@@ -52,8 +55,7 @@ function build() {
5255
--disable-rtsp \
5356
--disable-ldap \
5457
--with-darwinssl > "${LOG}" 2>&1
55-
56-
make -j `sysctl -n hw.logicalcpu_max` >> "${LOG}" 2>&1
58+
make -j`sysctl -n hw.logicalcpu_max` >> "${LOG}" 2>&1
5759
cp lib/.libs/libcurl.a ../../$OUTDIR/libcurl-${ARCH}.a
5860
cd ../
5961
}
@@ -66,7 +68,6 @@ cd $BUILDDIR
6668
build armv7 armv7 `xcrun --sdk iphoneos --show-sdk-path`
6769
build armv7s armv7s `xcrun --sdk iphoneos --show-sdk-path`
6870
build arm64 arm `xcrun --sdk iphoneos --show-sdk-path`
69-
build i386 i386 `xcrun --sdk iphonesimulator --show-sdk-path`
7071
build x86_64 x86_64 `xcrun --sdk iphonesimulator --show-sdk-path`
7172

7273
cd ../
@@ -76,7 +77,6 @@ rm ${ARCHIVE}
7677
lipo -arch armv7 $OUTDIR/libcurl-armv7.a \
7778
-arch armv7s $OUTDIR/libcurl-armv7s.a \
7879
-arch arm64 $OUTDIR/libcurl-arm64.a \
79-
-arch i386 $OUTDIR/libcurl-i386.a \
8080
-arch x86_64 $OUTDIR/libcurl-x86_64.a \
8181
-create -output $OUTDIR/libcurl_all.a
8282

0 commit comments

Comments
 (0)