1.1.0c support

This commit is contained in:
Bai Bochun 2017-01-08 04:04:08 -08:00
parent 3b101136b5
commit 0d736f2161
4 changed files with 48 additions and 56 deletions

View file

@ -1,12 +1,13 @@
OpenSSL for iOS
=================
Build openssl for iOS development
This script will generate static library for armv7 armv7s arm64 i386 and x86_64.
This script will generate static library for armv7s arm64 and x86_64.
New Xcode7 bitcode feature supported.
Script only, please download openssl from here: http://www.openssl.org/source/
Tested iOS SDK 9.0 and MacOSX 10.11
Tested openssl 1.0.2d
Tested Xcode 8 and macOS 12
Tested openssl 1.1.0c
For 1.0.x version, please check branch 1.0.x
Usage

View file

@ -1,13 +1,13 @@
#!/bin/bash
TMP_DIR=/tmp/build_openssl_$$
CROSS_TOP_SIM="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer"
CROSS_TOP_SIM="`xcode-select --print-path`/Platforms/iPhoneSimulator.platform/Developer"
CROSS_SDK_SIM="iPhoneSimulator.sdk"
CROSS_TOP_IOS="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer"
CROSS_TOP_IOS="`xcode-select --print-path`/Platforms/iPhoneOS.platform/Developer"
CROSS_SDK_IOS="iPhoneOS.sdk"
TOOLCHAIN_ROOT="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain"
export CROSS_COMPILE=`xcode-select --print-path`/Toolchains/XcodeDefault.xctoolchain/usr/bin/
function build_for ()
{
@ -20,10 +20,9 @@ function build_for ()
export CROSS_TOP="${!CROSS_TOP_ENV}"
export CROSS_SDK="${!CROSS_SDK_ENV}"
./Configure $PLATFORM no-asm --prefix=${TMP_DIR}/${ARCH} || exit 1
./Configure $PLATFORM --prefix=${TMP_DIR}/${ARCH} || exit 1
# problem of concurrent build; make -j8
export PATH=${TOOLCHAIN_ROOT}/usr/bin:$PATH
make && make install || exit 2
make && make install_sw || exit 2
unset CROSS_TOP
unset CROSS_SDK
}
@ -33,30 +32,26 @@ function pack_for ()
LIBNAME=$1
mkdir -p ${TMP_DIR}/lib/
${DEVROOT}/usr/bin/lipo \
-arch i386 ${TMP_DIR}/i386/lib/lib${LIBNAME}.a \
-arch x86_64 ${TMP_DIR}/x86_64/lib/lib${LIBNAME}.a \
-arch armv7 ${TMP_DIR}/armv7/lib/lib${LIBNAME}.a \
-arch armv7s ${TMP_DIR}/armv7s/lib/lib${LIBNAME}.a \
-arch arm64 ${TMP_DIR}/arm64/lib/lib${LIBNAME}.a \
-output ${TMP_DIR}/lib/lib${LIBNAME}.a -create
}
curl -O https://raw.githubusercontent.com/sinofool/build-openssl-ios/master/patch-conf.patch
patch Configure < patch-conf.patch
#cp ../build-openssl-ios/patch-conf.patch .
patch Configurations/10-main.conf < patch-conf.patch
build_for iphoneos-cross-sim32 i386 SIM || exit 1
build_for iphoneos-cross-sim64 x86_64 SIM || exit 2
build_for iphoneos-cross-armv7 armv7 IOS || exit 3
build_for iphoneos-cross-armv7s armv7s IOS || exit 4
build_for iphoneos-cross-arm64 arm64 IOS || exit 5
build_for ios64sim-cross x86_64 SIM || exit 2
build_for ios-cross armv7s IOS || exit 4
build_for ios64-cross arm64 IOS || exit 5
pack_for ssl || exit 6
pack_for crypto || exit 7
cp -r ${TMP_DIR}/armv7s/include ${TMP_DIR}/
sed -i.old -e "96,102d" ${TMP_DIR}/include/openssl/opensslconf.h
rm -f ${TMP_DIR}/include/openssl/opensslconf.h.old
curl -O https://raw.githubusercontent.com/sinofool/build-openssl-ios/master/patch-include.patch
#cp ../build-openssl-ios/patch-include.patch .
patch -p3 ${TMP_DIR}/include/openssl/opensslconf.h < patch-include.patch
DFT_DIST_DIR=${HOME}/Desktop/openssl-ios-dist/

