Skip to content

Build Linux executables with musl-static #76

Build Linux executables with musl-static

Build Linux executables with musl-static #76

Workflow file for this run

name: Trunk build
on:
push:
branch: develop
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
jobs:
build:
strategy:
fail-fast: false
name: Build Windows/Linux/MacOS/FreeBSD/Android
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.21"
- name: Download and install musl toolchain for Linux
run: |
sudo mkdir -p /opt/x-tools
pushd /tmp
curl -s "https://api.github.com/repos/musl-cross/musl-cross/releases/latest" |
jq -r '.assets[] | .browser_download_url' | while read -r LINK; do
TARBALL="$(basename "$LINK")"
curl -L -o "$TARBALL" "$LINK"
sudo tar -xf "$TARBALL" -C /opt/x-tools
done
popd
- name: Build static executables
run: |
GOOS=windows GOARCH=arm GOARM=7 ./build -o yggstack-windows-armv7.exe
GOOS=windows GOARCH=arm64 ./build -o yggstack-windows-arm64.exe
GOOS=windows GOARCH=386 ./build -o yggstack-windows-i386.exe
GOOS=windows GOARCH=amd64 ./build -o yggstack-windows-amd64.exe
CC="/opt/x-tools/x86_64-multilib-linux-musl/bin/x86_64-multilib-linux-musl-gcc" CFLAGS="-m32" GOOS=linux GOARCH=386 ./build -l "-linkmode 'external' -extldflags '-static'" yggstack-linux-i386
CC="/opt/x-tools/x86_64-multilib-linux-musl/bin/x86_64-multilib-linux-musl-gcc" GOOS=linux GOARCH=amd64 ./build -l "-linkmode 'external' -extldflags '-static'" yggstack-linux-amd64
CC="/opt/x-tools/arm-unknown-linux-musleabi/bin/arm-unknown-linux-musleabi-gcc" GOOS=linux GOARCH=arm GOARM=6 ./build -l "-linkmode 'external' -extldflags '-static'" yggstack-linux-armv6
CC="/opt/x-tools/arm-unknown-linux-musleabi/bin/arm-unknown-linux-musleabi-gcc" GOOS=linux GOARCH=arm GOARM=7 ./build -l "-linkmode 'external' -extldflags '-static'" yggstack-linux-armv7
CC="/opt/x-tools/aarch64-unknown-linux-musl/bin/aarch64-unknown-linux-musl-gcc" GOOS=linux GOARCH=arm64 ./build -l "-linkmode 'external' -extldflags '-static'" yggstack-linux-arm64
CC="/opt/x-tools/mips-unknown-linux-muslsf/bin/mips-unknown-linux-muslsf-gcc" GOOS=linux GOARCH=mips GOMIPS=softfloat ./build -l "-linkmode 'external' -extldflags '-static'" yggstack-linux-mips-sf
CC="/opt/x-tools/mipsel-unknown-linux-muslsf/bin/mipsel-unknown-linux-muslsf-gcc" GOOS=linux GOARCH=mipsle GOMIPS=softfloat ./build -l "-linkmode 'external' -extldflags '-static'" yggstack-linux-mipsle-sf
CC="/opt/x-tools/mips64-unknown-linux-musl/bin/mips64-unknown-linux-musl-gcc" GOOS=linux GOARCH=mips64 ./build -l "-linkmode 'external' -extldflags '-static'" yggstack-linux-mips64
CC="/opt/x-tools/mips64el-unknown-linux-musl/bin/mips64el-unknown-linux-musl-gcc" GOOS=linux GOARCH=mips64le ./build -l "-linkmode 'external' -extldflags '-static'" yggstack-linux-mips64le
CC="/opt/x-tools/powerpc64-unknown-linux-musl/bin/powerpc64-unknown-linux-musl-gcc" GOOS=linux GOARCH=ppc64 ./build -l "-linkmode 'external' -extldflags '-static'" yggstack-linux-ppc64
GOOS=linux GOARCH=ppc64le ./build -o yggstack-linux-ppc64le
CC="/opt/x-tools/riscv64-unknown-linux-musl/bin/riscv64-unknown-linux-musl-gcc" GOOS=linux GOARCH=riscv64 ./build -l "-linkmode 'external' -extldflags '-static'" yggstack-linux-riscv64
CC="/opt/x-tools/s390x-ibm-linux-musl/bin/s390x-ibm-linux-musl-gcc" GOOS=linux GOARCH=s390x ./build -l "-linkmode 'external' -extldflags '-static'" yggstack-linux-s390x
GOOS=darwin GOARCH=arm64 ./build -o yggstack-darwin-arm64
GOOS=darwin GOARCH=amd64 ./build -o yggstack-darwin-amd64
GOOS=freebsd GOARCH=arm64 ./build -o yggstack-freebsd-arm64
GOOS=freebsd GOARCH=amd64 ./build -o yggstack-freebsd-amd64
GOOS=freebsd GOARCH=arm GOARM=6 ./build -o yggstack-freebsd-armv6
GOOS=freebsd GOARCH=arm GOARM=7 ./build -o yggstack-freebsd-armv7
GOOS=freebsd GOARCH=386 ./build -o yggstack-freebsd-i386
GOOS=openbsd GOARCH=arm64 ./build -o yggstack-openbsd-arm64
GOOS=openbsd GOARCH=amd64 ./build -o yggstack-openbsd-amd64
GOOS=openbsd GOARCH=arm GOARM=6 ./build -o yggstack-openbsd-armv6
GOOS=openbsd GOARCH=arm GOARM=7 ./build -o yggstack-openbsd-armv7
GOOS=openbsd GOARCH=386 ./build -o yggstack-openbsd-i386
GOOS=netbsd GOARCH=arm64 ./build -o yggstack-netbsd-arm64
GOOS=netbsd GOARCH=amd64 ./build -o yggstack-netbsd-amd64
GOOS=netbsd GOARCH=arm GOARM=6 ./build -o yggstack-netbsd-armv6
GOOS=netbsd GOARCH=arm GOARM=7 ./build -o yggstack-netbsd-armv7
GOOS=netbsd GOARCH=386 ./build -o yggstack-netbsd-i386
CC="$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang" GOOS=android GOARCH=arm64 ./build -o yggstack-android-arm64
CC="$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android21-clang" GOOS=android GOARCH=amd64 ./build -o yggstack-android-amd64
CC="$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang" GOOS=android GOARCH=arm GOARM=7 ./build -o yggstack-android-armv7
CC="$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android21-clang" GOOS=android GOARCH=386 ./build -o yggstack-android-i386
#GOOS=ios GOARCH=arm64 CC=$(go env GOROOT)/misc/ios/clangwrap.sh ./build -o yggstack-ios-arm64
#GOOS=ios GOARCH=amd64 CC=$(go env GOROOT)/misc/ios/clangwrap.sh ./build -o yggstack-ios-amd64
- name: Publish release
run: |
gh release create trunk --prerelease yggstack-* || gh release upload trunk yggstack-* --clobber
env:
GH_TOKEN: ${{ github.token }}