Skip to content

Commit

Permalink
Merge pull request #28 from cossacklabs/openssl-1.1.1w
Browse files Browse the repository at this point in the history
* OpenSSL 1.1.1w
* Experimental support for VisionOS
  • Loading branch information
radetsky authored May 23, 2024
2 parents f35370a + 13a999a commit 7e5eecf
Show file tree
Hide file tree
Showing 12 changed files with 120 additions and 8 deletions.
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,21 @@ endif
#===== Versioning ==============================================================

## OpenSSL version to build
VERSION ?= 1.1.1v
VERSION ?= 1.1.1w

## Extra version of the distributed package
PACKAGE_VERSION ?= 1
export PACKAGE_VERSION

MIN_IOS_SDK = 11.0
MIN_OSX_SDK = 10.13
export MIN_IOS_SDK MIN_OSX_SDK
MIN_XROS_SDK = 1.1
export MIN_IOS_SDK MIN_OSX_SDK MIN_XROS_SDK

BUILD_TARGETS += ios-sim-cross-x86_64
BUILD_TARGETS += ios64-cross-arm64
BUILD_TARGETS += macos64-x86_64
BUILD_TARGETS += visionos-sim-cross-x86_64 visionos-sim-cross-arm64 visionos-cross-arm64

# Automatically enable Apple Silicon support if running with Xcode 12.2+
# unless the user has decided explicitly.
Expand All @@ -45,6 +47,7 @@ BUILD_FLAGS += --version=$(VERSION)
BUILD_FLAGS += --targets="$(BUILD_TARGETS)"
BUILD_FLAGS += --min-ios-sdk=$(MIN_IOS_SDK)
BUILD_FLAGS += --min-macos-sdk=$(MIN_OSX_SDK)
BUILD_FLAGS += --min-xros-sdk=$(MIN_XROS_SDK)


#===== Building ================================================================
Expand All @@ -64,6 +67,7 @@ endif
.PHONY: build

