Skip to content

build cloak, macos, awg for macos x86_64, arm64 #184

build cloak, macos, awg for macos x86_64, arm64

build cloak, macos, awg for macos x86_64, arm64 #184

name: libssh-ios
on: [push]
env:
# Expected filename: https://zlib.net/zlib-${{env.ZLIB_VERSION}}.tar.gz
ZLIB_VERSION: 1.3.1
# Expected filename: https://www.openssl.org/source/openssl-${{env.OPENSSL_VERSION}}.tar.gz
OPENSSL_VERSION: 3.0.13
# Exoected filename: ${{env.LIBSSH_SOURCE}}libssh-${{env.LIBSSH_VERSION}}.tar.xz
LIBSSH_SOURCE: https://www.libssh.org/files/0.10/
LIBSSH_VERSION: 0.10.6
jobs:
Build-LibSSH-MacOS:
runs-on: macos-12
if: |
contains(github.event.head_commit.message, '[all]') ||
contains(github.event.head_commit.message, '[ios]') ||
contains(github.event.head_commit.message, '[ios-libssh]') ||
contains(github.event.head_commit.message, '[libssh]')
strategy:
matrix:
arch: [arm64]
# no-crypto=yes: builds version with all crypto disabled
# no-crypto=no: builds version with all crypto enabled (where required dependencies are available)
no_crypto:
- no
# - yes
steps:
- name: Get dependencies
run: |
# Get and unpack zlibx
curl -LOJ https://zlib.net/zlib-${{env.ZLIB_VERSION}}.tar.gz
tar -xzf zlib-${{env.ZLIB_VERSION}}.tar.gz
# Get and unpack openssl
curl -LOJ https://www.openssl.org/source/openssl-${{env.OPENSSL_VERSION}}.tar.gz
tar -xzf openssl-${{env.OPENSSL_VERSION}}.tar.gz
# Get and unpack libssh
curl -LOJ ${{env.LIBSSH_SOURCE}}libssh-${{env.LIBSSH_VERSION}}.tar.xz
tar -xf libssh-${{env.LIBSSH_VERSION}}.tar.xz
cd libssh-${{env.LIBSSH_VERSION}}
mkdir build
- name: Build zlib
run: |
cd zlib-${{env.ZLIB_VERSION}}
cmake -G "Xcode" -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_C_COMPILER="$(xcrun -find cc)" -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_C_FLAGS='-fembed-bitcode'
cmake --build ./ --target "zlibstatic" --config ${CONFIGURATION:-Release}
cp ./Release-iphoneos/libz.a ${{github.workspace}}/libssh-${{env.LIBSSH_VERSION}}/build/libz.a
- name: Build openssl
run: |
cd openssl-${{env.OPENSSL_VERSION}}
export PLATFORM="iPhoneOS"
export DEVELOPER=`xcode-select -print-path`
export CROSS_TOP="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer"
export CROSS_SDK="${PLATFORM}${IOS_SDK_VERSION}.sdk"
export ARCH="arm64"
export BUILD_TOOLS="${DEVELOPER}"
export CC="${BUILD_TOOLS}/usr/bin/gcc -arch ${ARCH}"
echo "+ Activate Static Engine"
sed -ie 's/\"engine/\"dynamic-engine/' ./Configurations/15-ios.conf
./Configure iphoneos-cross no-tests no-shared
make
- name: Build libssh
run: |
cd libssh-${{env.LIBSSH_VERSION}}/build
cmake .. -G "Xcode" -DCMAKE_SYSTEM_NAME=iOS -DWITH_GSSAPI=OFF -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_C_COMPILER="$(xcrun -find cc)" -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_C_FLAGS='-fembed-bitcode' -DWITH_SERVER=OFF -DBUILD_SHARED_LIBS=OFF -DOPENSSL_ROOT_DIR=${{github.workspace}}/openssl-${{env.OPENSSL_VERSION}} -DZLIB_ROOT_DIR=${{github.workspace}}/zlib-${{env.ZLIB_VERSION}} -DZLIB_LIBRARY=${{github.workspace}}/zlib-${{env.ZLIB_VERSION}}/Release-iphoneos/libz.a -DOPENSSL_CRYPTO_LIBRARY=${{github.workspace}}/openssl-${{env.OPENSSL_VERSION}}/libcrypto.a:${{github.workspace}}/openssl-${{env.OPENSSL_VERSION}} -DOPENSSL_INCLUDE_DIR=${{github.workspace}}/openssl-${{env.OPENSSL_VERSION}}/include
cmake --build ./ --target "ssh" --config ${CONFIGURATION:-Release}
- name: Upload Artifact
uses: actions/[email protected]
with:
name: libssh-ios-${{ matrix.arch }}
path: ${{ github.workspace }}/libssh-${{env.LIBSSH_VERSION}}/build
if-no-files-found: error
retention-days: 7
github-release:
name: GitHub Release
needs: Build-LibSSH-MacOS
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Setup | Checkout
uses: actions/checkout@v2
- name: Setup | Artifacts
uses: actions/download-artifact@v2
- name: Setup | Checksums
run: for file in $(find ./ -name '*.a' ); do openssl dgst -sha256 -r "$file" | awk '{print $1}' > "${file}.sha256"; done
- name: Zip ALL
run: for file in *; do zip -r ${file%.*}.zip $file; done
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: "*.zip"
tag: ${{ github.ref }}
overwrite: true
file_glob: true