@@ -21,28 +21,39 @@ function setup ()
2121
2222function build_ssl ()
2323{
24- cp -r " ${ROOT_PATH} /External/openssl" " ${ARCH_INSTALL_PATH} /openssl"
25- pushd " ${ARCH_INSTALL_PATH} /openssl" > /dev/null
24+ if [ -f " ${ARCH_INSTALL_PATH} /lib/libssl.a" -a \
25+ -f " ${ARCH_INSTALL_PATH} /lib/libcrypto.a" ]; then
26+ echo " No building needed." 2>&1
27+ else
2628
27- if [ " ${ARCH} " == " arm64" ] || [ " ${ARCH} " == " x86_64" ]
28- then
29- HOST=" BSD-generic64"
30- CONFIG=" no-gost no-asm enable-ec_nistp_64_gcc_128"
31- else
32- HOST=" BSD-generic32"
33- CONFIG=" no-gost no-asm"
34- perl -i -pe ' s|static volatile sig_atomic_t intr_signal|static volatile int intr_signal|' crypto/ui/ui_openssl.c
35- fi
29+ cp -r " ${ROOT_PATH} /External/openssl" " ${ARCH_INSTALL_PATH} /openssl"
30+ pushd " ${ARCH_INSTALL_PATH} /openssl" > /dev/null
3631
37- ./Configure ${HOST} ${CONFIG} --openssldir=" ${ARCH_INSTALL_PATH} " >> " ${LOG} " 2>&1
38- perl -i -pe " s|^CC= gcc|CC= ${CLANG} -miphoneos-version-min=${IPHONEOS_DEPLOYMENT_TARGET} -arch ${ARCH} -fembed-bitcode |g" Makefile >> " ${LOG} " 2>&1
39- perl -i -pe " s|^CFLAG= (.*)|CFLAG= -isysroot ${SDKROOT} \$ 1|g" Makefile >> " ${LOG} " 2>&1
40- make >> " ${LOG} " 2>&1
32+ if [ " ${ARCH} " == " x86_64" ]; then
33+ HOST=" iossimulator-xcrun"
34+ CONFIG=" "
35+ elif [ " ${ARCH} " == " arm64" ]; then
36+ HOST=" ios64-cross"
37+ CONFIG=" "
38+ elif [ " ${ARCH} " == " armv7" ] || [ " ${ARCH} " == " armv7s" ]; then
39+ HOST=" ios-cross"
40+ CONFIG=" "
41+ else
42+ echo " Unhandled ARCH: ${ARCH} "
43+ exit -1
44+ fi
4145
42- make install_sw >> " ${LOG} " 2>&1
43- popd > /dev/null
46+ echo " ./Configure ${HOST} ${CONFIG} --prefix=\" ${ARCH_INSTALL_PATH} \" --openssldir=\" ${ARCH_INSTALL_PATH} \" >> \" ${LOG} \" 2>&1"
47+ ./Configure ${HOST} ${CONFIG} --prefix=${ARCH_INSTALL_PATH} --openssldir=" ${ARCH_INSTALL_PATH} " >> " ${LOG} " 2>&1
48+ perl -i -pe " s|^CFLAGS=(.*)|CFLAGS= -arch ${ARCH} -miphoneos-version-min=${IPHONEOS_DEPLOYMENT_TARGET} -isysroot ${SDKROOT} -fembed-bitcode \$ 1|g" Makefile >> " ${LOG} " 2>&1
49+ perl -i -pe " s|-arch (\w+)|-arch ${ARCH} |g" Makefile >> " ${LOG} " 2>&1
50+ make >> " ${LOG} " 2>&1
4451
45- rm -rf " ${ARCH_INSTALL_PATH} /openssl"
52+ make install_sw >> " ${LOG} " 2>&1
53+ popd > /dev/null
54+
55+ rm -rf " ${ARCH_INSTALL_PATH} /openssl"
56+ fi
4657
4758 BUILT_CRYPTO_PATHS+=(" ${ARCH_INSTALL_PATH} /lib/libcrypto.a" )
4859 BUILT_SSL_PATHS+=(" ${ARCH_INSTALL_PATH} /lib/libssl.a" )
0 commit comments