From 4c27a379a08c1fe41b5919657616d24958e86330 Mon Sep 17 00:00:00 2001 From: aeweda Date: Wed, 20 Nov 2024 12:35:45 +0400 Subject: [PATCH 1/3] ci: add macos openssl compilation script --- docker/cross-compilation/openssl-macos.sh | 46 +++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100755 docker/cross-compilation/openssl-macos.sh diff --git a/docker/cross-compilation/openssl-macos.sh b/docker/cross-compilation/openssl-macos.sh new file mode 100755 index 000000000..a515b6caa --- /dev/null +++ b/docker/cross-compilation/openssl-macos.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +set -ex + +main() { + local version=1.0.2p + local install_dir="/usr/local/openssl" + + # Install dependencies using brew + brew install \ + m4 \ + make + + # Create temporary directory + td=$(mktemp -d) + pushd $td + + # Download and extract OpenSSL + wget https://www.openssl.org/source/openssl-$version.tar.gz + tar --strip-components=1 -xzvf openssl-$version.tar.gz + + # Configure OpenSSL for arm64, disabling assembly + ./Configure \ + --prefix="$install_dir" \ + darwin64-x86_64-cc \ + no-dso \ + no-asm \ + -fPIC \ + ${@:1} + + # Modify the generated Makefile to use arm64 + perl -pi -e 's/-arch x86_64/-arch arm64/g' Makefile + + # Build using all available cores + KERNEL_BITS=64 make -j$(sysctl -n hw.ncpu) + + # Install + sudo make install + + popd + + # Cleanup + rm -rf $td +} + +main "${@}" \ No newline at end of file From 7b7322824ef4b7fac60dbdecf4a4e03ea3da7256 Mon Sep 17 00:00:00 2001 From: aeweda Date: Wed, 20 Nov 2024 12:36:05 +0400 Subject: [PATCH 2/3] ci: add compilation step to master ci --- .github/workflows/master.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 94dc3cd74..99161e774 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -135,8 +135,16 @@ jobs: - name: Install Protobuf run: brew install protobuf - - name: Building Macos Binary - run: MACOSX_DEPLOYMENT_TARGET=10.14 OPENSSL_STATIC=1 OPENSSL_DIR="/usr/local/opt/openssl" cargo build --release -p witnet -p witnet_toolkit + - name: Compile openssl 1.0.2p from source + run: sh ./docker/cross-compilation/openssl-macos.sh + + - name: Build Macos Binary + env: + MACOSX_DEPLOYMENT_TARGET: "10.14" + OPENSSL_STATIC: "1" + OPENSSL_DIR: "/usr/local/openssl" + run: | + cargo build --release -p witnet -p witnet_toolkit - name: Upload Build uses: actions/upload-artifact@v4 From 2e85bd1ee424fa28ab418f0fb9d4f49d1ba5ae31 Mon Sep 17 00:00:00 2001 From: aeweda Date: Wed, 20 Nov 2024 12:38:37 +0400 Subject: [PATCH 3/3] ci: revert back to macos-latest --- .github/workflows/master.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 99161e774..e95ea8a8d 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -127,7 +127,7 @@ jobs: Build_macOs: needs: [macos_helper] - runs-on: macos-12 + runs-on: macos-latest steps: - name: Checkout uses: actions/checkout@v4