Skip to content

Commit

Permalink
ci: add x86_64-linux-musl release
Browse files Browse the repository at this point in the history
  • Loading branch information
TerrorJack committed Sep 21, 2023
1 parent 11dba9b commit 6ed6a22
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 1 deletion.
47 changes: 47 additions & 0 deletions .github/workflows/release-musl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: release-musl

on:
push:
tags:
- "*"

jobs:
release-musl:
name: release-x86_64-linux-musl
runs-on: ubuntu-latest
steps:

- name: build-image
run: |
pushd "$(mktemp -d)"
curl -f -L --retry 5 https://github.com/tweag/rust-alpine-mimalloc/archive/refs/heads/master.tar.gz | tar xz --strip-components=1
podman build \
--network host \
--pull \
--squash \
--tag rust:alpine-mimalloc \
.
popd
- name: checkout
uses: actions/checkout@v4

- run: git submodule update --init --depth 1 --jobs 2

- name: build & test
run: |
podman run \
--init \
--network host \
--rm \
--tmpfs /tmp:exec \
--volume $PWD:/workspace/binaryen \
--workdir /workspace/binaryen \
rust:alpine-mimalloc \
/workspace/binaryen/build-alpine.sh
- name: upload-artifact
uses: actions/upload-artifact@v3
with:
name: binaryen-x86_64-linux-musl
path: binaryen-version_116-x86_64-linux-musl.tar.xz
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,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")
Expand Down
47 changes: 47 additions & 0 deletions build-alpine.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/sh

set -eu

apk upgrade
apk add \
alpine-sdk \
clang \
cmake \
coreutils \
git \
lld \
llvm \
nodejs \
py3-pip \
samurai \
xz

pip3 install -r requirements-dev.txt

cmake \
-Bbuild \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=$PWD/clang++.py \
-DCMAKE_INSTALL_PREFIX=$PWD/binaryen-version_116 \
-DCMAKE_JOB_POOLS="linking=1" \
-DCMAKE_JOB_POOL_LINK=linking \
-DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld -s -static" \
-DBUILD_STATIC_LIB=ON \
-DENABLE_WERROR=OFF \
-DINSTALL_LIBS=OFF

cmake --build build --target install -- -v

CC=clang CXX=clang++ COMPILER_FLAGS="-Wno-unused-command-line-argument -fuse-ld=lld -s -static" ./check.py --binaryen-bin build/bin --binaryen-lib build/lib

XZ_OPT="-T0 -9" \
tar \
--sort=name \
--mtime=1970-01-01T00:00:00Z \
--owner=0 \
--group=0 \
--numeric-owner \
-cJf binaryen-version_116-x86_64-linux-musl.tar.xz binaryen-version_116
13 changes: 13 additions & 0 deletions clang++.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env python3

import os
import sys

if __name__ == "__main__":
args = [arg for arg in sys.argv[1:] if not arg in {"-fcolor-diagnostics"}]
if any(any(arg.endswith(f) for f in {"Precompute.cpp"}) for arg in args):
compiler = "g++"
args = [arg for arg in args if not arg.startswith("-flto")]
else:
compiler = "clang++"
os.execvp(compiler, [compiler] + args)

0 comments on commit 6ed6a22

Please sign in to comment.