Skip to content

Commit

Permalink
Build libssh for Android 8
Browse files Browse the repository at this point in the history
[android-libssh]
  • Loading branch information
outspace committed Sep 11, 2023
1 parent c17f26d commit ad01d06
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/build_libssh_android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [push]

env:
# Expected filename: https://zlib.net/zlib-${{env.ZLIB_VERSION}}.tar.gz
ZLIB_VERSION: 1.2.13
ZLIB_VERSION: 1.3
# Expected filename: https://www.openssl.org/source/openssl-${{env.OPENSSL_VERSION}}.tar.gz
OPENSSL_VERSION: 1.1.1t
# Exoected filename: ${{env.LIBSSH_SOURCE}}libssh-${{env.LIBSSH_VERSION}}.tar.xz
Expand Down Expand Up @@ -84,12 +84,16 @@ jobs:
esac
- name: Build libssh
run: |
cd libssh-${{env.LIBSSH_VERSION}}/build
cd libssh-${{env.LIBSSH_VERSION}}/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
cmake .. -DANDROID_PLATFORM=android-28 -DCMAKE_ANDROID_API_MIN=28 -DCMAKE_ANDROID_API=28 -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"
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]
Expand Down

0 comments on commit ad01d06

Please sign in to comment.