Add support for tvOS

This commit is contained in:
Felix Schulze 2015-11-16 19:33:54 +01:00
parent 3d1cf2070e
commit a9ab81be88
2 changed files with 58 additions and 33 deletions

View File

@ -23,6 +23,7 @@ If you have problems building for arm64 please uninstall MacPorts (see #28).
* <http://www.x2on.de/2010/07/13/tutorial-iphone-app-with-compiled-openssl-1-0-0a-library/> * <http://www.x2on.de/2010/07/13/tutorial-iphone-app-with-compiled-openssl-1-0-0a-library/>
## Changelog ## Changelog
* 2015-11-16: tvOS support
* 2015-10-25: Xcode 7.1 support * 2015-10-25: Xcode 7.1 support
* 2015-08-06: iOS 9.0 support, Bitcode support * 2015-08-06: iOS 9.0 support, Bitcode support
* 2015-07-09: OpenSSL 1.0.2d, iOS 8.4 * 2015-07-09: OpenSSL 1.0.2d, iOS 8.4

View File

@ -22,7 +22,8 @@
# Change values here # # Change values here #
# #
VERSION="1.0.2d" # VERSION="1.0.2d" #
SDKVERSION=`xcrun -sdk iphoneos --show-sdk-version` # IOS_SDKVERSION=`xcrun -sdk iphoneos --show-sdk-version`
TVOS_SDKVERSION=`xcrun -sdk appletvos --show-sdk-version` #
CONFIG_OPTIONS="" CONFIG_OPTIONS=""
CURL_OPTIONS="" CURL_OPTIONS=""
@ -37,12 +38,13 @@ ENABLE_EC_NISTP_64_GCC_128=""
CURRENTPATH=`pwd` CURRENTPATH=`pwd`
ARCHS="i386 x86_64 armv7 armv7s arm64" ARCHS="i386 x86_64 armv7 armv7s arm64 tv_x86_64 tv_arm64"
DEVELOPER=`xcode-select -print-path` DEVELOPER=`xcode-select -print-path`
MIN_SDK_VERSION="7.0" IOS_MIN_SDK_VERSION="7.0"
TVOS_MIN_SDK_VERSION="9.0"
if [ ! -d "$DEVELOPER" ]; then if [ ! -d "$DEVELOPER" ]; then
echo "xcode path is not set correctly $DEVELOPER does not exist (most likely because of xcode > 4.3)" echo "xcode path is not set correctly $DEVELOPER does not exist"
echo "run" echo "run"
echo "sudo xcode-select -switch <xcode path>" echo "sudo xcode-select -switch <xcode path>"
echo "for default installation:" echo "for default installation:"
@ -82,14 +84,32 @@ cd "${CURRENTPATH}/src/openssl-${VERSION}"
for ARCH in ${ARCHS} for ARCH in ${ARCHS}
do do
if [[ "${ARCH}" == "i386" || "${ARCH}" == "x86_64" ]]; if [[ "$ARCH" == tv* ]]; then
then SDKVERSION=$TVOS_SDKVERSION
MIN_SDK_VERSION=$TVOS_MIN_SDK_VERSION
LC_ALL=C sed -i -- 's/define HAVE_FORK 1/define HAVE_FORK 0/' "./apps/speed.c"
LC_ALL=C sed -i -- 's/D\_REENTRANT\:iOS/D\_REENTRANT\:tvOS/' "./Configure"
chmod u+x ./Configure
else
SDKVERSION=$IOS_SDKVERSION
MIN_SDK_VERSION=$IOS_MIN_SDK_VERSION
fi
if [[ "${ARCH}" == "i386" || "${ARCH}" == "x86_64" ]]; then
PLATFORM="iPhoneSimulator" PLATFORM="iPhoneSimulator"
elif [ "${ARCH}" == "tv_x86_64" ]; then
ARCH="x86_64"
PLATFORM="AppleTVSimulator"
elif [ "${ARCH}" == "tv_arm64" ]; then
ARCH="arm64"
sed -ie "s!static volatile sig_atomic_t intr_signal;!static volatile intr_signal;!" "crypto/ui/ui_openssl.c"
PLATFORM="AppleTVOS"
else else
sed -ie "s!static volatile sig_atomic_t intr_signal;!static volatile intr_signal;!" "crypto/ui/ui_openssl.c" sed -ie "s!static volatile sig_atomic_t intr_signal;!static volatile intr_signal;!" "crypto/ui/ui_openssl.c"
PLATFORM="iPhoneOS" PLATFORM="iPhoneOS"
fi fi
export $PLATFORM
export CROSS_TOP="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer" export CROSS_TOP="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer"
export CROSS_SDK="${PLATFORM}${SDKVERSION}.sdk" export CROSS_SDK="${PLATFORM}${SDKVERSION}.sdk"
export BUILD_TOOLS="${DEVELOPER}" export BUILD_TOOLS="${DEVELOPER}"
@ -122,17 +142,19 @@ do
./Configure iphoneos-cross --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" ${LOCAL_CONFIG_OPTIONS} > "${LOG}" 2>&1 ./Configure iphoneos-cross --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" ${LOCAL_CONFIG_OPTIONS} > "${LOG}" 2>&1
fi fi
if [ $? != 0 ]; if [ $? != 0 ]; then
then
echo "Problem while configure - Please check ${LOG}" echo "Problem while configure - Please check ${LOG}"
exit 1 exit 1
fi fi
# add -isysroot to CC= # add -isysroot to CC=
if [[ "${PLATFORM}" == "AppleTVSimulator" || "${PLATFORM}" == "AppleTVOS" ]]; then
sed -ie "s!^CFLAG=!CFLAG=-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} -mtvos-version-min=${TVOS_MIN_SDK_VERSION} !" "Makefile"
else
sed -ie "s!^CFLAG=!CFLAG=-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} -miphoneos-version-min=${MIN_SDK_VERSION} !" "Makefile" sed -ie "s!^CFLAG=!CFLAG=-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} -miphoneos-version-min=${MIN_SDK_VERSION} !" "Makefile"
fi
if [ "$1" == "verbose" ]; if [ "$1" == "verbose" ]; then
then
if [[ ! -z $CONFIG_OPTIONS ]]; then if [[ ! -z $CONFIG_OPTIONS ]]; then
make depend make depend
fi fi
@ -144,8 +166,7 @@ do
make >> "${LOG}" 2>&1 make >> "${LOG}" 2>&1
fi fi
if [ $? != 0 ]; if [ $? != 0 ]; then
then
echo "Problem while make - Please check ${LOG}" echo "Problem while make - Please check ${LOG}"
exit 1 exit 1
fi fi
@ -155,10 +176,13 @@ do
make clean >> "${LOG}" 2>&1 make clean >> "${LOG}" 2>&1
done done
echo "Build library..." echo "Build library for iOS..."
lipo -create ${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}-i386.sdk/lib/libssl.a ${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}-x86_64.sdk/lib/libssl.a ${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv7.sdk/lib/libssl.a ${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv7s.sdk/lib/libssl.a ${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-arm64.sdk/lib/libssl.a -output ${CURRENTPATH}/lib/libssl.a lipo -create ${CURRENTPATH}/bin/iPhoneSimulator${IOS_SDKVERSION}-i386.sdk/lib/libssl.a ${CURRENTPATH}/bin/iPhoneSimulator${IOS_SDKVERSION}-x86_64.sdk/lib/libssl.a ${CURRENTPATH}/bin/iPhoneOS${IOS_SDKVERSION}-armv7.sdk/lib/libssl.a ${CURRENTPATH}/bin/iPhoneOS${IOS_SDKVERSION}-armv7s.sdk/lib/libssl.a ${CURRENTPATH}/bin/iPhoneOS${IOS_SDKVERSION}-arm64.sdk/lib/libssl.a -output ${CURRENTPATH}/lib/libssl.a
lipo -create ${CURRENTPATH}/bin/iPhoneSimulator${IOS_SDKVERSION}-i386.sdk/lib/libcrypto.a ${CURRENTPATH}/bin/iPhoneSimulator${IOS_SDKVERSION}-x86_64.sdk/lib/libcrypto.a ${CURRENTPATH}/bin/iPhoneOS${IOS_SDKVERSION}-armv7.sdk/lib/libcrypto.a ${CURRENTPATH}/bin/iPhoneOS${IOS_SDKVERSION}-armv7s.sdk/lib/libcrypto.a ${CURRENTPATH}/bin/iPhoneOS${IOS_SDKVERSION}-arm64.sdk/lib/libcrypto.a -output ${CURRENTPATH}/lib/libcrypto.a
lipo -create ${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}-i386.sdk/lib/libcrypto.a ${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}-x86_64.sdk/lib/libcrypto.a ${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv7.sdk/lib/libcrypto.a ${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv7s.sdk/lib/libcrypto.a ${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-arm64.sdk/lib/libcrypto.a -output ${CURRENTPATH}/lib/libcrypto.a echo "Build library for tvOS..."
lipo -create ${CURRENTPATH}/bin/AppleTVSimulator${TVOS_SDKVERSION}-x86_64.sdk/lib/libssl.a ${CURRENTPATH}/bin/AppleTVOS${TVOS_SDKVERSION}-arm64.sdk/lib/libssl.a -output ${CURRENTPATH}/lib/libssl-tvOS.a
lipo -create ${CURRENTPATH}/bin/AppleTVSimulator${TVOS_SDKVERSION}-x86_64.sdk/lib/libcrypto.a ${CURRENTPATH}/bin/AppleTVOS${TVOS_SDKVERSION}-arm64.sdk/lib/libcrypto.a -output ${CURRENTPATH}/lib/libcrypto-tvOS.a
mkdir -p ${CURRENTPATH}/include mkdir -p ${CURRENTPATH}/include
cp -R ${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}-i386.sdk/include/openssl ${CURRENTPATH}/include/ cp -R ${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}-i386.sdk/include/openssl ${CURRENTPATH}/include/