diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 94dc3cd74..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 @@ -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 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