$(OUTPUT)/done.build:
@echo $(BUILD_FLAGS)
@./build-libssl.sh $(BUILD_FLAGS)
@mkdir -p $(OUTPUT)
@touch $(OUTPUT)/done.build
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ let package = Package(
targets: [
.binaryTarget(name: "openssl",
// update version in URL path
url:"https://github.com/cossacklabs/openssl-apple/releases/download/1.1.12201/openssl-static-xcframework.zip",
url:"https://github.com/cossacklabs/openssl-apple/releases/download/1.1.12301/openssl-static-xcframework.zip",
// Run from package directory:
// swift package compute-checksum output/openssl-static-xcframework.zip
checksum: "a3363e4297428d2497c481791f6ac3c17c118b6829ee6246781efe0a3593ae16"),
checksum: "348382db8c5cdc2c4c7802b9ec05a247f2cbe831fc8cdc3c2ecd5f663f40fb94"),
]
)
2 changes: 1 addition & 1 deletion RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ How to update to newer OpenSSL version, build, and publish a release.
6. **Update the Carthage package settings and prepare the copy of files**
During the 'make' process, the scripts in the 'scripts' folder had to update the json files in the carthage folder. Check it out.
`cat carthage/openssl-dynamic-framework.json`
`cat carthage/openssl-dynamic-xcframework.json`
```
{
"1.1.12201": "https://github.com/cossacklabs/openssl-apple/releases/download/1.1.12201/openssl-dynamic-xcframework.zip",
Expand Down
24 changes: 24 additions & 0 deletions assets/Vision/Info.plist
Original file line number Diff line number Diff line change
@@ -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>com.cossacklabs.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>$(OPENSSL_VERSION)</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>MinimumOSVersion</key>
<string>$(MIN_SDK_VERSION)</string>
</dict>
</plist>
1 change: 1 addition & 0 deletions assets/xrOS
1 change: 1 addition & 0 deletions assets/xrSimulator
38 changes: 37 additions & 1 deletion build-libssl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ set -u
# SCRIPT DEFAULTS

# Default version in case no version is specified
DEFAULTVERSION="1.1.1v"
DEFAULTVERSION="1.1.1w"

# Default (=full) set of targets (OpenSSL >= 1.1.1) to build
DEFAULTTARGETS=`cat <<TARGETS
Expand All @@ -42,6 +42,7 @@ MACOS_MIN_SDK_VERSION="10.15"
CATALYST_MIN_SDK_VERSION="10.15"
WATCHOS_MIN_SDK_VERSION="4.0"
TVOS_MIN_SDK_VERSION="12.0"
XROS_MIN_SDK_VERSION="1.1"
# Init optional env variables (use available variable or default to empty string)
CURL_OPTIONS="${CURL_OPTIONS:-}"
Expand All @@ -64,6 +65,7 @@ echo_help()
echo " --min-macos-sdk=SDKVERSION Set minimum macOS SDK version (default: $MACOS_MIN_SDK_VERSION)"
echo " --min-watchos-sdk=SDKVERSION Set minimum watchOS SDK version (default: $WATCHOS_MIN_SDK_VERSION)"
echo " --min-tvos-sdk=SDKVERSION Set minimum tvOS SDK version (default: $TVOS_MIN_SDK_VERSION)"
echo " --min-xros-sdk=SDKVERSION Set mininum xrOS SDK version (default: $XROS_MIN_SDK_VERSION)"
echo " --noparallel Disable running make with parallel jobs (make -j)"
echo " --disable-bitcode Disable embedding Bitcode"
echo " -v, --verbose Enable verbose logging"
Expand Down Expand Up @@ -197,6 +199,14 @@ finish_build_loop()
else
OPENSSLCONF_SUFFIX="tvos_${ARCH}"
fi
elif [[ "${PLATFORM}" == xrSimulator* ]]; then
LIBSSL_XROS+=("${TARGETDIR}/lib/libssl.a")
LIBCRYPTO_XROS+=("${TARGETDIR}/lib/libcrypto.a")
OPENSSLCONF_SUFFIX="xros_sim_${ARCH}"
elif [[ "${PLATFORM}" == xrOS* ]]; then
LIBSSL_XROS+=("${TARGETDIR}/lib/libssl.a")
LIBCRYPTO_XROS+=("${TARGETDIR}/lib/libcrypto.a")
OPENSSLCONF_SUFFIX="xros_${ARCH}"
elif [[ "${PLATFORM}" == Catalyst* ]]; then
LIBSSL_CATALYST+=("${TARGETDIR}/lib/libssl.a")
LIBCRYPTO_CATALYST+=("${TARGETDIR}/lib/libcrypto.a")
Expand Down Expand Up @@ -230,6 +240,7 @@ MACOS_SDKVERSION=""
CATALYST_SDKVERSION=""
WATCHOS_SDKVERSION=""
TVOS_SDKVERSION=""
XROS_SDKVERSION=""
LOG_VERBOSE=""
PARALLEL=""
TARGETS=""
Expand Down Expand Up @@ -279,6 +290,10 @@ case $i in
TVOS_SDKVERSION="${i#*=}"
shift
;;
--xros-sdk=*)
XROS_SDKVERSION="${i#*=}"
shift
;;
--min-ios-sdk=*)
IOS_MIN_SDK_VERSION="${i#*=}"
shift
Expand All @@ -295,6 +310,10 @@ case $i in
TVOS_MIN_SDK_VERSION="${i#*=}"
shift
;;
--min-xros-sdk=*)
XROS_MIN_SDK_VERSION="${i#*=}"
shift
;;
--noparallel)
PARALLEL="false"
;;
Expand Down Expand Up @@ -382,6 +401,9 @@ fi
if [ ! -n "${TVOS_SDKVERSION}" ]; then
TVOS_SDKVERSION=$(xcrun -sdk appletvos --show-sdk-version)
fi
if [ ! -n "${XROS_SDKVERSION}" ]; then
XROS_SDKVERSION=$(xcrun -sdk xros --show-sdk-version)
fi
# Truncate to minor version
MINOR_VERSION=(${MACOS_SDKVERSION//./ })
Expand Down Expand Up @@ -436,6 +458,7 @@ echo " macOS SDK: ${MACOS_SDKVERSION} (min ${MACOS_MIN_SDK_VERSION})"
echo " macOS SDK (Catalyst): ${CATALYST_SDKVERSION} (min ${CATALYST_MIN_SDK_VERSION})"
echo " watchOS SDK: ${WATCHOS_SDKVERSION} (min ${WATCHOS_MIN_SDK_VERSION})"
echo " tvOS SDK: ${TVOS_SDKVERSION} (min ${TVOS_MIN_SDK_VERSION})"
echo " visionOS SDK: ${XROS_SDKVERSION} (min ${XROS_MIN_SDK_VERSION})"
if [ "${CONFIG_DISABLE_BITCODE}" == "true" ]; then
echo " Bitcode embedding disabled"
fi
Expand Down Expand Up @@ -490,6 +513,7 @@ OPENSSL_CHECKSUMS="
1.1.1k 892a0875b9872acd04a9fde79b1f943075d5ea162415de3047c327df33fbaee5
1.1.1u e2f8d84b523eecd06c7be7626830370300fbcc15386bf5142d72758f6963ebc6
1.1.1v d6697e2871e77238460402e9362d47d18382b15ef9f246aba6c7bd780d38a6b0
1.1.1w cf3098950cb4d853ad95c0841f1f9c6d3dc102dccfcacd521d93925208b76ac8
"
checksum_checked=false
while read version expectedSHA256; do
Expand Down Expand Up @@ -556,6 +580,9 @@ LIBSSL_WATCHOS=()
LIBCRYPTO_WATCHOS=()
LIBSSL_TVOS=()
LIBCRYPTO_TVOS=()
LIBSSL_XROS=()
LIBCRYPTO_XROS=()
source "${SCRIPTDIR}/scripts/build-loop-targets.sh"
Expand Down Expand Up @@ -628,6 +655,15 @@ if [ ${#OPENSSLCONF_ALL[@]} -gt 1 ]; then
*_tvos_sim_x86_64.h)
DEFINE_CONDITION="TARGET_OS_TV && TARGET_OS_SIMULATOR && TARGET_CPU_X86_64"
;;
*_xros_sim_x86_64.h)
DEFINE_CONDITION="TARGET_OS_VISION && TARGET_OS_SIMULATOR && TARGET_CPU_X86_64"
;;
*_xros_sim_arm64.h)
DEFINE_CONDITION="TARGET_OS_VISION && TARGET_OS_SIMULATOR && TARGET_CPU_ARM64"
;;
*_xros_arm64.h)
DEFINE_CONDITION="TARGET_OS_VISION && TARGET_OS_EMBEDDED && TARGET_CPU_ARM64"
;;
*)
# Don't run into unexpected cases by setting the default condition to false
DEFINE_CONDITION="0"
Expand Down
1 change: 1 addition & 0 deletions carthage/openssl-dynamic-xcframework.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"1.1.12301": "https://github.com/cossacklabs/openssl-apple/releases/download/1.1.12301/openssl-dynamic-xcframework.zip",
"1.1.12201": "https://github.com/cossacklabs/openssl-apple/releases/download/1.1.12201/openssl-dynamic-xcframework.zip",
"1.1.12101": "https://github.com/cossacklabs/openssl-apple/releases/download/1.1.12101/openssl-dynamic-xcframework.zip",
"1.1.11101": "https://github.com/cossacklabs/openssl-apple/releases/download/1.1.11101/openssl-dynamic-xcframework.zip",
Expand Down
1 change: 1 addition & 0 deletions carthage/openssl-static-xcframework.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"1.1.12301": "https://github.com/cossacklabs/openssl-apple/releases/download/1.1.12301/openssl-static-xcframework.zip",
"1.1.12201": "https://github.com/cossacklabs/openssl-apple/releases/download/1.1.12201/openssl-static-xcframework.zip",
"1.1.12101": "https://github.com/cossacklabs/openssl-apple/releases/download/1.1.12101/openssl-static-xcframework.zip",
"1.1.11101": "https://github.com/cossacklabs/openssl-apple/releases/download/1.1.11101/openssl-static-xcframework.zip",
Expand Down
31 changes: 31 additions & 0 deletions config/20-all-platforms.conf
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,35 @@ my %targets = ();
inherit_from => [ "darwin64-x86_64-cc", "tvos-cross-base" ],
sys_id => "tvOS",
},

