First version of build script for iOS SDK7.1

This commit is contained in:
Bochun Bai 2014-03-28 22:14:47 -07:00
commit 31672a0be3
3 changed files with 84 additions and 0 deletions

58
build_openssl_dist.sh Executable file
View file

@ -0,0 +1,58 @@
#!/bin/bash
TMP_DIR=/tmp/build_openssl_$$
CROSS_TOP_SIM="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer"
CROSS_SDK_SIM="iPhoneSimulator7.1.sdk"
CROSS_TOP_IOS="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer"
CROSS_SDK_IOS="iPhoneOS7.1.sdk"
function build_for ()
{
PLATFORM=$1
ARCH=$2
CROSS_TOP_ENV=CROSS_TOP_$3
CROSS_SDK_ENV=CROSS_SDK_$3
make clean
export CROSS_TOP="${!CROSS_TOP_ENV}"
export CROSS_SDK="${!CROSS_SDK_ENV}"
./Configure $PLATFORM no-asm --prefix=${TMP_DIR}/${ARCH} || exit 1
# problem of concurrent build; make -j8
make && make install || exit 2
unset CROSS_TOP
unset CROSS_SDK
}
function pack_for ()
{
LIBNAME=$1
${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${LIBNAME}.a -create
}
patch Configure < https://raw.githubusercontent.com/sinofool/build-openssl-ios/master/patch-conf.patch
build_for iphoneos-cross-sim32 i386 SIM
build_for iphoneos-cross-sim64 x86_64 SIM
build_for iphoneos-cross-armv7 armv7 IOS
build_for iphoneos-cross-armv7s armv7s IOS
build_for iphoneos-cross-arm64 arm64 IOS
pack_for ssl
pack_for crypto
cp -r ${TMP_DIR}/armv7s/include ${TMP_DIR}/
sed -i -e "90,96d" ${TMP_DIR}/include/openssl/opensslconf.h
patch ${TMP_DIR}/include/openssl/opensslconf.h < https://raw.githubusercontent.com/sinofool/build-openssl-ios/master/patch-include.patch
DIST_DIR=${HOME}/Desktop/openssl-ios-dist/
mkdir ${DIST_DIR}
cp -r ${TMP_DIR}/include ${TMP_DIR}/libssl.a ${TMP_DIR}/libcrypto.a ${DIST_DIR}

12
patch-conf.patch Normal file
View file

@ -0,0 +1,12 @@
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=4.3 -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",
> "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=4.3 -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",
> "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=4.3 -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 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::-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::-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",

14
patch-include.patch Normal file
View file

@ -0,0 +1,14 @@
137a138,140
> #if defined(__LP64__)
> #undef BN_LLONG
> #else
138a142
> #endif
142a147,151
> #if defined(__LP64__)
> #define SIXTY_FOUR_BIT_LONG
> #undef SIXTY_FOUR_BIT
> #undef THIRTY_TWO_BIT
> #else
146a156
> #endif