Skip to content

Commit b47fc59

Browse files
committed
fix openssl compile error on ios
1 parent 416b7a2 commit b47fc59

File tree

3 files changed

+30
-10
lines changed

3 files changed

+30
-10
lines changed

build/android/build.sh

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/bin/sh
22
set -e
3+
set -x
34

45
info()
56
{
@@ -17,10 +18,10 @@ ANDROID_ARCH=arm
1718

1819
# TODO: configure to compile specify 3rd party libraries
1920
OPTIONS="
20-
--disable-lua
21-
--disable-freetype2
21+
--enable-lua
22+
--enable-freetype2
2223
--enable-png
23-
--disable-zlib
24+
--enable-zlib
2425
"
2526

2627
usage()
@@ -34,6 +35,7 @@ OPTIONS:
3435
-k <sdk> Use the specified Android API level (default: $ANDROID_API)
3536
-a <arch> Use the specified arch (default: $ANDROID_ABI)
3637
-n <version> Use the gcc version(default: $ANDROID_GCC_VERSION)
38+
-l <libname> Use the specified library name
3739
EOF
3840
}
3941

@@ -47,7 +49,7 @@ spopd()
4749
popd > /dev/null
4850
}
4951

50-
while getopts "hvk:a:" OPTION
52+
while getopts "hvk:a:l:" OPTION
5153
do
5254
case $OPTION in
5355
h)
@@ -57,16 +59,19 @@ do
5759
q)
5860
set +x
5961
QUIET="yes"
60-
;;
62+
;;
6163
a)
6264
ANDROID_ABI=$OPTARG
63-
;;
65+
;;
6466
k)
6567
ANDROID_API=$OPTARG
66-
;;
68+
;;
6769
n)
6870
ANDROID_GCC_VERSION=$OPTARG
69-
;;
71+
;;
72+
l)
73+
OPTIONS=--enable-$OPTARG
74+
;;
7075
esac
7176
done
7277

@@ -106,8 +111,8 @@ cocos_root=`pwd`/../..
106111

107112
export ANDROID_ABI
108113
export ANDROID_API
109-
export LDFLAGS="-L${ANDROID_NDK}/platforms/${ANDROID_API}/arch-${ANDROID_ARCH}/usr/lib"
110-
info "LD FLAGS SELECTED = '${LDFLAGS}'"
114+
# export LDFLAGS="-L${ANDROID_NDK}/platforms/${ANDROID_API}/arch-${ANDROID_ARCH}/usr/lib"
115+
# info "LD FLAGS SELECTED = '${LDFLAGS}'"
111116

112117
export PATH="${toolchain_bin}:${cocos_root}/extras/tools/bin:$PATH"
113118
#

build/ios/build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ fi
203203

204204
echo "EXTRA_CFLAGS += ${EXTRA_CFLAGS}" >> config.mak
205205
echo "EXTRA_LDFLAGS += ${EXTRA_LDFLAGS}" >> config.mak
206+
echo "IOS_ARCH := ${ARCH}" >> config.mak
206207
make fetch
207208
make list
208209
make

contrib/src/openssl/rules.mak

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ ifdef HAVE_ANDROID
2222
OPENSSL_COMPILER=os/compiler:$(HOST)
2323
endif
2424

25+
ifeq ($(IOS_ARCH),armv7)
26+
OPENSSL_CONFIG_VARS="BSD-generic32"
27+
endif
28+
29+
ifeq ($(IOS_ARCH),i386)
30+
OPENSSL_CONFIG_VARS="BSD-generic32"
31+
endif
32+
33+
2534
$(TARBALLS)/openssl-$(OPENSSL_VERSION).tar.gz:
2635
$(call download,$(OPENSSL_URL))
2736

@@ -36,5 +45,10 @@ endif
3645

3746
.openssl: openssl
3847
cd $< && $(HOSTVARS) ./Configure $(OPENSSL_CONFIG_VARS) --prefix=$(PREFIX) $(OPENSSL_COMPILER)
48+
ifdef HAVE_IOS
49+
# cd $< && perl -i -pe 's|static volatile sig_atomic_t intr_signal|static volatile int intr_signal|' crypto/ui/ui_openssl.c
50+
cd $< && perl -i -pe "s|^CC= xcrun clang|CC= xcrun cc -arch ${IOS_ARCH} -miphoneos-version-min=6.0 |g" Makefile
51+
cd $< && perl -i -pe "s|^CFLAG= (.*)|CFLAG= -isysroot ${IOS_SDK} |g" Makefile
52+
endif
3953
cd $< && $(MAKE) install
4054
touch $@

0 commit comments

Comments
 (0)