From 12e9e54cd70a29a88b9b9d3e3c0be908ab9df9fe Mon Sep 17 00:00:00 2001 From: Said Rehouni Date: Thu, 9 Oct 2025 17:15:26 +0200 Subject: [PATCH 1/2] maccatalyst: Add Mac Catalyst build support to WolfSSL build script Add build functions for Mac Catalyst with both x86_64 and arm64 architectures. The implementation includes: - build_maccatalyst_arm64(): Builds for Apple Silicon Macs - build_maccatalyst_x86_64(): Builds for Intel Macs - build_maccatalyst_universal_binary(): Creates universal binary - build_maccatalyst(): Orchestrates the complete build --- ios/autotools-ios-helper.sh | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/ios/autotools-ios-helper.sh b/ios/autotools-ios-helper.sh index 290fb50..4e5eeec 100755 --- a/ios/autotools-ios-helper.sh +++ b/ios/autotools-ios-helper.sh @@ -134,6 +134,43 @@ build_tvos_universal_binary() { "${PREFIX}/${CONFIG}-appletvos/lib/${LIB_NAME}" \ "${PREFIX}/${CONFIG}-appletvsimulator/lib/${LIB_NAME}" } + +build_maccatalyst_arm64() { + export SDK="macosx" + export PLATFORM="maccatalyst-arm64" + export EFFECTIVE_PLATFORM_NAME="-maccatalyst-arm64" + export ARCH_OPTS="--enable-armasm --enable-sp-asm" + export ARCH_FLAGS="-arch arm64" + export HOST_FLAGS="${ARCH_FLAGS} -target arm64-apple-ios13.1-macabi -isysroot $(xcrun --sdk ${SDK} --show-sdk-path) -iframework $(xcrun --sdk ${SDK} --show-sdk-path)/System/iOSSupport/System/Library/Frameworks" + export CHOST="arm64-apple-darwin" + build +} + +build_maccatalyst_x86_64() { + export SDK="macosx" + export PLATFORM="maccatalyst-x86_64" + export EFFECTIVE_PLATFORM_NAME="-maccatalyst-x86_64" + export ARCH_OPTS="" + export ARCH_FLAGS="-arch x86_64" + export HOST_FLAGS="${ARCH_FLAGS} -target x86_64-apple-ios13.1-macabi -isysroot $(xcrun --sdk ${SDK} --show-sdk-path) -iframework $(xcrun --sdk ${SDK} --show-sdk-path)/System/iOSSupport/System/Library/Frameworks" + export CHOST="x86_64-apple-darwin" + build +} + +build_maccatalyst_universal_binary() { + # Create catalyst universal binary + LIB_NAME="libwolfssl.a" + mkdir -p "${PREFIX}/${CONFIG}-maccatalyst/lib" + lipo -create -output "${PREFIX}/${CONFIG}-maccatalyst/lib/${LIB_NAME}" \ + "${PREFIX}/${CONFIG}-maccatalyst-arm64/lib/${LIB_NAME}" \ + "${PREFIX}/${CONFIG}-maccatalyst-x86_64/lib/${LIB_NAME}" +} + +build_maccatalyst() { + build_maccatalyst_arm64 + build_maccatalyst_x86_64 + build_maccatalyst_universal_binary +} # Locations PREFIX=${PREFIX:-"$(pwd)/../builds/wolfssl_ios"} CONFIG=${CONFIG:-"Release"} @@ -169,6 +206,9 @@ case "${TARGET}" in build_tvsimulator build_tvos_universal_binary ;; +-maccatalyst) + build_maccatalyst + ;; -all) build_iphoneos build_iphonesimulator From 330f117b4d3243392b0b1a428886b7720840dd90 Mon Sep 17 00:00:00 2001 From: Said Rehouni Date: Thu, 9 Oct 2025 17:36:42 +0200 Subject: [PATCH 2/2] maccatalyst: Enable Mac Catalyst support in Lightway framework Update Xcode project settings and build scripts to support Mac Catalyst: - Set SUPPORTS_MACCATALYST=YES in project configuration - Add macosx to SUPPORTED_PLATFORMS - Update XCFramework build script to include Catalyst variant The XCFramework now includes iOS device, iOS simulator, and Mac Catalyst variants, enabling the framework to run on both iOS devices and macOS via Catalyst. --- ios.yml | 1 + ios/Lightway/Lightway.xcodeproj/project.pbxproj | 4 ++-- ios/Lightway/build-xcframework.sh | 14 ++++++++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ios.yml b/ios.yml index 9b6591f..0f8c018 100644 --- a/ios.yml +++ b/ios.yml @@ -20,6 +20,7 @@ - autoreconf -i - "cp ../../ios/autotools-ios-helper.sh ./autotools-ios-helper.sh" - "./autotools-ios-helper.sh -iphoneuniversal" + - "./autotools-ios-helper.sh -maccatalyst" :artifacts: :includes: - include/** diff --git a/ios/Lightway/Lightway.xcodeproj/project.pbxproj b/ios/Lightway/Lightway.xcodeproj/project.pbxproj index 2d5fef2..6b171d6 100644 --- a/ios/Lightway/Lightway.xcodeproj/project.pbxproj +++ b/ios/Lightway/Lightway.xcodeproj/project.pbxproj @@ -483,7 +483,7 @@ PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator"; - SUPPORTS_MACCATALYST = NO; + SUPPORTS_MACCATALYST = YES; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2,3"; @@ -520,7 +520,7 @@ PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator"; - SUPPORTS_MACCATALYST = NO; + SUPPORTS_MACCATALYST = YES; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2,3"; diff --git a/ios/Lightway/build-xcframework.sh b/ios/Lightway/build-xcframework.sh index a8d1497..369ccca 100755 --- a/ios/Lightway/build-xcframework.sh +++ b/ios/Lightway/build-xcframework.sh @@ -6,17 +6,27 @@ xcodebuild archive \ -scheme Lightway \ -archivePath "./Build/ios.xcarchive" \ -sdk iphoneos \ - SKIP_INSTALL=NO CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO PLATFORM=universal + SKIP_INSTALL=NO CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO \ + SUPPORTS_MACCATALYST=NO # iOS Sim xcodebuild archive \ -scheme Lightway \ -archivePath "./Build/ios_sim.xcarchive" \ -sdk iphonesimulator \ - SKIP_INSTALL=NO CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO PLATFORM=universal + SKIP_INSTALL=NO CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO \ + SUPPORTS_MACCATALYST=NO + +# Mac Catalyst +xcodebuild archive \ + -scheme Lightway \ + -archivePath "./Build/maccatalyst.xcarchive" \ + -destination 'platform=macOS,variant=Mac Catalyst' \ + SKIP_INSTALL=NO CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO # Package XC Framework xcodebuild -create-xcframework \ -framework "./Build/ios.xcarchive/Products/Library/Frameworks/Lightway.framework" \ -framework "./Build/ios_sim.xcarchive/Products/Library/Frameworks/Lightway.framework" \ + -framework "./Build/maccatalyst.xcarchive/Products/Library/Frameworks/Lightway.framework" \ -output "./Build/Lightway.xcframework"