2016-10-22 11:43:33 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Automatic build script for libssl and libcrypto
|
|
|
|
# for iPhoneOS and iPhoneSimulator
|
|
|
|
#
|
|
|
|
# Created by Felix Schulze on 16.12.10.
|
|
|
|
# Copyright 2010-2016 Felix Schulze. All rights reserved.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
#
|
|
|
|
|
|
|
|
for TARGET in ${TARGETS}
|
|
|
|
do
|
|
|
|
# Determine relevant SDK version
|
2020-11-11 19:37:03 +00:00
|
|
|
if [[ "${TARGET}" == macos* ]]; then
|
2017-10-13 17:08:40 +00:00
|
|
|
SDKVERSION="${MACOS_SDKVERSION}"
|
2020-11-07 00:03:46 +00:00
|
|
|
elif [[ "${TARGET}" == mac-catalyst-* ]]; then
|
|
|
|
SDKVERSION="${CATALYST_SDKVERSION}"
|
2019-09-26 07:39:59 +00:00
|
|
|
elif [[ "${TARGET}" == watchos* ]]; then
|
|
|
|
SDKVERSION="${WATCHOS_SDKVERSION}"
|
2020-11-11 19:37:03 +00:00
|
|
|
elif [[ "${TARGET}" == tvos* ]]; then
|
|
|
|
SDKVERSION="${TVOS_SDKVERSION}"
|
2016-10-22 11:43:33 +00:00
|
|
|
else
|
|
|
|
SDKVERSION="${IOS_SDKVERSION}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# These variables are used in the configuration file
|
|
|
|
export SDKVERSION
|
2020-11-11 19:37:03 +00:00
|
|
|
export IOS_MIN_SDK_VERSION
|
2017-10-13 17:08:40 +00:00
|
|
|
export MACOS_MIN_SDK_VERSION
|
2020-11-07 00:03:46 +00:00
|
|
|
export CATALYST_MIN_SDK_VERSION
|
2019-09-26 07:39:59 +00:00
|
|
|
export WATCHOS_MIN_SDK_VERSION
|
2020-11-11 19:37:03 +00:00
|
|
|
export TVOS_MIN_SDK_VERSION
|
2017-03-13 01:20:27 +00:00
|
|
|
export CONFIG_DISABLE_BITCODE
|
2016-10-22 11:43:33 +00:00
|
|
|
|
|
|
|
# Determine platform
|
2020-11-11 19:37:03 +00:00
|
|
|
if [[ "${TARGET}" == "macos"* ]]; then
|
2017-10-13 17:08:40 +00:00
|
|
|
PLATFORM="MacOSX"
|
2020-11-11 21:29:05 +00:00
|
|
|
if [[ "${TARGET}" == "macos64-arm64" ]]; then
|
|
|
|
MACOS_MIN_SDK_VERSION="11.0"
|
|
|
|
fi
|
2020-11-07 00:03:46 +00:00
|
|
|
elif [[ "${TARGET}" == "mac-catalyst-"* ]]; then
|
|
|
|
PLATFORM="MacOSX"
|
2019-09-26 07:39:59 +00:00
|
|
|
elif [[ "${TARGET}" == "watchos-sim-cross"* ]]; then
|
|
|
|
PLATFORM="WatchSimulator"
|
|
|
|
elif [[ "${TARGET}" == "watchos"* ]]; then
|
|
|
|
PLATFORM="WatchOS"
|
2020-11-11 19:37:03 +00:00
|
|
|
elif [[ "${TARGET}" == "tvos-sim-cross-"* ]]; then
|
|
|
|
PLATFORM="AppleTVSimulator"
|
|
|
|
elif [[ "${TARGET}" == "tvos64-cross-"* ]]; then
|
|
|
|
PLATFORM="AppleTVOS"
|
|
|
|
elif [[ "${TARGET}" == "ios-sim-cross-"* ]]; then
|
|
|
|
PLATFORM="iPhoneSimulator"
|
2016-10-22 11:43:33 +00:00
|
|
|
else
|
|
|
|
PLATFORM="iPhoneOS"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Extract ARCH from TARGET (part after last dash)
|
|
|
|
ARCH=$(echo "${TARGET}" | sed -E 's|^.*\-([^\-]+)$|\1|g')
|
|
|
|
|
|
|
|
# Cross compile references, see Configurations/10-main.conf
|
|
|
|
export CROSS_COMPILE="${DEVELOPER}/Toolchains/XcodeDefault.xctoolchain/usr/bin/"
|
|
|
|
export CROSS_TOP="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer"
|
|
|
|
export CROSS_SDK="${PLATFORM}${SDKVERSION}.sdk"
|
|
|
|
|
|
|
|
# Prepare TARGETDIR and SOURCEDIR
|
2020-11-07 00:03:46 +00:00
|
|
|
PLATFORM="${PLATFORM}"
|
|
|
|
if [[ "${TARGET}" == "mac-catalyst-"* ]]; then
|
|
|
|
PLATFORM="Catalyst"
|
|
|
|
fi
|
2016-10-22 11:43:33 +00:00
|
|
|
prepare_target_source_dirs
|
|
|
|
|
|
|
|
## Determine config options
|
2017-03-05 22:31:01 +00:00
|
|
|
# Add build target, --prefix and prevent async (references to getcontext(),
|
|
|
|
# setcontext() and makecontext() result in App Store rejections) and creation
|
|
|
|
# of shared libraries (default since 1.1.0)
|
|
|
|
LOCAL_CONFIG_OPTIONS="${TARGET} --prefix=${TARGETDIR} ${CONFIG_OPTIONS} no-async no-shared"
|
2016-10-22 11:43:33 +00:00
|
|
|
|
|
|
|
# Only relevant for 64 bit builds
|
|
|
|
if [[ "${CONFIG_ENABLE_EC_NISTP_64_GCC_128}" == "true" && "${ARCH}" == *64 ]]; then
|
|
|
|
LOCAL_CONFIG_OPTIONS="${LOCAL_CONFIG_OPTIONS} enable-ec_nistp_64_gcc_128"
|
|
|
|
fi
|
|
|
|
|
2020-11-07 00:03:46 +00:00
|
|
|
# openssl-1.1.1 tries to use an unguarded fork(), affecting AppleTVOS and WatchOS.
|
|
|
|
# Luckily this is only present in the testing suite and can be built without it.
|
|
|
|
if [[ $PLATFORM == "AppleTV"* || $PLATFORM == "Watch"* ]]; then
|
|
|
|
LOCAL_CONFIG_OPTIONS="${LOCAL_CONFIG_OPTIONS} no-tests"
|
|
|
|
fi
|
|
|
|
|
2016-10-22 11:43:33 +00:00
|
|
|
# Run Configure
|
|
|
|
run_configure
|
|
|
|
|
|
|
|
# Run make
|
|
|
|
run_make
|
|
|
|
|
|
|
|
# Run make install
|
|
|
|
set -e
|
|
|
|
if [ "${LOG_VERBOSE}" == "verbose" ]; then
|
|
|
|
make install_dev | tee -a "${LOG}"
|
|
|
|
else
|
|
|
|
make install_dev >> "${LOG}" 2>&1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Remove source dir, add references to library files to relevant arrays
|
|
|
|
# Keep reference to first build target for include file
|
|
|
|
finish_build_loop
|
|
|
|
done
|