build cloak, macos, awg for macos x86_64, arm64 #186
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: libssh-android | |
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-Android: | |
runs-on: ubuntu-latest | |
if: | | |
contains(github.event.head_commit.message, '[all]') || | |
contains(github.event.head_commit.message, '[android]') || | |
contains(github.event.head_commit.message, '[android-libssh]') || | |
contains(github.event.head_commit.message, '[libssh]') | |
strategy: | |
matrix: | |
arch: [x86_64, arm64-v8a, armeabi-v7a, x86] | |
# 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 | |
env: | |
ANDROID_ARCH: ${{ matrix.arch }} | |
steps: | |
- name: Setup Android NDK | |
uses: nttld/setup-ndk@v1 | |
id: setup-ndk | |
with: | |
ndk-version: r21e | |
- 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 ./ -DCMAKE_SYSTEM_NAME=Android -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_SYSTEM_VERSION=24 -DANDROID_ABI=$ANDROID_ARCH -DCMAKE_ANDROID_ARCH_ABI=$ANDROID_ARCH -DANDROID_NDK=$ANDROID_NDK_ROOT -DCMAKE_ANDROID_NDK=$ANDROID_NDK_ROOT -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake | |
PATH=$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH make | |
make zlibstatic | |
cp ./libz.a ${{github.workspace}}/libssh-${{env.LIBSSH_VERSION}}/build/libz.a | |
- name: Build openssl | |
run: | | |
cd openssl-${{env.OPENSSL_VERSION}} | |
case "${{ matrix.arch }}" in | |
arm64-v8a) | |
ANDROID_NDK_ROOT=$ANDROID_NDK_LATEST_HOME PATH=$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH ./Configure android-arm64 no-tests -U__ANDROID_API__ -D__ANDROID_API__=21 && PATH=$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH make | |
;; | |
armeabi-v7a) | |
ANDROID_NDK_ROOT=$ANDROID_NDK_LATEST_HOME PATH=$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH ./Configure android-arm no-tests -U__ANDROID_API__ -D__ANDROID_API__=21 && PATH=$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH make | |
;; | |
x86_64) | |
ANDROID_NDK_ROOT=$ANDROID_NDK_LATEST_HOME PATH=$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH ./Configure android-x86_64 no-tests -U__ANDROID_API__ -D__ANDROID_API__=21 && PATH=$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH make | |
;; | |
x86) | |
ANDROID_NDK_ROOT=$ANDROID_NDK_LATEST_HOME PATH=$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH ./Configure android-x86 no-tests -U__ANDROID_API__ -D__ANDROID_API__=21 && PATH=$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH make | |
;; | |
esac | |
- name: Build libssh | |
run: | | |
cd libssh-${{env.LIBSSH_VERSION}} | |
sed -i 's/add_c_compiler_flag("-Werror=strict-prototypes" SUPPORTED_COMPILER_FLAGS)/#add_c_compiler_flag("-Werror=strict-prototypes" SUPPORTED_COMPILER_FLAGS)/g' ./CompilerChecks.cmake | |
cd src | |
export OPENSSL_ROOT_DIR=${{github.workspace}}/openssl-${{env.OPENSSL_VERSION}} | |
export ZLIB_ROOT_DIR=${{github.workspace}}/zlib-${{env.ZLIB_VERSION}} | |
export OPENSSL_CRYPTO_LIBRARY=${{github.workspace}}/openssl-${{env.OPENSSL_VERSION}}/libcrypto.a:${{github.workspace}}/openssl-${{env.OPENSSL_VERSION}}/libssl.a | |
export OPENSSL_INCLUDE_DIR=${{github.workspace}}/openssl-${{env.OPENSSL_VERSION}}/include | |
wget https://raw.githubusercontent.com/termux/termux-packages/master/packages/libandroid-glob/glob.c --no-check-certificate | |
wget https://raw.githubusercontent.com/termux/termux-packages/master/packages/libandroid-glob/glob.h --no-check-certificate | |
sed -i 's/legacy.c/legacy.c glob.c/g' ./CMakeLists.txt | |
cd ../build | |
cmake .. -DANDROID_PLATFORM=android-21 -DCMAKE_ANDROID_API_MIN=21 -DCMAKE_ANDROID_API=21 -DWITH_GSSAPI=OFF -DCMAKE_CXX_FLAGS="-D__USE_BSD=1 " -DCMAKE_C_FLAGS="-D__USE_BSD=1" -DCMAKE_SYSTEM_NAME=Android -DWITH_SERVER=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_SYSTEM_VERSION=24 -DANDROID_ABI=$ANDROID_ARCH -DCMAKE_ANDROID_ARCH_ABI=$ANDROID_ARCH -DANDROID_NDK=$ANDROID_NDK_ROOT -DCMAKE_ANDROID_NDK=$ANDROID_NDK_ROOT -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DOPENSSL_USE_STATIC_LIBS=TRUE -DZLIB_LIBRARY=${{github.workspace}}/zlib-${{env.ZLIB_VERSION}}/libz.a -DZLIB_INCLUDE=${{github.workspace}}/zlib-${{env.ZLIB_VERSION}} -DOPENSSL_CRYPTO_LIBRARY=${{github.workspace}}/openssl-${{env.OPENSSL_VERSION}}/libcrypto.a -DOPENSSL_SSL_LIBRARY=${{github.workspace}}/openssl-${{env.OPENSSL_VERSION}}/libssl.a -DOPENSSL_INCLUDE_DIR=${{github.workspace}}/openssl-${{env.OPENSSL_VERSION}}/include -DCMAKE_EXE_LINKER_FLAGS="-static" | |
PATH=$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH make ssh | |
- name: Upload Artifact | |
uses: actions/[email protected] | |
with: | |
name: libssh-android-${{ 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-Android | |
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 '*.so' ); 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 | |