From 535756389dff00ffa61d729eb9c702d1d6f81a22 Mon Sep 17 00:00:00 2001 From: Alex Radetsky Date: Wed, 22 May 2024 15:03:45 +0300 Subject: [PATCH 1/7] OpenSSL 1.1.1w --- Makefile | 2 +- build-libssl.sh | 3 ++- carthage/openssl-dynamic-xcframework.json | 1 + carthage/openssl-static-xcframework.json | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 70930013..f2997589 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ endif #===== Versioning ============================================================== ## OpenSSL version to build -VERSION ?= 1.1.1v +VERSION ?= 1.1.1w ## Extra version of the distributed package PACKAGE_VERSION ?= 1 diff --git a/build-libssl.sh b/build-libssl.sh index b152d48a..0a962393 100755 --- a/build-libssl.sh +++ b/build-libssl.sh @@ -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 < Date: Wed, 22 May 2024 16:45:52 +0300 Subject: [PATCH 2/7] assets for VisionOS --- assets/Vision/Info.plist | 24 ++++++++++++++++++++++++ assets/xrOS | 1 + assets/xrSimulator | 1 + 3 files changed, 26 insertions(+) create mode 100755 assets/Vision/Info.plist create mode 120000 assets/xrOS create mode 120000 assets/xrSimulator diff --git a/assets/Vision/Info.plist b/assets/Vision/Info.plist new file mode 100755 index 00000000..c94c3bee --- /dev/null +++ b/assets/Vision/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + openssl + CFBundleIdentifier + com.cossacklabs.OpenSSL + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + openssl + CFBundlePackageType + FMWK + CFBundleShortVersionString + $(OPENSSL_VERSION) + CFBundleVersion + 1 + MinimumOSVersion + $(MIN_SDK_VERSION) + + diff --git a/assets/xrOS b/assets/xrOS new file mode 120000 index 00000000..17a8b9fe --- /dev/null +++ b/assets/xrOS @@ -0,0 +1 @@ +Vision \ No newline at end of file diff --git a/assets/xrSimulator b/assets/xrSimulator new file mode 120000 index 00000000..17a8b9fe --- /dev/null +++ b/assets/xrSimulator @@ -0,0 +1 @@ +Vision \ No newline at end of file From 14390222d337ecb4e0a2e0cbbb8685312f6e5652 Mon Sep 17 00:00:00 2001 From: Alex Radetsky Date: Wed, 22 May 2024 16:44:07 +0300 Subject: [PATCH 3/7] Experimental VisionOS support --- Makefile | 6 +++++- build-libssl.sh | 37 +++++++++++++++++++++++++++++++++++ config/20-all-platforms.conf | 31 +++++++++++++++++++++++++++++ create-openssl-framework.sh | 25 ++++++++++++++++++++--- scripts/build-loop-targets.sh | 7 +++++++ 5 files changed, 102 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index f2997589..aeef5c85 100644 --- a/Makefile +++ b/Makefile @@ -19,11 +19,13 @@ 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. @@ -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 ================================================================ @@ -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 diff --git a/build-libssl.sh b/build-libssl.sh index 0a962393..f4f99e10 100755 --- a/build-libssl.sh +++ b/build-libssl.sh @@ -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:-}" @@ -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" @@ -168,6 +170,8 @@ run_make() # Cleanup and bookkeeping at end of build loop finish_build_loop() { + echo ">>>>>>>>>>>>>>>> End of ${PLATFORM} ${SDKVERSION} ${ARCH} <<<<<<<<<<<<<<<<" + # Return to ${CURRENTPATH} and remove source dir cd "${CURRENTPATH}" rm -r "${SOURCEDIR}" @@ -197,6 +201,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") @@ -230,6 +242,7 @@ MACOS_SDKVERSION="" CATALYST_SDKVERSION="" WATCHOS_SDKVERSION="" TVOS_SDKVERSION="" +XROS_SDKVERSION="" LOG_VERBOSE="" PARALLEL="" TARGETS="" @@ -279,6 +292,10 @@ case $i in TVOS_SDKVERSION="${i#*=}" shift ;; + --xros-sdk=*) + XROS_SDKVERSION="${i#*=}" + shift + ;; --min-ios-sdk=*) IOS_MIN_SDK_VERSION="${i#*=}" shift @@ -295,6 +312,10 @@ case $i in TVOS_MIN_SDK_VERSION="${i#*=}" shift ;; + --min-xros-sdk=*) + XROS_MIN_SDK_VERSION="${i#*=}" + shift + ;; --noparallel) PARALLEL="false" ;; @@ -382,6 +403,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//./ }) @@ -436,6 +460,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 @@ -557,6 +582,9 @@ LIBSSL_WATCHOS=() LIBCRYPTO_WATCHOS=() LIBSSL_TVOS=() LIBCRYPTO_TVOS=() +LIBSSL_XROS=() +LIBCRYPTO_XROS=() + source "${SCRIPTDIR}/scripts/build-loop-targets.sh" @@ -629,6 +657,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" diff --git a/config/20-all-platforms.conf b/config/20-all-platforms.conf index 7302a37e..7fccdc51 100644 --- a/config/20-all-platforms.conf +++ b/config/20-all-platforms.conf @@ -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', + }, + ); diff --git a/create-openssl-framework.sh b/create-openssl-framework.sh index 7150e67d..309649af 100755 --- a/create-openssl-framework.sh +++ b/create-openssl-framework.sh @@ -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 @@ -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" @@ -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 @@ -187,6 +193,18 @@ if [ $FWTYPE == "dynamic" ]; then INSTALL_NAME="@rpath/${FWNAME}.framework/${FWNAME}" fi + echo "ld obj/*.o \ + -dylib \ + -bitcode_bundle \ + -lSystem \ + -arch $ARCH \ + $MIN_SDK \ + -syslibroot $SDK \ + -compatibility_version $COMPAT_VERSION \ + -current_version $CURRENT_VERSION \ + -application_extension \ + -install_name $INSTALL_NAME \ + -o $FWNAME.dylib" ld obj/*.o \ -dylib \ -bitcode_bundle \ @@ -227,11 +245,12 @@ if [ $FWTYPE == "dynamic" ]; then fi done - rm bin/*/$FWNAME.dylib + # rm bin/*/$FWNAME.dylib else NORMALIZE_OPENSSL_VERSION=no for SYS in ${ALL_SYSTEMS[@]}; do + echo bin/${SYS}*/lib/libcrypto.a bin/${SYS}*/lib/libssl.a SYSDIR="$FWROOT/$SYS" FWDIR="$SYSDIR/$FWNAME.framework" LIBS_CRYPTO=(bin/${SYS}*/lib/libcrypto.a) diff --git a/scripts/build-loop-targets.sh b/scripts/build-loop-targets.sh index 4ded3889..eb0d381d 100755 --- a/scripts/build-loop-targets.sh +++ b/scripts/build-loop-targets.sh @@ -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 @@ -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 @@ -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 From 0ac6a7f4baa4ab53e18c4ae1a6761bdfb5e938f3 Mon Sep 17 00:00:00 2001 From: Alex Radetsky Date: Wed, 22 May 2024 21:52:30 +0300 Subject: [PATCH 4/7] Updated Package.swift --- Package.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Package.swift b/Package.swift index ee3bd07f..dbba72f1 100644 --- a/Package.swift +++ b/Package.swift @@ -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"), ] ) From 730ddf4e2f3be2785c928216c0925558f3db8bcf Mon Sep 17 00:00:00 2001 From: Alex Radetsky Date: Wed, 22 May 2024 21:59:50 +0300 Subject: [PATCH 5/7] fix the mistype --- RELEASING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASING.md b/RELEASING.md index e59f0fb9..2c4c389f 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -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", From d1329a6d240cac03d8c2763f80fb68bd5d63e31a Mon Sep 17 00:00:00 2001 From: Alex Radetsky Date: Wed, 22 May 2024 22:19:06 +0300 Subject: [PATCH 6/7] uncomment removal command --- create-openssl-framework.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/create-openssl-framework.sh b/create-openssl-framework.sh index 309649af..e78c832a 100755 --- a/create-openssl-framework.sh +++ b/create-openssl-framework.sh @@ -245,7 +245,7 @@ if [ $FWTYPE == "dynamic" ]; then fi done - # rm bin/*/$FWNAME.dylib + rm bin/*/$FWNAME.dylib else NORMALIZE_OPENSSL_VERSION=no From 13a999a3e46f44cb0a07b3326512f77362ffc1a6 Mon Sep 17 00:00:00 2001 From: Alex Radetsky Date: Thu, 23 May 2024 16:03:28 +0300 Subject: [PATCH 7/7] Remove debug prints --- build-libssl.sh | 2 -- create-openssl-framework.sh | 13 ------------- 2 files changed, 15 deletions(-) diff --git a/build-libssl.sh b/build-libssl.sh index f4f99e10..6720a204 100755 --- a/build-libssl.sh +++ b/build-libssl.sh @@ -170,8 +170,6 @@ run_make() # Cleanup and bookkeeping at end of build loop finish_build_loop() { - echo ">>>>>>>>>>>>>>>> End of ${PLATFORM} ${SDKVERSION} ${ARCH} <<<<<<<<<<<<<<<<" - # Return to ${CURRENTPATH} and remove source dir cd "${CURRENTPATH}" rm -r "${SOURCEDIR}" diff --git a/create-openssl-framework.sh b/create-openssl-framework.sh index e78c832a..897daec1 100755 --- a/create-openssl-framework.sh +++ b/create-openssl-framework.sh @@ -193,18 +193,6 @@ if [ $FWTYPE == "dynamic" ]; then INSTALL_NAME="@rpath/${FWNAME}.framework/${FWNAME}" fi - echo "ld obj/*.o \ - -dylib \ - -bitcode_bundle \ - -lSystem \ - -arch $ARCH \ - $MIN_SDK \ - -syslibroot $SDK \ - -compatibility_version $COMPAT_VERSION \ - -current_version $CURRENT_VERSION \ - -application_extension \ - -install_name $INSTALL_NAME \ - -o $FWNAME.dylib" ld obj/*.o \ -dylib \ -bitcode_bundle \ @@ -250,7 +238,6 @@ else NORMALIZE_OPENSSL_VERSION=no for SYS in ${ALL_SYSTEMS[@]}; do - echo bin/${SYS}*/lib/libcrypto.a bin/${SYS}*/lib/libssl.a SYSDIR="$FWROOT/$SYS" FWDIR="$SYSDIR/$FWNAME.framework" LIBS_CRYPTO=(bin/${SYS}*/lib/libcrypto.a)