View file

@ -1,12 +1,8 @@
586,587c586,593
< # iPhoneOS/iOS
< "iphoneos-cross","llvm-gcc:-O3 -isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) -fomit-frame-pointer -fno-common::-D_REENTRANT:iOS:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
---
> # iOS 32 bit
> "iphoneos-cross-sim32","/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang:-arch i386 -O3 -isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) -miphoneos-version-min=6.0 -fomit-frame-pointer -fno-common -fembed-bitcode::-D_REENTRANT:iOS:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
> "iphoneos-cross-armv7","/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang:-arch armv7 -O3 -isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) -miphoneos-version-min=6.0 -fomit-frame-pointer -fno-common -fembed-bitcode::-D_REENTRANT:iOS:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
> "iphoneos-cross-armv7s","/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang:-arch armv7s -O3 -isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) -miphoneos-version-min=6.0 -fomit-frame-pointer -fno-common -fembed-bitcode::-D_REENTRANT:iOS:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
>
> # iOS 64 bit
> "iphoneos-cross-sim64","/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang:-arch x86_64 -O3 -isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) -miphoneos-version-min=7.0 -fomit-frame-pointer -fno-common -fembed-bitcode::-D_REENTRANT:iOS:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
> "iphoneos-cross-arm64","/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang:-arch arm64 -O3 -isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) -miphoneos-version-min=7.0 -fomit-frame-pointer -fno-common -fembed-bitcode::-D_REENTRANT:iOS:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
1630a1631,1637
> "ios64sim-cross" => {
> inherit_from => [ "darwin-common", asm("no_asm") ],
> cflags => add("-arch x86_64 -DOPENSSL_NO_ASM -mios-version-min=7.0.0 -isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) -fno-common"),
> sys_id => "iOS",
> bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
> perlasm_scheme => "ios64",
> },

View file

@ -1,28 +1,28 @@
--- armv7s/include/openssl/opensslconf.h 2014-09-30 11:49:06.000000000 -0700
+++ openssl-ios-dist/include/openssl/opensslconf.h 2014-09-30 11:58:34.000000000 -0700
@@ -156,15 +156,25 @@
#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
#define CONFIG_HEADER_BN_H
+#ifdef __LP64__
+#undef BN_LLONG
+#else
#define BN_LLONG
+#endif
/* Should we define BN_DIV2W here? */
--- armv7s/include/openssl/opensslconf.h 2017-01-08 02:25:43.000000000 -0800
+++ arm64/include/openssl/opensslconf.h 2017-01-08 03:44:44.000000000 -0800
@@ -158,11 +158,21 @@
* The following are cipher-specific, but are part of the public API.
*/
#if !defined(OPENSSL_SYS_UEFI)
-# define BN_LLONG
+# ifdef __LP64__
+# undef BN_LLONG
+# else
+# define BN_LLONG
+# endif
/* Only one for the following should be defined */
+#ifdef __LP64__
+#define SIXTY_FOUR_BIT_LONG
+#undef SIXTY_FOUR_BIT
+#undef THIRTY_TWO_BIT
+#else
#undef SIXTY_FOUR_BIT_LONG
#undef SIXTY_FOUR_BIT
#define THIRTY_TWO_BIT
-# undef SIXTY_FOUR_BIT_LONG
-# undef SIXTY_FOUR_BIT
-# define THIRTY_TWO_BIT
+# ifdef __LP64__
+# define SIXTY_FOUR_BIT_LONG
+# undef SIXTY_FOUR_BIT
+# undef THIRTY_TWO_BIT
+# else
+# undef SIXTY_FOUR_BIT_LONG
+# undef SIXTY_FOUR_BIT
+# define THIRTY_TWO_BIT
+# endif
#endif
+#endif
#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
#define CONFIG_HEADER_RC4_LOCL_H
#define RC4_INT unsigned char