Drop support for OpenSSL 1.0.x

This commit is contained in:
Davide De Rosa 2020-11-06 22:39:47 +01:00
parent 3b61cfc72e
commit 184673f650
3 changed files with 11 additions and 211 deletions

View File

@ -5,7 +5,6 @@
![macOS support](https://img.shields.io/badge/macOS-10.11+-blue.svg) ![macOS support](https://img.shields.io/badge/macOS-10.11+-blue.svg)
![watchOS support](https://img.shields.io/badge/watchOS-4.0+-blue.svg) ![watchOS support](https://img.shields.io/badge/watchOS-4.0+-blue.svg)
![OpenSSL version](https://img.shields.io/badge/OpenSSL-1.1.1g-green.svg) ![OpenSSL version](https://img.shields.io/badge/OpenSSL-1.1.1g-green.svg)
![OpenSSL version](https://img.shields.io/badge/OpenSSL-1.0.2o-green.svg)
[![license](https://img.shields.io/badge/license-Apache%202.0-lightgrey.svg)](LICENSE) [![license](https://img.shields.io/badge/license-Apache%202.0-lightgrey.svg)](LICENSE)
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. 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.
@ -14,24 +13,12 @@ However, this repository focuses more on framework-based setups and also adds ma
# Compile library # Compile library
Compile OpenSSL 1.0.2k for all archs:
```
./build-libssl.sh --version=1.0.2k
```
Compile OpenSSL 1.1.1g for all targets: Compile OpenSSL 1.1.1g for all targets:
``` ```
./build-libssl.sh --version=1.1.1g ./build-libssl.sh --version=1.1.1g
``` ```
Compile OpenSSL 1.0.2k for specific archs:
```
./build-libssl.sh --version=1.0.2k --archs="ios_armv7 ios_arm64 mac_i386"
```
Compile OpenSSL 1.1.1g for specific targets: Compile OpenSSL 1.1.1g for specific targets:
``` ```

View File

@ -27,10 +27,8 @@ set -u
# Default version in case no version is specified # Default version in case no version is specified
DEFAULTVERSION="1.1.1g" DEFAULTVERSION="1.1.1g"
# Default (=full) set of architectures (OpenSSL <= 1.0.2) or targets (OpenSSL >= 1.1.1) to build # Default (=full) set of targets (OpenSSL >= 1.1.1) 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" #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 watchos_armv7k watchos_arm64_32 watchos_i386 watchos_x86_64"
DEFAULTTARGETS="ios-sim-cross-x86_64 ios64-cross-arm64 ios64-cross-arm64e tvos-sim-cross-x86_64 tvos64-cross-arm64 macos64-x86_64 watchos-cross-armv7k watchos-cross-arm64_32 watchos-sim-cross-i386 watchos-sim-cross-x86_64" DEFAULTTARGETS="ios-sim-cross-x86_64 ios64-cross-arm64 ios64-cross-arm64e tvos-sim-cross-x86_64 tvos64-cross-arm64 macos64-x86_64 watchos-cross-armv7k watchos-cross-arm64_32 watchos-sim-cross-i386 watchos-sim-cross-x86_64"
# Minimum iOS/tvOS SDK version to build for # Minimum iOS/tvOS SDK version to build for
@ -64,12 +62,6 @@ echo_help()
echo " -v, --verbose Enable verbose logging" 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 " --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})" echo " --version=VERSION OpenSSL version to build (defaults to ${DEFAULTVERSION})"
echo
echo "Options for OpenSSL 1.0.2 and lower ONLY"
echo " --archs=\"ARCH ARCH ...\" Space-separated list of architectures to build"
echo " Options: ${DEFAULTARCHS}"
echo
echo "Options for OpenSSL 1.1.1 and higher ONLY"
echo " --deprecated Exclude no-deprecated configure option and build with deprecated methods" echo " --deprecated Exclude no-deprecated configure option and build with deprecated methods"
echo " --targets=\"TARGET TARGET ...\" Space-separated list of build targets" echo " --targets=\"TARGET TARGET ...\" Space-separated list of build targets"
echo " Options: ${DEFAULTTARGETS}" echo " Options: ${DEFAULTTARGETS}"
@ -223,10 +215,6 @@ VERSION=""
for i in "$@" for i in "$@"
do do
case $i in case $i in
--archs=*)
ARCHS="${i#*=}"
shift
;;
--branch=*) --branch=*)
BRANCH="${i#*=}" BRANCH="${i#*=}"
shift shift
@ -338,36 +326,16 @@ elif [ -z "${VERSION}" ]; then
VERSION="${DEFAULTVERSION}" VERSION="${DEFAULTVERSION}"
fi fi
# Build type: BUILD_TYPE="targets"
# In short, type "archs" is used for OpenSSL versions in the 1.0 branch and type "targets" for later versions.
#
# Significant changes to the build process were introduced with OpenSSL 1.1.1. As a result, this script was updated
# to include two separate build loops for versions <= 1.0 and versions >= 1.1. The type "archs" matches the key variable
# used to determine for which platforms to build for the 1.0 branch. Since 1.1, all platforms are defined in a separate/
# custom configuration file as build targets. Therefore the key variable and type are called targets for 1.1 (and later).
# OpenSSL branches <= 1.0 # Set default for TARGETS if not specified
if [[ "${VERSION}" =~ ^(0\.9|1\.0) ]]; then if [ ! -n "${TARGETS}" ]; then
BUILD_TYPE="archs" TARGETS="${DEFAULTTARGETS}"
fi
# Set default for ARCHS if not specified # Add no-deprecated config option (if not overwritten)
if [ ! -n "${ARCHS}" ]; then if [ "${CONFIG_NO_DEPRECATED}" != "false" ]; then
ARCHS="${DEFAULTARCHS}" CONFIG_OPTIONS="${CONFIG_OPTIONS} no-deprecated"
fi
# OpenSSL branches >= 1.1
else
BUILD_TYPE="targets"
# Set default for TARGETS if not specified
if [ ! -n "${TARGETS}" ]; then
TARGETS="${DEFAULTTARGETS}"
fi
# Add no-deprecated config option (if not overwritten)
if [ "${CONFIG_NO_DEPRECATED}" != "false" ]; then
CONFIG_OPTIONS="${CONFIG_OPTIONS} no-deprecated"
fi
fi fi
# Determine SDK versions # Determine SDK versions
@ -429,11 +397,7 @@ esac
echo echo
echo "Build options" echo "Build options"
echo " OpenSSL version: ${VERSION}" echo " OpenSSL version: ${VERSION}"
if [ "${BUILD_TYPE}" == "archs" ]; then echo " Targets: ${TARGETS}"
echo " Architectures: ${ARCHS}"
else
echo " Targets: ${TARGETS}"
fi
echo " macOS SDK: ${MACOS_SDKVERSION} (min ${MACOS_MIN_SDK_VERSION})" echo " macOS SDK: ${MACOS_SDKVERSION} (min ${MACOS_MIN_SDK_VERSION})"
echo " iOS SDK: ${IOS_SDKVERSION} (min ${IOS_MIN_SDK_VERSION})" echo " iOS SDK: ${IOS_SDKVERSION} (min ${IOS_MIN_SDK_VERSION})"
echo " tvOS SDK: ${TVOS_SDKVERSION} (min ${TVOS_MIN_SDK_VERSION})" echo " tvOS SDK: ${TVOS_SDKVERSION} (min ${TVOS_MIN_SDK_VERSION})"
@ -523,12 +487,7 @@ LIBCRYPTO_TVOS=()
LIBSSL_WATCHOS=() LIBSSL_WATCHOS=()
LIBCRYPTO_WATCHOS=() LIBCRYPTO_WATCHOS=()
# Run relevant build loop (archs = 1.0 style, targets = 1.1 style) source "${SCRIPTDIR}/scripts/build-loop-targets.sh"
if [ "${BUILD_TYPE}" == "archs" ]; then
source "${SCRIPTDIR}/scripts/build-loop-archs.sh"
else
source "${SCRIPTDIR}/scripts/build-loop-targets.sh"
fi
#Build macOS library if selected for build #Build macOS library if selected for build
if [ ${#LIBSSL_MACOS[@]} -gt 0 ]; then if [ ${#LIBSSL_MACOS[@]} -gt 0 ]; then

View File

@ -1,146 +0,0 @@
#!/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 ARCH in ${ARCHS}
do
# Determine relevant SDK version
if [[ "$ARCH" == tv* ]]; then
SDKVERSION=${TVOS_SDKVERSION}
elif [[ "$ARCH" == mac* ]]; then
SDKVERSION=${MACOS_SDKVERSION}
elif [[ "$ARCH" == watchos* ]]; then
SDKVERSION=${WATCHOS_SDKVERSION}
else
SDKVERSION=${IOS_SDKVERSION}
fi
# Determine platform, override arch for tvOS builds
if [[ "${ARCH}" == "ios_x86_64" || "${ARCH}" == "ios_i386" ]]; then
PLATFORM="iPhoneSimulator"
elif [ "${ARCH}" == "tv_x86_64" ]; then
PLATFORM="AppleTVSimulator"
elif [ "${ARCH}" == "tv_arm64" ]; then
PLATFORM="AppleTVOS"
elif [[ "${ARCH}" == "mac_x86_64" || "${ARCH}" == "mac_i386" ]]; then
PLATFORM="MacOSX"
elif [[ "${ARCH}" == "watchos_arm64_32" || "${ARCH}" == "watchos_armv7k" || "${ARCH}" == "watchos_arm64" ]]; then
PLATFORM="WatchOS"
elif [[ "${ARCH}" == "watchos_i386" || "${ARCH}" == "watchos_x86_64" ]]; then
PLATFORM="WatchSimulator"
else
PLATFORM="iPhoneOS"
fi
# Extract ARCH from pseudo ARCH (part after first underscore)
ARCH=$(echo "${ARCH}" | sed -E 's|^[^_]*_(.+)$|\1|g')
# Set env vars for Configure
export CROSS_TOP="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer"
export CROSS_SDK="${PLATFORM}${SDKVERSION}.sdk"
export BUILD_TOOLS="${DEVELOPER}"
export CC="${BUILD_TOOLS}/usr/bin/gcc -arch ${ARCH}"
# Prepare TARGETDIR and SOURCEDIR
prepare_target_source_dirs
# Add optional enable-ec_nistp_64_gcc_128 configure option for 64 bit builds
LOCAL_CONFIG_OPTIONS="${CONFIG_OPTIONS}"
if [ "${CONFIG_ENABLE_EC_NISTP_64_GCC_128}" == "true" ]; then
case "${ARCH}" in
*64*)
LOCAL_CONFIG_OPTIONS="${LOCAL_CONFIG_OPTIONS} enable-ec_nistp_64_gcc_128"
;;
esac
fi
if [ "${CONFIG_DISABLE_BITCODE}" != "true" ]; then
LOCAL_CONFIG_OPTIONS="${LOCAL_CONFIG_OPTIONS} -fembed-bitcode"
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
LOCAL_CONFIG_OPTIONS="${LOCAL_CONFIG_OPTIONS} -miphoneos-version-min=${IOS_MIN_SDK_VERSION}"
fi
# Add --openssldir option
LOCAL_CONFIG_OPTIONS="--openssldir=${TARGETDIR} ${LOCAL_CONFIG_OPTIONS}"
# Determine configure target
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
# Run Configure
run_configure
# Only required for Darwin64 builds (-isysroot is automatically added by iphoneos-cross target)
if [[ "${ARCH}" == "x86_64" || "${ARCH}" == "watchos_i386" ]]; then
echo " Patching Makefile..."
sed -ie "s!^CFLAG=!CFLAG=-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} !" "Makefile"
fi
# Run make depend if relevant
if [[ ! -z "${CONFIG_OPTIONS}" ]]; then
echo " Make depend...\c"
if [ "${LOG_VERBOSE}" == "verbose" ]; then
make depend | tee -a "${LOG}"
else
(make depend >> "${LOG}" 2>&1) & spinner
fi
# Check for error status
check_status $? "make depend"
fi
# Run make
run_make
# Run make install
set -e
if [ "${LOG_VERBOSE}" == "verbose" ]; then
make install_sw | tee -a "${LOG}"
else
make install_sw >> "${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