From e213f5af1a5411e6cea2e9e83500cb71b0dbdba2 Mon Sep 17 00:00:00 2001 From: Mykola Baibuz Date: Sun, 30 Jul 2023 13:44:04 -0400 Subject: [PATCH] Static link zlib to libssh (Linux) [libssh] [ios-openssl] --- .github/workflows/build_libssh_android.yml | 4 +++- .github/workflows/build_libssh_ios.yml | 4 +++- .github/workflows/build_libssh_linux.yml | 3 ++- .github/workflows/build_libssh_macos.yml | 3 ++- .github/workflows/build_libssh_windows.yml | 2 +- .github/workflows/build_openssl_macos_ios.yml | 2 +- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build_libssh_android.yml b/.github/workflows/build_libssh_android.yml index ab52fb3..7fe4bce 100644 --- a/.github/workflows/build_libssh_android.yml +++ b/.github/workflows/build_libssh_android.yml @@ -63,6 +63,8 @@ jobs: 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}} @@ -87,7 +89,7 @@ jobs: 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-24 -DCMAKE_ANDROID_API_MIN=24 -DCMAKE_ANDROID_API=24 -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 -DBUILD_SHARED_LIBS=OFF -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:${{github.workspace}}/openssl-${{env.OPENSSL_VERSION}} -DOPENSSL_INCLUDE_DIR=${{github.workspace}}/openssl-${{env.OPENSSL_VERSION}}/include -DCMAKE_EXE_LINKER_FLAGS="-static" + cmake .. -DANDROID_PLATFORM=android-24 -DCMAKE_ANDROID_API_MIN=24 -DCMAKE_ANDROID_API=24 -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 -DBUILD_SHARED_LIBS=OFF -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:${{github.workspace}}/openssl-${{env.OPENSSL_VERSION}} -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/upload-artifact@v2.2.4 diff --git a/.github/workflows/build_libssh_ios.yml b/.github/workflows/build_libssh_ios.yml index c655ded..f69e587 100644 --- a/.github/workflows/build_libssh_ios.yml +++ b/.github/workflows/build_libssh_ios.yml @@ -50,6 +50,8 @@ jobs: 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: | @@ -69,7 +71,7 @@ jobs: - name: Build libssh run: | cd libssh-${{env.LIBSSH_VERSION}}/build - 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' -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}}/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 .. -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 diff --git a/.github/workflows/build_libssh_linux.yml b/.github/workflows/build_libssh_linux.yml index e241865..abed403 100644 --- a/.github/workflows/build_libssh_linux.yml +++ b/.github/workflows/build_libssh_linux.yml @@ -66,6 +66,7 @@ jobs: cd zlib-${{env.ZLIB_VERSION}} cmake . make zlibstatic + cp ./libz.a ${{github.workspace}}/libssh-${{env.LIBSSH_VERSION}}/build/libz.a - name: Build openssl run: | @@ -76,7 +77,7 @@ jobs: - name: Build libssh run: | cd libssh-${{env.LIBSSH_VERSION}}/build - cmake .. -DCMAKE_BUILD_TYPE=Release -DOPENSSL_USE_STATIC_LIBS=TRUE -DBUILD_SHARED_LIBS=OFF -DCMAKE_EXE_LINKER_FLAGS="-static" -DOPENSSL_ROOT_DIR=${{github.workspace}}/openssl-${{env.OPENSSL_VERSION}} -DZLIB_ROOT_DIR=${{github.workspace}}/zlib-${{env.ZLIB_VERSION}} + cmake .. -DCMAKE_BUILD_TYPE=Release -DOPENSSL_USE_STATIC_LIBS=TRUE -DWITH_GSSAPI=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_EXE_LINKER_FLAGS="-static" -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}}/libz.a make ssh - name: Upload Artifact diff --git a/.github/workflows/build_libssh_macos.yml b/.github/workflows/build_libssh_macos.yml index b45a50a..f991850 100644 --- a/.github/workflows/build_libssh_macos.yml +++ b/.github/workflows/build_libssh_macos.yml @@ -50,6 +50,7 @@ jobs: cd zlib-${{env.ZLIB_VERSION}} cmake . make zlibstatic + cp ./libz.a ${{github.workspace}}/libssh-${{env.LIBSSH_VERSION}}/build/libz.a - name: Build openssl run: | @@ -60,7 +61,7 @@ jobs: - name: Build libssh run: | cd libssh-${{env.LIBSSH_VERSION}}/build - cmake .. -DCMAKE_BUILD_TYPE=Release -DOPENSSL_USE_STATIC_LIBS=TRUE -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}}/libz.a -DZLIB_INCLUDE=${{github.workspace}}/zlib-${{env.ZLIB_VERSION}} + cmake .. -DCMAKE_BUILD_TYPE=Release -DOPENSSL_USE_STATIC_LIBS=TRUE -DWITH_GSSAPI=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}}/libz.a -DZLIB_INCLUDE=${{github.workspace}}/zlib-${{env.ZLIB_VERSION}} make ssh - name: Upload Artifact diff --git a/.github/workflows/build_libssh_windows.yml b/.github/workflows/build_libssh_windows.yml index 3399eb0..c51e414 100644 --- a/.github/workflows/build_libssh_windows.yml +++ b/.github/workflows/build_libssh_windows.yml @@ -118,7 +118,7 @@ jobs: shell: powershell run: | cd libssh\${{env.LIBSSH_VERSION}}\build - cmake .. -G "NMake Makefiles" -DWITH_SERVER=OFF -DLIBSSH_LINK_LIBRARIES=crypt32 -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="/MT" -DCMAKE_CXX_FLAGS="/MT" -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DOPENSSL_ROOT_DIR=${{github.workspace}}\openssl\${{env.OPENSSL_VERSION}}\ -DZLIB_ROOT:PATH=${{github.workspace}}\zlib\${{env.ZLIB_VERSION}}\ + cmake .. -G "NMake Makefiles" -DWITH_SERVER=OFF -DWITH_GSSAPI=OFF -DLIBSSH_LINK_LIBRARIES=crypt32 -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="/MT" -DCMAKE_CXX_FLAGS="/MT" -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DOPENSSL_ROOT_DIR=${{github.workspace}}\openssl\${{env.OPENSSL_VERSION}}\ -DZLIB_ROOT:PATH=${{github.workspace}}\zlib\${{env.ZLIB_VERSION}}\ nmake ssh - name: Upload Artifact diff --git a/.github/workflows/build_openssl_macos_ios.yml b/.github/workflows/build_openssl_macos_ios.yml index b88a0ae..8fa570c 100644 --- a/.github/workflows/build_openssl_macos_ios.yml +++ b/.github/workflows/build_openssl_macos_ios.yml @@ -35,7 +35,7 @@ jobs: sed -i '' 's/openssl-3.0.9/openssl-${{matrix.ssllib}}/' openssl-build.sh sed -i '' 's/3.0.9/${{matrix.ssllib}}/' openssl-build-phase1.sh sed -i '' 's/3.0.9/${{matrix.ssllib}}/' openssl-build-phase2.sh - ./openssl-build.sh + ./openssl-build.sh -e - name: Archive artifacts uses: actions/upload-artifact@v3