Merge branch 'watchos-targets'
This commit is contained in:
commit
039d71c2b3
|
@ -9,7 +9,7 @@
|
|||
|
||||
This is a fork of the popular work by [Felix Schulze](https://github.com/x2on), that is a set of scripts for using self-compiled builds of the OpenSSL library on the iPhone and the Apple TV.
|
||||
|
||||
However, this repository focuses more on framework-based setups and also adds macOS support.
|
||||
However, this repository focuses more on framework-based setups and also adds macOS and watchOS support.
|
||||
|
||||
# Compile library
|
||||
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>openssl</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.openssl.OpenSSL</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>openssl</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>4.0</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -30,13 +30,14 @@ DEFAULTVERSION="1.1.0i"
|
|||
# Default (=full) set of architectures (OpenSSL <= 1.0.2) or targets (OpenSSL >= 1.1.0) to build
|
||||
#DEFAULTARCHS="ios_x86_64 ios_arm64 ios_armv7s ios_armv7 tv_x86_64 tv_arm64 mac_x86_64"
|
||||
#DEFAULTTARGETS="ios-sim-cross-x86_64 ios64-cross-arm64 ios-cross-armv7s ios-cross-armv7 tvos-sim-cross-x86_64 tvos64-cross-arm64 macos64-x86_64"
|
||||
DEFAULTARCHS="ios_x86_64 ios_arm64 tv_x86_64 tv_arm64 mac_x86_64"
|
||||
DEFAULTTARGETS="ios-sim-cross-x86_64 ios64-cross-arm64 tvos-sim-cross-x86_64 tvos64-cross-arm64 macos64-x86_64"
|
||||
DEFAULTARCHS="ios_x86_64 ios_arm64 tv_x86_64 tv_arm64 mac_x86_64 watchos_armv7k watchos_arm64_32 watchos_i386"
|
||||
DEFAULTTARGETS="ios-sim-cross-x86_64 ios64-cross-arm64 tvos-sim-cross-x86_64 tvos64-cross-arm64 macos64-x86_64 watchos-cross-armv7k watchos-cross-arm64_32 watchos-sim-cross-i386"
|
||||
|
||||
# Minimum iOS/tvOS SDK version to build for
|
||||
MACOS_MIN_SDK_VERSION="10.11"
|
||||
IOS_MIN_SDK_VERSION="11.0"
|
||||
TVOS_MIN_SDK_VERSION="11.0"
|
||||
WATCHOS_MIN_SDK_VERSION="4.0"
|
||||
|
||||
# Init optional env variables (use available variable or default to empty string)
|
||||
CURL_OPTIONS="${CURL_OPTIONS:-}"
|
||||
|
@ -54,7 +55,7 @@ echo_help()
|
|||
echo " --ios-sdk=SDKVERSION Override iOS SDK version"
|
||||
echo " --noparallel Disable running make with parallel jobs (make -j)"
|
||||
echo " --tvos-sdk=SDKVERSION Override tvOS SDK version"
|
||||
#echo " --disable-bitcode Disable embedding Bitcode"
|
||||
echo " --disable-bitcode Disable embedding Bitcode"
|
||||
echo " -v, --verbose Enable verbose logging"
|
||||
echo " --verbose-on-error Dump last 500 lines from log file if an error occurs (for Travis builds)"
|
||||
echo " --version=VERSION OpenSSL version to build (defaults to ${DEFAULTVERSION})"
|
||||
|
@ -172,6 +173,10 @@ finish_build_loop()
|
|||
LIBSSL_TVOS+=("${TARGETDIR}/lib/libssl.a")
|
||||
LIBCRYPTO_TVOS+=("${TARGETDIR}/lib/libcrypto.a")
|
||||
OPENSSLCONF_SUFFIX="tvos_${ARCH}"
|
||||
elif [[ "${PLATFORM}" == Watch* ]]; then
|
||||
LIBSSL_WATCHOS+=("${TARGETDIR}/lib/libssl.a")
|
||||
LIBCRYPTO_WATCHOS+=("${TARGETDIR}/lib/libcrypto.a")
|
||||
OPENSSLCONF_SUFFIX="watchos_${ARCH}"
|
||||
elif [[ "${PLATFORM}" == iPhone* ]]; then
|
||||
LIBSSL_IOS+=("${TARGETDIR}/lib/libssl.a")
|
||||
LIBCRYPTO_IOS+=("${TARGETDIR}/lib/libcrypto.a")
|
||||
|
@ -202,6 +207,7 @@ CONFIG_DISABLE_BITCODE=""
|
|||
CONFIG_NO_DEPRECATED=""
|
||||
MACOS_SDKVERSION=""
|
||||
IOS_SDKVERSION=""
|
||||
WATCHOS_SDKVERSION=""
|
||||
LOG_VERBOSE=""
|
||||
PARALLEL=""
|
||||
TARGETS=""
|
||||
|
@ -229,9 +235,9 @@ case $i in
|
|||
--ec-nistp-64-gcc-128)
|
||||
CONFIG_ENABLE_EC_NISTP_64_GCC_128="true"
|
||||
;;
|
||||
#--disable-bitcode)
|
||||
# CONFIG_DISABLE_BITCODE="true"
|
||||
# ;;
|
||||
--disable-bitcode)
|
||||
CONFIG_DISABLE_BITCODE="true"
|
||||
;;
|
||||
-h|--help)
|
||||
echo_help
|
||||
exit
|
||||
|
@ -255,6 +261,10 @@ case $i in
|
|||
TVOS_SDKVERSION="${i#*=}"
|
||||
shift
|
||||
;;
|
||||
--watchos-sdk=*)
|
||||
WATCHOS_SDKVERSION="${i#*=}"
|
||||
shift
|
||||
;;
|
||||
-v|--verbose)
|
||||
LOG_VERBOSE="verbose"
|
||||
;;
|
||||
|
@ -349,6 +359,9 @@ fi
|
|||
if [ ! -n "${TVOS_SDKVERSION}" ]; then
|
||||
TVOS_SDKVERSION=$(xcrun -sdk appletvos --show-sdk-version)
|
||||
fi
|
||||
if [ ! -n "${WATCHOS_SDKVERSION}" ]; then
|
||||
WATCHOS_SDKVERSION=$(xcrun -sdk watchos --show-sdk-version)
|
||||
fi
|
||||
|
||||
# Determine number of cores for (parallel) build
|
||||
BUILD_THREADS=1
|
||||
|
@ -399,6 +412,7 @@ fi
|
|||
echo " macOS SDK: ${MACOS_SDKVERSION}"
|
||||
echo " iOS SDK: ${IOS_SDKVERSION}"
|
||||
echo " tvOS SDK: ${TVOS_SDKVERSION}"
|
||||
echo " watchOS SDK: ${WATCHOS_SDKVERSION}"
|
||||
if [ "${CONFIG_DISABLE_BITCODE}" == "true" ]; then
|
||||
echo " Bitcode embedding disabled"
|
||||
fi
|
||||
|
@ -481,6 +495,8 @@ LIBSSL_IOS=()
|
|||
LIBCRYPTO_IOS=()
|
||||
LIBSSL_TVOS=()
|
||||
LIBCRYPTO_TVOS=()
|
||||
LIBSSL_WATCHOS=()
|
||||
LIBCRYPTO_WATCHOS=()
|
||||
|
||||
# Run relevant build loop (archs = 1.0 style, targets = 1.1 style)
|
||||
if [ "${BUILD_TYPE}" == "archs" ]; then
|
||||
|
@ -510,6 +526,13 @@ if [ ${#LIBSSL_TVOS[@]} -gt 0 ]; then
|
|||
lipo -create ${LIBCRYPTO_TVOS[@]} -output "${CURRENTPATH}/lib/libcrypto-AppleTV.a"
|
||||
fi
|
||||
|
||||
# Build tvOS library if selected for build
|
||||
if [ ${#LIBSSL_WATCHOS[@]} -gt 0 ]; then
|
||||
echo "Build library for watchOS..."
|
||||
lipo -create ${LIBSSL_WATCHOS[@]} -output "${CURRENTPATH}/lib/libssl-WatchOS.a"
|
||||
lipo -create ${LIBCRYPTO_WATCHOS[@]} -output "${CURRENTPATH}/lib/libcrypto-WatchOS.a"
|
||||
fi
|
||||
|
||||
# Copy include directory
|
||||
cp -R "${INCLUDE_DIR}" "${CURRENTPATH}/include/"
|
||||
|
||||
|
@ -558,6 +581,15 @@ if [ ${#OPENSSLCONF_ALL[@]} -gt 1 ]; then
|
|||
*_tvos_arm64.h)
|
||||
DEFINE_CONDITION="TARGET_OS_TV && TARGET_OS_EMBEDDED && TARGET_CPU_ARM64"
|
||||
;;
|
||||
*_watchos_armv7k.h)
|
||||
DEFINE_CONDITION="TARGET_OS_WATCHOS && TARGET_OS_EMBEDDED && TARGET_CPU_ARMV7K"
|
||||
;;
|
||||
*_watchos_arm64_32.h)
|
||||
DEFINE_CONDITION="TARGET_OS_WATCHOS && TARGET_OS_EMBEDDED && TARGET_CPU_ARM64_32"
|
||||
;;
|
||||
*_watchos_i386.h)
|
||||
DEFINE_CONDITION="TARGET_OS_SIMULATOR && TARGET_CPU_X86 || TARGET_OS_EMBEDDED"
|
||||
;;
|
||||
*)
|
||||
# Don't run into unexpected cases by setting the default condition to false
|
||||
DEFINE_CONDITION="0"
|
||||
|
@ -583,4 +615,3 @@ if [ ${#OPENSSLCONF_ALL[@]} -gt 1 ]; then
|
|||
fi
|
||||
|
||||
echo "Done."
|
||||
|
||||
|
|
|
@ -36,6 +36,36 @@
|
|||
cflags => add(sub { defined($ENV{'MACOS_MIN_SDK_VERSION'}) ? '-mmacosx-version-min=$(MACOS_MIN_SDK_VERSION)' : '-mmacosx-version-min=10.11'; }),
|
||||
},
|
||||
|
||||
## Apple WatchOS
|
||||
|
||||
## Base settings for iOS
|
||||
"watchos-cross-base" => {
|
||||
inherit_from => [ "all-base" ],
|
||||
template => 1,
|
||||
cflags => add(sub { defined($ENV{'WATCH_MIN_SDK_VERSION'}) ? '-mwatchos-version-min=$(WATCH_MIN_SDK_VERSION)' : '-mwatchos-version-min=4.0'; }),
|
||||
},
|
||||
|
||||
"watchos-cross-armv7k" => {
|
||||
inherit_from => [ "darwin-common", "watchos-cross-base", asm("armv7_asm") ],
|
||||
cflags => add("-arch armv7k -fembed-bitcode"),
|
||||
defines => [ "HAVE_FORK=0" ],
|
||||
sys_id => "WatchOS",
|
||||
},
|
||||
|
||||
"watchos-cross-arm64_32" => {
|
||||
inherit_from => [ "darwin-common", "watchos-cross-base"],
|
||||
cflags => add("-arch arm64_32 -fembed-bitcode"),
|
||||
defines => [ "HAVE_FORK=0" ],
|
||||
sys_id => "WatchOS",
|
||||
},
|
||||
|
||||
"watchos-sim-cross-i386" => {
|
||||
inherit_from => [ "darwin-common", "watchos-cross-base"],
|
||||
cflags => add("-arch i386 -fembed-bitcode"),
|
||||
defines => [ "HAVE_FORK=0" ],
|
||||
sys_id => "WatchOS",
|
||||
},
|
||||
|
||||
## Apple iOS simulator (x86_64)
|
||||
# Based on 10-main.conf: iphoneos-cross / darwin64-x86_64-cc
|
||||
"ios-sim-cross-x86_64" => {
|
||||
|
|
|
@ -21,7 +21,7 @@ if [ -d $FWROOT ]; then
|
|||
rm -rf $FWROOT
|
||||
fi
|
||||
|
||||
ALL_SYSTEMS=("iPhone" "AppleTV" "MacOSX")
|
||||
ALL_SYSTEMS=("iPhone" "AppleTV" "MacOSX" "WatchOS")
|
||||
|
||||
function check_bitcode() {
|
||||
local FWDIR=$1
|
||||
|
@ -70,6 +70,10 @@ if [ $FWTYPE == "dynamic" ]; then
|
|||
MIN_SDK="-macosx_version_min 10.11"
|
||||
elif [[ $PLATFORM == iPhoneSimulator* ]]; then
|
||||
MIN_SDK="-ios_simulator_version_min 11.0"
|
||||
elif [[ $PLATFORM == WatchOS* ]]; then
|
||||
MIN_SDK="-watchos_version_min 4.0"
|
||||
elif [[ $PLATFORM == WatchSimulator* ]]; then
|
||||
MIN_SDK="-watchos_simulator_version_min 4.0"
|
||||
else
|
||||
MIN_SDK="-ios_version_min 11.0"
|
||||
fi
|
||||
|
|
|
@ -26,6 +26,8 @@ do
|
|||
SDKVERSION=${TVOS_SDKVERSION}
|
||||
elif [[ "$ARCH" == mac* ]]; then
|
||||
SDKVERSION=${MACOS_SDKVERSION}
|
||||
elif [[ "$ARCH" == watchos* ]]; then
|
||||
SDKVERSION=${WATCHOS_SDKVERSION}
|
||||
else
|
||||
SDKVERSION=${IOS_SDKVERSION}
|
||||
fi
|
||||
|
@ -39,6 +41,10 @@ do
|
|||
PLATFORM="AppleTVOS"
|
||||
elif [[ "${ARCH}" == "mac_x86_64" || "${ARCH}" == "mac_i386" ]]; then
|
||||
PLATFORM="MacOSX"
|
||||
elif [[ "${ARCH}" == "watchos_arm64_32" || "${ARCH}" == "watchos_armv7k" ]]; then
|
||||
PLATFORM="WatchOS"
|
||||
elif [[ "${ARCH}" == "watchos_i386" ]]; then
|
||||
PLATFORM="WatchSimulator"
|
||||
else
|
||||
PLATFORM="iPhoneOS"
|
||||
fi
|
||||
|
@ -65,18 +71,23 @@ do
|
|||
esac
|
||||
fi
|
||||
|
||||
# Embed bitcode for SDK >= 9
|
||||
if [ "${CONFIG_DISABLE_BITCODE}" != "true" ]; then
|
||||
if [[ "${SDKVERSION}" == 9.* || "${SDKVERSION}" == [0-9][0-9].* ]]; then
|
||||
LOCAL_CONFIG_OPTIONS="${LOCAL_CONFIG_OPTIONS} -fembed-bitcode"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Add platform specific config options
|
||||
if [[ "${PLATFORM}" == AppleTV* ]]; then
|
||||
LOCAL_CONFIG_OPTIONS="${LOCAL_CONFIG_OPTIONS} -DHAVE_FORK=0 -mtvos-version-min=${TVOS_MIN_SDK_VERSION}"
|
||||
echo " Patching Configure..."
|
||||
LC_ALL=C sed -i -- 's/D\_REENTRANT\:iOS/D\_REENTRANT\:tvOS/' "./Configure"
|
||||
elif [[ "${PLATFORM}" == WatchOS* ]]; then
|
||||
LOCAL_CONFIG_OPTIONS="${LOCAL_CONFIG_OPTIONS} -DHAVE_FORK=0 -mwatchos-version-min=${WATCHOS_MIN_SDK_VERSION}"
|
||||
echo " Patching Configure..."
|
||||
LC_ALL=C sed -i -- 's/D\_REENTRANT\:iOS/D\_REENTRANT\:WatchOS/' "./Configure"
|
||||
elif [[ "${PLATFORM}" == WatchSimulator* ]]; then
|
||||
LOCAL_CONFIG_OPTIONS="${LOCAL_CONFIG_OPTIONS} -DHAVE_FORK=0 -mwatchos-version-min=${WATCHOS_MIN_SDK_VERSION}"
|
||||
echo " Patching Configure..."
|
||||
LC_ALL=C sed -i -- 's/D\_REENTRANT\:iOS/D\_REENTRANT\:WatchOS/' "./Configure"
|
||||
elif [[ "${PLATFORM}" == MacOSX* ]]; then
|
||||
LOCAL_CONFIG_OPTIONS="${LOCAL_CONFIG_OPTIONS} -mmacosx-version-min=${MACOS_MIN_SDK_VERSION}"
|
||||
else
|
||||
|
@ -87,8 +98,10 @@ do
|
|||
LOCAL_CONFIG_OPTIONS="--openssldir=${TARGETDIR} ${LOCAL_CONFIG_OPTIONS}"
|
||||
|
||||
# Determine configure target
|
||||
if [ "${ARCH}" == "x86_64" ]; then
|
||||
if [[ "${ARCH}" == "x86_64" ]]; then
|
||||
LOCAL_CONFIG_OPTIONS="darwin64-x86_64-cc no-asm ${LOCAL_CONFIG_OPTIONS}"
|
||||
elif [[ "${ARCH}" == "watchos_i386" ]]; then
|
||||
LOCAL_CONFIG_OPTIONS="darwin-i386-cc no-asm ${LOCAL_CONFIG_OPTIONS}"
|
||||
else
|
||||
LOCAL_CONFIG_OPTIONS="iphoneos-cross ${LOCAL_CONFIG_OPTIONS}"
|
||||
fi
|
||||
|
@ -97,7 +110,7 @@ do
|
|||
run_configure
|
||||
|
||||
# Only required for Darwin64 builds (-isysroot is automatically added by iphoneos-cross target)
|
||||
if [ "${ARCH}" == "x86_64" ]; then
|
||||
if [[ "${ARCH}" == "x86_64" || "${ARCH}" == "watchos_i386" ]]; then
|
||||
echo " Patching Makefile..."
|
||||
sed -ie "s!^CFLAG=!CFLAG=-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} !" "Makefile"
|
||||
fi
|
||||
|
@ -129,4 +142,5 @@ do
|
|||
# Remove source dir, add references to library files to relevant arrays
|
||||
# Keep reference to first build target for include file
|
||||
finish_build_loop
|
||||
|
||||
done
|
||||
|
|
|
@ -26,6 +26,8 @@ do
|
|||
SDKVERSION="${TVOS_SDKVERSION}"
|
||||
elif [[ "${TARGET}" == macos* ]]; then
|
||||
SDKVERSION="${MACOS_SDKVERSION}"
|
||||
elif [[ "${TARGET}" == watchos* ]]; then
|
||||
SDKVERSION="${WATCHOS_SDKVERSION}"
|
||||
else
|
||||
SDKVERSION="${IOS_SDKVERSION}"
|
||||
fi
|
||||
|
@ -35,6 +37,7 @@ do
|
|||
export MACOS_MIN_SDK_VERSION
|
||||
export IOS_MIN_SDK_VERSION
|
||||
export TVOS_MIN_SDK_VERSION
|
||||
export WATCHOS_MIN_SDK_VERSION
|
||||
export CONFIG_DISABLE_BITCODE
|
||||
|
||||
# Determine platform
|
||||
|
@ -46,6 +49,10 @@ do
|
|||
PLATFORM="AppleTVOS"
|
||||
elif [[ "${TARGET}" == "macos"* ]]; then
|
||||
PLATFORM="MacOSX"
|
||||
elif [[ "${TARGET}" == "watchos-sim-cross"* ]]; then
|
||||
PLATFORM="WatchSimulator"
|
||||
elif [[ "${TARGET}" == "watchos"* ]]; then
|
||||
PLATFORM="WatchOS"
|
||||
else
|
||||
PLATFORM="iPhoneOS"
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue