From 0f498b3ff1c96a82126cf4f530f9c432d2ca3a11 Mon Sep 17 00:00:00 2001 From: Cheng Shao Date: Thu, 21 Sep 2023 17:24:38 +0000 Subject: [PATCH] ci: add x86_64-linux-static release --- .github/workflows/release-static.yml | 63 ++++++++++++++++++++++++++++ CMakeLists.txt | 2 +- 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release-static.yml diff --git a/.github/workflows/release-static.yml b/.github/workflows/release-static.yml new file mode 100644 index 00000000000..f0c44b83a92 --- /dev/null +++ b/.github/workflows/release-static.yml @@ -0,0 +1,63 @@ +name: release-static + +on: + push: + tags: + - "*" + workflow_dispatch: + +jobs: + release-static: + name: release-x86_64-linux-static + runs-on: ubuntu-24.04 + steps: + + - name: system-deps + run: | + sudo apt install -y \ + ninja-build + + - name: checkout + uses: actions/checkout@v4 + + - name: checkout-submodules + run: git submodule update --init --depth 1 --jobs 2 + + - name: build + run: | + cmake \ + -Bbuild \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX="/tmp/binaryen-$GITHUB_REF_NAME" \ + -DCMAKE_EXE_LINKER_FLAGS="-s -static" \ + -DBUILD_STATIC_LIB=ON \ + -DENABLE_WERROR=OFF \ + -DINSTALL_LIBS=OFF + + cmake --build build --target install -- -v + + tar \ + --sort=name \ + --owner=0 \ + --group=0 \ + --numeric-owner \ + -czf "binaryen-$GITHUB_REF_NAME-x86_64-linux-static.tar.gz" \ + -C /tmp \ + "binaryen-$GITHUB_REF_NAME" + + - name: upload-artifact + uses: actions/upload-artifact@v4 + with: + name: binaryen-x86_64-linux-static + path: binaryen-*-x86_64-linux-static.tar.gz + + - name: test + run: | + VENV_PATH=$(mktemp -d) + python3 -m venv $VENV_PATH + source $VENV_PATH/bin/activate + + pip3 install -r requirements-dev.txt + + COMPILER_FLAGS="-s -static" ./check.py --binaryen-bin build/bin --binaryen-lib build/lib diff --git a/CMakeLists.txt b/CMakeLists.txt index 95e5be6f949..c063eda2ed4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -309,7 +309,7 @@ else() else() add_link_flag("-Wl,--stack,8388608") endif() - elseif(NOT EMSCRIPTEN) + elseif((NOT EMSCRIPTEN) AND (NOT BUILD_STATIC_LIB)) add_compile_flag("-fPIC") endif() add_debug_compile_flag("-g3")