diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c41002a..07d46b5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -280,6 +280,30 @@ jobs: run: HOMEBREW_NO_AUTO_UPDATE=1 brew install autoconf automake libtool - name: Run build run: ceedling project:tvos verbosity[4] release + catalyst: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.0' + bundler-cache: true + - name: Install Ceedling + run: sudo gem install ceedling -v 0.31.1 --no-user-install + - name: Install automake + run: HOMEBREW_NO_AUTO_UPDATE=1 brew install autoconf automake libtool + - name: Build arm64 + run: CATALYST_TARGET_TRIPLE=arm64-apple-ios13.1-macabi ceedling project:catalyst verbosity[4] release + - name: Save arm64 build + run: cp build/artifacts/release/libhelium.a libhelium_arm64.a + - name: Clean build + run: ceedling project:catalyst clobber + - name: Build x86_64 + run: CATALYST_TARGET_TRIPLE=x86_64-apple-ios13.1-macabi ceedling project:catalyst verbosity[4] release + - name: Save x86_64 build + run: cp build/artifacts/release/libhelium.a libhelium_x86_64.a + - name: Create universal binary + run: lipo -create libhelium_arm64.a libhelium_x86_64.a -output build/artifacts/release/libhelium.a android: runs-on: ubuntu-22.04 strategy: diff --git a/catalyst.yml b/catalyst.yml new file mode 100644 index 0000000..b5795c2 --- /dev/null +++ b/catalyst.yml @@ -0,0 +1,36 @@ +:import: + - 3rd_party_deps.yml + - unix.yml + +:release_build: + :output: libhelium.a + +:dependencies: + :libraries: + - :name: WolfSSL + :source_path: third_party/wolfssl + :artifact_path: third_party/builds/wolfssl_catalyst + :fetch: + :method: :git + :source: $HE_WOLFSSL_SOURCE + :tag: $HE_WOLFSSL_TAG + :build: + - git apply ../../wolfssl/*.patch + - autoreconf -i + - cp ../../ios/autotools-ios-helper.sh ./autotools-ios-helper.sh + - PREFIX=$(pwd)/../builds/wolfssl_catalyst ./autotools-ios-helper.sh -maccatalyst + :artifacts: + :includes: + - include/** + :static_libraries: + - Release-maccatalyst/lib/libwolfssl.a + +:flags: + :release: + :compile: + :*: + - -target + - $CATALYST_TARGET_TRIPLE + +:environment: + - MACOSX_DEPLOYMENT_TARGET: "13.1" \ No newline at end of file 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