Fix OpenSSL 3 build issues (#52)
* OpenSSL 1.1.1x is EOL, this should make it work for 3.x.x versions. See https://www.openssl.org/blog/blog/2023/03/28/1.1.1-EOL/ * Removed asm inheritance from config * Make 3.x the standard parsing logic * Drop all references to Bitcode * Use newer -platform_version * Default to 3.2.0 --------- Co-authored-by: Davide De Rosa <keeshux@gmail.com>
This commit is contained in:
parent
2d1df58291
commit
12ad7b9efc
|
@ -25,7 +25,7 @@ set -u
|
||||||
# SCRIPT DEFAULTS
|
# SCRIPT DEFAULTS
|
||||||
|
|
||||||
# Default version in case no version is specified
|
# Default version in case no version is specified
|
||||||
DEFAULTVERSION="1.1.1q"
|
DEFAULTVERSION="3.2.0"
|
||||||
|
|
||||||
# Default (=full) set of targets (OpenSSL >= 1.1.1) to build
|
# Default (=full) set of targets (OpenSSL >= 1.1.1) to build
|
||||||
DEFAULTTARGETS=`cat <<TARGETS
|
DEFAULTTARGETS=`cat <<TARGETS
|
||||||
|
|
|
@ -6,13 +6,9 @@ my %targets = ();
|
||||||
## Base settings for cross-compile
|
## Base settings for cross-compile
|
||||||
# Based on 10-main.conf: iphoneos-cross
|
# Based on 10-main.conf: iphoneos-cross
|
||||||
# Add generic compiler flags
|
# Add generic compiler flags
|
||||||
# Add embed-bitcode option if SDK version is 9 or higher
|
|
||||||
"all-base" => {
|
"all-base" => {
|
||||||
template => 1,
|
template => 1,
|
||||||
cflags => combine('-isysroot $(CROSS_TOP)/SDKs/$(CROSS_SDK) -fno-common',
|
cflags => combine('-isysroot $(CROSS_TOP)/SDKs/$(CROSS_SDK) -fno-common')
|
||||||
sub { ((!defined($ENV{'CONFIG_DISABLE_BITCODE'}) || $ENV{'CONFIG_DISABLE_BITCODE'} ne 'true') && defined($ENV{'SDKVERSION'}) && $ENV{'SDKVERSION'} =~ /^(9|[1-9][0-9]+)\./ && $disabled{shared})
|
|
||||||
? '-fembed-bitcode' : (); },
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
|
|
||||||
## Base settings
|
## Base settings
|
||||||
|
@ -47,14 +43,14 @@ my %targets = ();
|
||||||
|
|
||||||
# Device
|
# Device
|
||||||
"ios64-cross-arm64" => {
|
"ios64-cross-arm64" => {
|
||||||
inherit_from => [ "darwin-common", "ios-cross-base", asm("aarch64_asm") ],
|
inherit_from => [ "darwin-common", "ios-cross-base" ],
|
||||||
cflags => add("-arch arm64"),
|
cflags => add("-arch arm64"),
|
||||||
bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
|
bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
|
||||||
perlasm_scheme => "ios64",
|
perlasm_scheme => "ios64",
|
||||||
sys_id => "iOS",
|
sys_id => "iOS",
|
||||||
},
|
},
|
||||||
"ios64-cross-arm64e" => {
|
"ios64-cross-arm64e" => {
|
||||||
inherit_from => [ "darwin-common", "ios-cross-base", asm("aarch64_asm") ],
|
inherit_from => [ "darwin-common", "ios-cross-base" ],
|
||||||
cflags => add("-arch arm64e"),
|
cflags => add("-arch arm64e"),
|
||||||
bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
|
bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
|
||||||
perlasm_scheme => "ios64",
|
perlasm_scheme => "ios64",
|
||||||
|
@ -96,20 +92,20 @@ my %targets = ();
|
||||||
|
|
||||||
# Device
|
# Device
|
||||||
"watchos-cross-armv7k" => {
|
"watchos-cross-armv7k" => {
|
||||||
inherit_from => [ "darwin-common", "watchos-cross-base", asm("armv7_asm") ],
|
inherit_from => [ "darwin-common", "watchos-cross-base" ],
|
||||||
cflags => add("-arch armv7k -fembed-bitcode"),
|
cflags => add("-arch armv7k"),
|
||||||
defines => [ "HAVE_FORK=0" ],
|
defines => [ "HAVE_FORK=0" ],
|
||||||
sys_id => "WatchOS",
|
sys_id => "WatchOS",
|
||||||
},
|
},
|
||||||
"watchos-cross-arm64_32" => {
|
"watchos-cross-arm64_32" => {
|
||||||
inherit_from => [ "darwin-common", "watchos-cross-base"],
|
inherit_from => [ "darwin-common", "watchos-cross-base"],
|
||||||
cflags => add("-arch arm64_32 -fembed-bitcode"),
|
cflags => add("-arch arm64_32"),
|
||||||
defines => [ "HAVE_FORK=0" ],
|
defines => [ "HAVE_FORK=0" ],
|
||||||
sys_id => "WatchOS",
|
sys_id => "WatchOS",
|
||||||
},
|
},
|
||||||
"watchos-cross-arm64" => {
|
"watchos-cross-arm64" => {
|
||||||
inherit_from => [ "darwin-common", "watchos-cross-base", asm("aarch64_asm") ],
|
inherit_from => [ "darwin-common", "watchos-cross-base" ],
|
||||||
cflags => add("-arch arm64 -fembed-bitcode"),
|
cflags => add("-arch arm64"),
|
||||||
bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
|
bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
|
||||||
perlasm_scheme => "ios64",
|
perlasm_scheme => "ios64",
|
||||||
defines => [ "HAVE_FORK=0" ],
|
defines => [ "HAVE_FORK=0" ],
|
||||||
|
@ -118,19 +114,19 @@ my %targets = ();
|
||||||
# Simulator
|
# Simulator
|
||||||
"watchos-sim-cross-x86_64" => {
|
"watchos-sim-cross-x86_64" => {
|
||||||
inherit_from => [ "darwin64-x86_64-cc", "watchos-cross-base"],
|
inherit_from => [ "darwin64-x86_64-cc", "watchos-cross-base"],
|
||||||
cflags => add("-fembed-bitcode"),
|
cflags => add(""),
|
||||||
defines => [ "HAVE_FORK=0" ],
|
defines => [ "HAVE_FORK=0" ],
|
||||||
sys_id => "WatchOS",
|
sys_id => "WatchOS",
|
||||||
},
|
},
|
||||||
"watchos-sim-cross-arm64" => {
|
"watchos-sim-cross-arm64" => {
|
||||||
inherit_from => [ "darwin64-arm64-cc", "watchos-cross-base"],
|
inherit_from => [ "darwin64-arm64-cc", "watchos-cross-base"],
|
||||||
cflags => add("-target arm64-apple-watchos7.2-simulator -mwatchos-version-min=7.2 -fembed-bitcode"),
|
cflags => add("-target arm64-apple-watchos7.2-simulator -mwatchos-version-min=7.2"),
|
||||||
defines => [ "HAVE_FORK=0" ],
|
defines => [ "HAVE_FORK=0" ],
|
||||||
sys_id => "WatchOS",
|
sys_id => "WatchOS",
|
||||||
},
|
},
|
||||||
"watchos-sim-cross-i386" => {
|
"watchos-sim-cross-i386" => {
|
||||||
inherit_from => [ "darwin-common", "watchos-cross-base"],
|
inherit_from => [ "darwin-common", "watchos-cross-base"],
|
||||||
cflags => add("-arch i386 -fembed-bitcode"),
|
cflags => add("-arch i386"),
|
||||||
defines => [ "HAVE_FORK=0" ],
|
defines => [ "HAVE_FORK=0" ],
|
||||||
sys_id => "WatchOS",
|
sys_id => "WatchOS",
|
||||||
},
|
},
|
||||||
|
@ -139,7 +135,7 @@ my %targets = ();
|
||||||
|
|
||||||
# Device
|
# Device
|
||||||
"tvos64-cross-arm64" => {
|
"tvos64-cross-arm64" => {
|
||||||
inherit_from => [ "darwin-common", "tvos-cross-base", asm("aarch64_asm") ],
|
inherit_from => [ "darwin-common", "tvos-cross-base" ],
|
||||||
cflags => add("-arch arm64"),
|
cflags => add("-arch arm64"),
|
||||||
bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
|
bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
|
||||||
perlasm_scheme => "ios64",
|
perlasm_scheme => "ios64",
|
||||||
|
|
|
@ -25,29 +25,6 @@ fi
|
||||||
#ALL_SYSTEMS=("iPhone" "AppleTV" "MacOSX" "Catalyst" "Watch")
|
#ALL_SYSTEMS=("iPhone" "AppleTV" "MacOSX" "Catalyst" "Watch")
|
||||||
ALL_SYSTEMS=("iPhoneOS" "iPhoneSimulator" "AppleTVOS" "AppleTVSimulator" "MacOSX" "Catalyst" "WatchOS" "WatchSimulator")
|
ALL_SYSTEMS=("iPhoneOS" "iPhoneSimulator" "AppleTVOS" "AppleTVSimulator" "MacOSX" "Catalyst" "WatchOS" "WatchSimulator")
|
||||||
|
|
||||||
function check_bitcode() {
|
|
||||||
local BITCODE_PATH=$1
|
|
||||||
local IS_VERBOSE=$2
|
|
||||||
|
|
||||||
if [[ $FWTYPE == "dynamic" ]]; then
|
|
||||||
BITCODE_PATTERN="__LLVM"
|
|
||||||
else
|
|
||||||
BITCODE_PATTERN="__bitcode"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if otool -l "$BITCODE_PATH" | grep "${BITCODE_PATTERN}" >/dev/null; then
|
|
||||||
if $IS_VERBOSE; then
|
|
||||||
echo "INFO: $BITCODE_PATH contains Bitcode"
|
|
||||||
fi
|
|
||||||
BITCODE_ENABLED=1
|
|
||||||
else
|
|
||||||
if $IS_VERBOSE; then
|
|
||||||
echo "INFO: $BITCODE_PATH doesn't contain Bitcode"
|
|
||||||
fi
|
|
||||||
BITCODE_ENABLED=0
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Inspect Mach-O load commands to get minimum SDK version.
|
# Inspect Mach-O load commands to get minimum SDK version.
|
||||||
#
|
#
|
||||||
# Depending on the actual minimum SDK version it may look like this
|
# Depending on the actual minimum SDK version it may look like this
|
||||||
|
@ -139,22 +116,22 @@ if [ $FWTYPE == "dynamic" ]; then
|
||||||
|
|
||||||
MIN_SDK_VERSION=$(get_min_sdk "${TARGETDIR}/lib/libcrypto.a")
|
MIN_SDK_VERSION=$(get_min_sdk "${TARGETDIR}/lib/libcrypto.a")
|
||||||
if [[ $PLATFORM == AppleTVSimulator* ]]; then
|
if [[ $PLATFORM == AppleTVSimulator* ]]; then
|
||||||
MIN_SDK="-tvos_simulator_version_min $MIN_SDK_VERSION"
|
MIN_SDK="-platform_version tvos-simulator $MIN_SDK_VERSION"
|
||||||
elif [[ $PLATFORM == AppleTV* ]]; then
|
elif [[ $PLATFORM == AppleTV* ]]; then
|
||||||
MIN_SDK="-tvos_version_min $MIN_SDK_VERSION"
|
MIN_SDK="-platform_version tvos $MIN_SDK_VERSION"
|
||||||
elif [[ $PLATFORM == MacOSX* ]]; then
|
elif [[ $PLATFORM == MacOSX* ]]; then
|
||||||
MIN_SDK="-macosx_version_min $MIN_SDK_VERSION"
|
MIN_SDK="-platform_version macos $MIN_SDK_VERSION"
|
||||||
elif [[ $PLATFORM == Catalyst* ]]; then
|
elif [[ $PLATFORM == Catalyst* ]]; then
|
||||||
MIN_SDK="-platform_version mac-catalyst $MIN_SDK_VERSION $MIN_SDK_VERSION"
|
MIN_SDK="-platform_version mac-catalyst $MIN_SDK_VERSION $MIN_SDK_VERSION"
|
||||||
PLATFORM="MacOSX"
|
PLATFORM="MacOSX"
|
||||||
elif [[ $PLATFORM == iPhoneSimulator* ]]; then
|
elif [[ $PLATFORM == iPhoneSimulator* ]]; then
|
||||||
MIN_SDK="-ios_simulator_version_min $MIN_SDK_VERSION"
|
MIN_SDK="-platform_version ios-simulator $MIN_SDK_VERSION"
|
||||||
elif [[ $PLATFORM == WatchOS* ]]; then
|
elif [[ $PLATFORM == WatchOS* ]]; then
|
||||||
MIN_SDK="-watchos_version_min $MIN_SDK_VERSION"
|
MIN_SDK="-platform_version watchos $MIN_SDK_VERSION"
|
||||||
elif [[ $PLATFORM == WatchSimulator* ]]; then
|
elif [[ $PLATFORM == WatchSimulator* ]]; then
|
||||||
MIN_SDK="-watchos_simulator_version_min $MIN_SDK_VERSION"
|
MIN_SDK="-platform_version watchos-simulator $MIN_SDK_VERSION"
|
||||||
else
|
else
|
||||||
MIN_SDK="-ios_version_min $MIN_SDK_VERSION"
|
MIN_SDK="-platform_version ios $MIN_SDK_VERSION"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CROSS_TOP="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer"
|
CROSS_TOP="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer"
|
||||||
|
@ -172,15 +149,8 @@ if [ $FWTYPE == "dynamic" ]; then
|
||||||
ar -x ../lib/libssl.a
|
ar -x ../lib/libssl.a
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
BUNDLE_BITCODE=""
|
|
||||||
check_bitcode "lib/libssl.a" false
|
|
||||||
if [[ $BITCODE_ENABLED == 1 ]]; then
|
|
||||||
BUNDLE_BITCODE="-bitcode_bundle"
|
|
||||||
fi
|
|
||||||
|
|
||||||
ld obj/*.o \
|
ld obj/*.o \
|
||||||
-dylib \
|
-dylib \
|
||||||
$BUNDLE_BITCODE \
|
|
||||||
-lSystem \
|
-lSystem \
|
||||||
-arch $ARCH \
|
-arch $ARCH \
|
||||||
$MIN_SDK \
|
$MIN_SDK \
|
||||||
|
@ -212,7 +182,6 @@ if [ $FWTYPE == "dynamic" ]; then
|
||||||
-e "s/\\\$(OPENSSL_VERSION)/$OPENSSL_VERSION/g" \
|
-e "s/\\\$(OPENSSL_VERSION)/$OPENSSL_VERSION/g" \
|
||||||
-i '' "$FWDIR/Info.plist"
|
-i '' "$FWDIR/Info.plist"
|
||||||
echo "Created $FWDIR"
|
echo "Created $FWDIR"
|
||||||
check_bitcode "$FWDIR/$FWNAME" true
|
|
||||||
else
|
else
|
||||||
echo "Skipped framework for $SYS"
|
echo "Skipped framework for $SYS"
|
||||||
fi
|
fi
|
||||||
|
@ -242,7 +211,6 @@ else
|
||||||
-e "s/\\\$(OPENSSL_VERSION)/$OPENSSL_VERSION/g" \
|
-e "s/\\\$(OPENSSL_VERSION)/$OPENSSL_VERSION/g" \
|
||||||
-i '' "$FWDIR/Info.plist"
|
-i '' "$FWDIR/Info.plist"
|
||||||
echo "Created $FWDIR"
|
echo "Created $FWDIR"
|
||||||
check_bitcode "$FWDIR/$FWNAME" true
|
|
||||||
else
|
else
|
||||||
echo "Skipped framework for $SYS"
|
echo "Skipped framework for $SYS"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
function get_openssl_version() {
|
function get_openssl_version() {
|
||||||
local std_version=$1
|
local std_version=$1
|
||||||
|
if [[ ! "$std_version" =~ 3.*.* ]]; then
|
||||||
local script_version=${2:-}
|
local script_version=${2:-}
|
||||||
local generic_version=${std_version%?}
|
local generic_version=${std_version%?}
|
||||||
local subpatch=${std_version: -1}
|
local subpatch=${std_version: -1}
|
||||||
|
@ -9,4 +10,7 @@ function get_openssl_version() {
|
||||||
script_version="$(printf '%02d' $script_version)"
|
script_version="$(printf '%02d' $script_version)"
|
||||||
local normalized_version="${generic_version}${subpatch_number}${script_version}"
|
local normalized_version="${generic_version}${subpatch_number}${script_version}"
|
||||||
echo $normalized_version
|
echo $normalized_version
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
echo $std_version
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue