From 954c11139f86e9a01a780dca9cceb959d0b6284e Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Sat, 20 Feb 2021 16:51:49 +0000 Subject: [PATCH] Use cmake on linux to build a single dll containing a statically linked zlib --- .github/workflows/build.yml | 68 ++++++++++++++++++++++++++++--------- 1 file changed, 52 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 181b784d..85e8c767 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,33 +1,69 @@ name: Build -on: push + +on: + release: + types: [published] + jobs: linux: runs-on: ubuntu-latest container: centos:7 steps: - - uses: actions/checkout@v2 - name: Install dependenicies run: | - yum -y install file gcc gcc-c++ make zlib-devel - - name: Build + yum -y install file gcc gcc-c++ make unzip + - name: Install CMake + uses: lukka/get-cmake@latest + + - name: Checkout zlib + uses: actions/checkout@v2 + with: + repository: madler/zlib + path: zlib + + - name: Build zlib + run: | + cd zlib + cmake -GNinja -DCMAKE_POSITION_INDEPENDENT_CODE=ON + cmake --build . --config Release + cd .. + + - name: Checkout leveldb + uses: actions/checkout@v2 + with: + path: leveldb-mcpe + + - name: Build leveldb run: | - make - strip out-shared/libleveldb.so.1.20 - file out-shared/libleveldb.so.1.20 - ldd out-shared/libleveldb.so.1.20 - - name: Upload - uses: actions/upload-artifact@v2 + cmake -DZLIB_INCLUDE_DIR="zlib" -DZLIB_LIBRARY="/__w/leveldb-mcpe/leveldb-mcpe/zlib/libz.a" -GNinja leveldb-mcpe + cmake --build . --config Release + strip libleveldb.so + file libleveldb.so + ldd libleveldb.so + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - path: out-shared/libleveldb.so* - name: libleveldb.so + upload_url: ${{ github.event.release.upload_url }} + asset_path: libleveldb.so + asset_name: libleveldb.so + asset_content_type: so + macos: runs-on: macos-10.15 steps: - uses: actions/checkout@v2 - name: Build run: make - - name: Upload - uses: actions/upload-artifact@v2 + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - path: out-shared/libleveldb.dylib* - name: libleveldb.dylib + upload_url: ${{ github.event.release.upload_url }} + asset_path: out-shared/libleveldb.dylib + asset_name: libleveldb.dylib + asset_content_type: dylib