ios: update openssl build script
* remove patch - not required anymore * add support for arm64 and x86_64 openssl builds * update documentation
This commit is contained in:
parent
07407927c2
commit
1918b697c2
@ -30,10 +30,8 @@ different install/build directory you specify it as first parameter:
|
||||
|
||||
In the example above the output can then be found in /tmp/openssl.
|
||||
|
||||
The script uses oldest iOS/iPhoneSimulator SDK found on the build machine per default. If you need to build against a different SDK you can set USER_OS_SDK
|
||||
and/or USER_SIM_SDK in the top of the build script to the SDK version you need. E.g.:
|
||||
|
||||
USER_SIM_SDK="iPhoneSimulator6.0.sdk"
|
||||
The script uses oldest iOS/iPhoneSimulator SDK found on the build machine per default. If it is required to build against a specific SDK version
|
||||
the variable SDK_VERSION can be used to specify it. The minimum SDK version that should be used can be set with MIN_SDK_VERSION within the script.
|
||||
|
||||
When the script is finished you will find libcrypto.a and libssl.at, both universal libraries containing all openssl/lib
|
||||
subfolder in the specified
|
||||
|
@ -1,44 +1,87 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright 2013 Thincast Technologies GmbH
|
||||
# Copyright 2015 Thincast Technologies GmbH
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
||||
# If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
# This script will download and build openssl for iOS (armv7, armv7s) and simulator (i386)
|
||||
# This script will download and build openssl for iOS and simulator - see ARCHS for architectures built
|
||||
|
||||
# Settings and definitions
|
||||
USER_OS_SDK=""
|
||||
USER_SIM_SDK=""
|
||||
## Settings
|
||||
# openssl version to use
|
||||
OPENSSLVERSION="1.0.2a"
|
||||
MD5SUM="a06c547dac9044161a477211049f60ef"
|
||||
# SDK version to use - if not set latest version found is used
|
||||
SDK_VERSION=""
|
||||
|
||||
OPENSSLVERSION="1.0.0e"
|
||||
MD5SUM="7040b89c4c58c7a1016c0dfa6e821c86"
|
||||
OPENSSLPATCH="OpenSSL-iFreeRDP.diff"
|
||||
# Minimum SDK version the application supports
|
||||
MIN_SDK_VERSION=""
|
||||
|
||||
|
||||
## Defaults
|
||||
INSTALLDIR="external"
|
||||
|
||||
# Architectures to build
|
||||
ARCHS="i386 x86_64 armv7 armv7s arm64"
|
||||
|
||||
# Use default SDK version if not set
|
||||
if [ -z ${SDK_VERSION} ]; then
|
||||
SDK_VERSION=`xcrun -sdk iphoneos --show-sdk-version`
|
||||
fi
|
||||
|
||||
CORES=`sysctl hw.ncpu | awk '{print $2}'`
|
||||
MAKEOPTS="-j $CORES"
|
||||
# disable parallell builds since openssl build
|
||||
# fails sometimes
|
||||
MAKEOPTS=""
|
||||
CORES=`sysctl hw.ncpu | awk '{print $2}'`
|
||||
SCRIPTDIR=$(dirname `cd ${0%/*} && echo $PWD/${0##*/}`)
|
||||
OS_SDK=""
|
||||
SIM_SDK=""
|
||||
OS_SDK_PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs"
|
||||
SIM_SDK_PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs"
|
||||
|
||||
DEVELOPER=`xcode-select -print-path`
|
||||
if [ ! -d "$DEVELOPER" ]; then
|
||||
echo "xcode path is not set correctly $DEVELOPER does not exist (most likely because of xcode > 4.3)"
|
||||
echo "run"
|
||||
echo "sudo xcode-select -switch <xcode path>"
|
||||
echo "for default installation:"
|
||||
echo "sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Functions
|
||||
function buildArch(){
|
||||
ARCH=$1
|
||||
if [[ "${ARCH}" == "i386" || "${ARCH}" == "x86_64" ]];
|
||||
then
|
||||
PLATFORM="iPhoneSimulator"
|
||||
else
|
||||
sed -ie "s!static volatile sig_atomic_t intr_signal;!static volatile intr_signal;!" "crypto/ui/ui_openssl.c"
|
||||
PLATFORM="iPhoneOS"
|
||||
fi
|
||||
|
||||
export CROSS_TOP="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer"
|
||||
export CROSS_SDK="${PLATFORM}${SDK_VERSION}.sdk"
|
||||
export BUILD_TOOLS="${DEVELOPER}"
|
||||
export CC="${BUILD_TOOLS}/usr/bin/gcc -arch ${ARCH}"
|
||||
if [ ! -z $MIN_SDK_VERSION ]; then
|
||||
export CC="$CC -miphoneos-version-min=${MIN_SDK_VERSION}"
|
||||
fi
|
||||
echo "Building openssl-${OPENSSLVERSION} for ${PLATFORM} ${SDK_VERSION} ${ARCH} (min SDK set: ${MIN_SDK_VERSION:-"none"})"
|
||||
|
||||
LOGFILE="BuildLog.darwin-${ARCH}.txt"
|
||||
echo "Building architecture ${ARCH}. Please wait ..."
|
||||
./Configure darwin-${ARCH}-cc > ${LOGFILE}
|
||||
echo -n " Please wait ..."
|
||||
if [[ "$OPENSSLVERSION" =~ 1.0.0. ]]; then
|
||||
./Configure BSD-generic32 > "${LOGFILE}" 2>&1
|
||||
elif [ "${ARCH}" == "x86_64" ]; then
|
||||
./Configure darwin64-x86_64-cc > "${LOGFILE}" 2>&1
|
||||
elif [ "${ARCH}" == "i386" ]; then
|
||||
./Configure iphoneos-cross no-asm > "${LOGFILE}" 2>&1
|
||||
else
|
||||
./Configure iphoneos-cross > "${LOGFILE}" 2>&1
|
||||
fi
|
||||
|
||||
make ${MAKEOPTS} >> ${LOGFILE} 2>&1
|
||||
echo "Done. Build log saved in ${LOGFILE}"
|
||||
echo " Done. Build log saved in ${LOGFILE}"
|
||||
cp libcrypto.a ../../lib/libcrypto_${ARCH}.a
|
||||
cp libssl.a ../../lib/libssl_${ARCH}.a
|
||||
make clean >/dev/null 2>&1
|
||||
echo
|
||||
}
|
||||
|
||||
# main
|
||||
@ -50,38 +93,6 @@ if [ $# -gt 0 ];then
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Detecting SDKs..."
|
||||
if [ "x${USER_OS_SDK}" == "x" ];then
|
||||
OS_SDK=`ls -1 ${OS_SDK_PATH} | sort -n | head -1`
|
||||
if [ "x${OS_SDK}" == "x" ];then
|
||||
echo "No iPhoneOS SDK found"
|
||||
exit 1;
|
||||
fi
|
||||
else
|
||||
OS_SDK=${USER_OS_SDK}
|
||||
if [ ! -d "${OS_SDK_PATH}/${OS_SDK}" ];then
|
||||
echo "User specified iPhoneOS SDK not found"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
echo "Using iPhoneOS SDK: ${OS_SDK}"
|
||||
|
||||
if [ "x${USER_SIM_SDK}" == "x" ];then
|
||||
SIM_SDK=`ls -1 ${SIM_SDK_PATH} | sort -n | head -1`
|
||||
if [ "x${SIM_SDK}" == "x" ];then
|
||||
echo "No iPhoneSimulator SDK found"
|
||||
exit 1;
|
||||
fi
|
||||
else
|
||||
SIM_SDK=${USER_SIM_SDK}
|
||||
if [ ! -d "${SIM_SDK_PATH}/${SIM_SDK}" ];then
|
||||
echo "User specified iPhoneSimulator SDK not found"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
echo "Using iPhoneSimulator SDK: ${SIM_SDK}"
|
||||
echo
|
||||
|
||||
cd $INSTALLDIR
|
||||
if [ ! -d openssl ];then
|
||||
mkdir openssl
|
||||
@ -113,19 +124,14 @@ if [ ! $? = 0 ]; then
|
||||
fi
|
||||
echo
|
||||
|
||||
echo "Applying iFreeRDP patch ..."
|
||||
cd "openssl-$OPENSSLVERSION"
|
||||
cp ${SCRIPTDIR}/${OPENSSLPATCH} .
|
||||
sed -ie "s#__ISIMSDK__#${SIM_SDK}#" ${OPENSSLPATCH}
|
||||
sed -ie "s#__IOSSDK__#${OS_SDK}#" ${OPENSSLPATCH}
|
||||
|
||||
patch -p1 < $OPENSSLPATCH
|
||||
|
||||
if [ ! $? = 0 ]; then
|
||||
echo "Patch failed."
|
||||
exit 1
|
||||
fi
|
||||
echo
|
||||
case `pwd` in
|
||||
*\ * )
|
||||
echo "The build path (`pwd`) contains whitepsaces - fix this."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Cleanup old build artifacts
|
||||
mkdir -p ../../include/openssl
|
||||
@ -134,13 +140,13 @@ rm -f ../../include/openssl/*.h
|
||||
mkdir -p ../../lib
|
||||
rm -f ../../lib/*.a
|
||||
|
||||
echo "Copying header hiles ..."
|
||||
echo "Copying header files ..."
|
||||
cp include/openssl/*.h ../../include/openssl/
|
||||
echo
|
||||
|
||||
buildArch i386
|
||||
buildArch armv7
|
||||
buildArch armv7s
|
||||
for i in ${ARCHS}; do
|
||||
buildArch $i
|
||||
done
|
||||
|
||||
echo "Combining to unversal binary"
|
||||
lipo -create ../../lib/libcrypto_*.a -o ../../lib/libcrypto.a
|
||||
|
@ -1,25 +0,0 @@
|
||||
diff -rupN openssl-1.0.0e-ori/Configure openssl-1.0.0e/Configure
|
||||
--- openssl-1.0.0e-ori/Configure 2012-02-06 14:44:42.000000000 +0100
|
||||
+++ openssl-1.0.0e/Configure 2012-02-06 14:45:31.000000000 +0100
|
||||
@@ -555,6 +555,9 @@ my %table=(
|
||||
"debug-darwin-i386-cc","cc:-arch i386 -g3 -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:${x86_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
|
||||
"darwin64-x86_64-cc","cc:-arch x86_64 -O3 -DL_ENDIAN -DMD32_REG_T=int -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
|
||||
"debug-darwin-ppc-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DB_ENDIAN -g -Wall -O::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
|
||||
+"darwin-armv7s-cc","/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang:-arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/__IOSSDK__ -O3 -fomit-frame-pointer -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-arch armv4 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
|
||||
+"darwin-armv7-cc","/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang:-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/__IOSSDK__ -O3 -fomit-frame-pointer -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-arch armv4 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
|
||||
+"darwin-i386-cc","/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang: -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/__ISIMSDK__ -O3 -fomit-frame-pointer -DL_ENDIAN::-D_REENTRANT:MACOSX:-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",
|
||||
|
||||
##### A/UX
|
||||
"aux3-gcc","gcc:-O2 -DTERMIO::(unknown):AUX:-lbsd:RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::",
|
||||
diff -rupN openssl-1.0.0e-ori/crypto/ui/ui_openssl.c openssl-1.0.0e/crypto/ui/ui_openssl.c
|
||||
--- openssl-1.0.0e-ori/crypto/ui/ui_openssl.c 2012-02-06 14:44:43.000000000 +0100
|
||||
+++ openssl-1.0.0e/crypto/ui/ui_openssl.c 2012-02-06 14:46:10.000000000 +0100
|
||||
@@ -404,7 +404,7 @@ static int read_till_nl(FILE *in)
|
||||
return 1;
|
||||
}
|
||||
|
||||
-static volatile sig_atomic_t intr_signal;
|
||||
+static volatile int intr_signal;
|
||||
#endif
|
||||
|
||||
static int read_string_inner(UI *ui, UI_STRING *uis, int echo, int strip_nl)
|
Loading…
Reference in New Issue
Block a user