## Apple visionOS -- visionos -- VISIONOS
"visionos-cross-base" => {
inherit_from => [ "all-base" ],
template => 1,
defines => [ "HAVE_FORK=0" ],
sys_id => "visionOS",
cflags => add("-fembed-bitcode", sub { defined($ENV{'XROS_MIN_SDK_VERSION'}) ? '-target arm64-apple-xros$(VISIONOS_MIN_SDK_VERSION)': '-target arm64-apple-xros1.0 '; }),
},
"visionos-sim-cross-x86_64" => {
inherit_from => [ "darwin64-x86_64", "visionos-cross-base" ],
cflags => add("-arch x86_64", sub { defined($ENV{'XROS_MIN_SDK_VERSION'}) ? '-target x86_64-apple-xros$(VISIONOS_MIN_SDK_VERSION)-simulator' : '-target x86_64-apple-xros1.0-simulator'; }),
sys_id => "visionOS",
asm_arch => 'aarch64',
perlasm_scheme => "macosx",
},
"visionos-sim-cross-arm64" => {
inherit_from => [ "darwin-common", "visionos-cross-base" ],
cflags => add("-arch arm64", sub { defined($ENV{'XROS_MIN_SDK_VERSION'}) ? '-target arm64-apple-xros$(VISIONOS_MIN_SDK_VERSION)-simulator' : '-target arm64-apple-xros1.0-simulator'; }),
sys_id => "visionOS",
asm_arch => 'aarch64',
perlasm_scheme => "macosx",
},
"visionos-cross-arm64" => {
inherit_from => [ "darwin-common", "visionos-cross-base" ],
cflags => add("-arch arm64"),
perlasm_scheme => "ios64",
sys_id => "visionOS",
asm_arch => 'aarch64',
},

);
10 changes: 8 additions & 2 deletions create-openssl-framework.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if [ -d $FWROOT ]; then
fi

