mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
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:
@@ -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.
|
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
|
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
|
||||||
and/or USER_SIM_SDK in the top of the build script to the SDK version you need. E.g.:
|
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.
|
||||||
|
|
||||||
USER_SIM_SDK="iPhoneSimulator6.0.sdk"
|
|
||||||
|
|
||||||
When the script is finished you will find libcrypto.a and libssl.at, both universal libraries containing all openssl/lib
|
When the script is finished you will find libcrypto.a and libssl.at, both universal libraries containing all openssl/lib
|
||||||
subfolder in the specified
|
subfolder in the specified
|
||||||
|
|||||||
@@ -1,44 +1,87 @@
|
|||||||
#!/bin/bash
|
#!/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.
|
# 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/.
|
# 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
|
## Settings
|
||||||
USER_OS_SDK=""
|
# openssl version to use
|
||||||
USER_SIM_SDK=""
|
OPENSSLVERSION="1.0.2a"
|
||||||
|
MD5SUM="a06c547dac9044161a477211049f60ef"
|
||||||
|
# SDK version to use - if not set latest version found is used
|
||||||
|
SDK_VERSION=""
|
||||||
|
|
||||||
OPENSSLVERSION="1.0.0e"
|
# Minimum SDK version the application supports
|
||||||
MD5SUM="7040b89c4c58c7a1016c0dfa6e821c86"
|
MIN_SDK_VERSION=""
|
||||||
OPENSSLPATCH="OpenSSL-iFreeRDP.diff"
|
|
||||||
|
|
||||||
|
## Defaults
|
||||||
INSTALLDIR="external"
|
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"
|
MAKEOPTS="-j $CORES"
|
||||||
# disable parallell builds since openssl build
|
# disable parallell builds since openssl build
|
||||||
# fails sometimes
|
# fails sometimes
|
||||||
MAKEOPTS=""
|
MAKEOPTS=""
|
||||||
CORES=`sysctl hw.ncpu | awk '{print $2}'`
|
|
||||||
SCRIPTDIR=$(dirname `cd ${0%/*} && echo $PWD/${0##*/}`)
|
DEVELOPER=`xcode-select -print-path`
|
||||||
OS_SDK=""
|
if [ ! -d "$DEVELOPER" ]; then
|
||||||
SIM_SDK=""
|
echo "xcode path is not set correctly $DEVELOPER does not exist (most likely because of xcode > 4.3)"
|
||||||
OS_SDK_PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs"
|
echo "run"
|
||||||
SIM_SDK_PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs"
|
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
|
# Functions
|
||||||
function buildArch(){
|
function buildArch(){
|
||||||
ARCH=$1
|
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"
|
LOGFILE="BuildLog.darwin-${ARCH}.txt"
|
||||||
echo "Building architecture ${ARCH}. Please wait ..."
|
echo -n " Please wait ..."
|
||||||
./Configure darwin-${ARCH}-cc > ${LOGFILE}
|
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
|
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 libcrypto.a ../../lib/libcrypto_${ARCH}.a
|
||||||
cp libssl.a ../../lib/libssl_${ARCH}.a
|
cp libssl.a ../../lib/libssl_${ARCH}.a
|
||||||
make clean >/dev/null 2>&1
|
make clean >/dev/null 2>&1
|
||||||
echo
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# main
|
# main
|
||||||
@@ -50,38 +93,6 @@ if [ $# -gt 0 ];then
|
|||||||
fi
|
fi
|
||||||
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
|
cd $INSTALLDIR
|
||||||
if [ ! -d openssl ];then
|
if [ ! -d openssl ];then
|
||||||
mkdir openssl
|
mkdir openssl
|
||||||
@@ -113,19 +124,14 @@ if [ ! $? = 0 ]; then
|
|||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
|
|
||||||
echo "Applying iFreeRDP patch ..."
|
|
||||||
cd "openssl-$OPENSSLVERSION"
|
cd "openssl-$OPENSSLVERSION"
|
||||||
cp ${SCRIPTDIR}/${OPENSSLPATCH} .
|
|
||||||
sed -ie "s#__ISIMSDK__#${SIM_SDK}#" ${OPENSSLPATCH}
|
|
||||||
sed -ie "s#__IOSSDK__#${OS_SDK}#" ${OPENSSLPATCH}
|
|
||||||
|
|
||||||
patch -p1 < $OPENSSLPATCH
|
case `pwd` in
|
||||||
|
*\ * )
|
||||||
if [ ! $? = 0 ]; then
|
echo "The build path (`pwd`) contains whitepsaces - fix this."
|
||||||
echo "Patch failed."
|
exit 1
|
||||||
exit 1
|
;;
|
||||||
fi
|
esac
|
||||||
echo
|
|
||||||
|
|
||||||
# Cleanup old build artifacts
|
# Cleanup old build artifacts
|
||||||
mkdir -p ../../include/openssl
|
mkdir -p ../../include/openssl
|
||||||
@@ -134,13 +140,13 @@ rm -f ../../include/openssl/*.h
|
|||||||
mkdir -p ../../lib
|
mkdir -p ../../lib
|
||||||
rm -f ../../lib/*.a
|
rm -f ../../lib/*.a
|
||||||
|
|
||||||
echo "Copying header hiles ..."
|
echo "Copying header files ..."
|
||||||
cp include/openssl/*.h ../../include/openssl/
|
cp include/openssl/*.h ../../include/openssl/
|
||||||
echo
|
echo
|
||||||
|
|
||||||
buildArch i386
|
for i in ${ARCHS}; do
|
||||||
buildArch armv7
|
buildArch $i
|
||||||
buildArch armv7s
|
done
|
||||||
|
|
||||||
echo "Combining to unversal binary"
|
echo "Combining to unversal binary"
|
||||||
lipo -create ../../lib/libcrypto_*.a -o ../../lib/libcrypto.a
|
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)
|
|
||||||
Reference in New Issue
Block a user