#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" "xrOS" "xrSimulator")

function check_bitcode() {
local FWDIR=$1
Expand Down Expand Up @@ -151,7 +151,7 @@ if [ $FWTYPE == "dynamic" ]; then
elif [[ $PLATFORM == AppleTV* ]]; then
MIN_SDK="-tvos_version_min $MIN_SDK_VERSION"
elif [[ $PLATFORM == MacOSX* ]]; then
MIN_SDK="-macosx_version_min $MIN_SDK_VERSION"
MIN_SDK="-macos_version_min $MIN_SDK_VERSION"
elif [[ $PLATFORM == Catalyst* ]]; then
MIN_SDK="-platform_version mac-catalyst 13.0 $MIN_SDK_VERSION"
PLATFORM="MacOSX"
Expand All @@ -161,6 +161,12 @@ if [ $FWTYPE == "dynamic" ]; then
MIN_SDK="-watchos_version_min $MIN_SDK_VERSION"
elif [[ $PLATFORM == WatchSimulator* ]]; then
MIN_SDK="-watchos_simulator_version_min $MIN_SDK_VERSION"
elif [[ $PLATFORM == xrOS* ]]; then
MIN_SDK="-platform_version xros 1.1 $MIN_SDK_VERSION"
PLATFORM="xrOS"
elif [[ $PLATFORM == xrSimulator* ]]; then
MIN_SDK="-platform_version xros-simulator 1.1 $MIN_SDK_VERSION"
PLATFORM="xrsimulator"
else
MIN_SDK="-ios_version_min $MIN_SDK_VERSION"
fi
Expand Down
7 changes: 7 additions & 0 deletions scripts/build-loop-targets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ do
SDKVERSION="${WATCHOS_SDKVERSION}"
elif [[ "${TARGET}" == tvos* ]]; then
SDKVERSION="${TVOS_SDKVERSION}"
elif [[ "${TARGET}" == visionos* ]]; then
SDKVERSION="${XROS_SDKVERSION}"
else
SDKVERSION="${IOS_SDKVERSION}"
fi
Expand All @@ -41,6 +43,7 @@ do
export CATALYST_MIN_SDK_VERSION
export WATCHOS_MIN_SDK_VERSION
export TVOS_MIN_SDK_VERSION
export XROS_MIN_SDK_VERSION
export CONFIG_DISABLE_BITCODE

# Determine platform
Expand All @@ -59,6 +62,10 @@ do
PLATFORM="AppleTVSimulator"
elif [[ "${TARGET}" == "tvos64-cross-"* ]]; then
PLATFORM="AppleTVOS"
elif [[ "${TARGET}" == "visionos-sim-cross-"* ]]; then
PLATFORM="xrSimulator"
elif [[ "${TARGET}" == "visionos-cross-"* ]]; then
PLATFORM="xrOS"
elif [[ "${TARGET}" == "ios-sim-cross-"* ]]; then
PLATFORM="iPhoneSimulator"
else
Expand Down

0 comments on commit 7e5eecf

Please sign in to comment.