|
8 | 8 | branches: |
9 | 9 | - main |
10 | 10 | paths: |
| 11 | + - '.github/workflows/release.yml' |
11 | 12 | - '**.js' |
12 | 13 | - '**.css' |
13 | 14 | - '**.html' |
@@ -47,46 +48,29 @@ jobs: |
47 | 48 | export CGO_ENABLED=1 |
48 | 49 | export GOOS=linux |
49 | 50 | export GOARCH=${{ matrix.platform }} |
50 | | - TOOLCHAIN_URL="" |
51 | | - MUSL_CC_HOST="https://github.com/musl-cc/musl.cc/releases/download/v0.0.1" #http://musl.cc |
| 51 | + # Use Bootlin prebuilt cross-toolchains (musl 1.2.5 in stable series) |
52 | 52 | case "${{ matrix.platform }}" in |
53 | | - amd64) |
54 | | - TOOLCHAIN_URL="$MUSL_CC_HOST/x86_64-linux-musl-cross.tgz" |
55 | | - ;; |
56 | | - arm64) |
57 | | - TOOLCHAIN_URL="$MUSL_CC_HOST/aarch64-linux-musl-cross.tgz" |
58 | | - ;; |
59 | | - armv7) |
60 | | - TOOLCHAIN_URL="$MUSL_CC_HOST/armv7l-linux-musleabihf-cross.tgz" |
61 | | - export GOARCH=arm |
62 | | - export GOARM=7 |
63 | | - ;; |
64 | | - armv6) |
65 | | - TOOLCHAIN_URL="$MUSL_CC_HOST/armv6-linux-musleabihf-cross.tgz" |
66 | | - export GOARCH=arm |
67 | | - export GOARM=6 |
68 | | - ;; |
69 | | - armv5) |
70 | | - TOOLCHAIN_URL="$MUSL_CC_HOST/arm-linux-musleabi-cross.tgz" |
71 | | - export GOARCH=arm |
72 | | - export GOARM=5 |
73 | | - ;; |
74 | | - 386) |
75 | | - TOOLCHAIN_URL="$MUSL_CC_HOST/i686-linux-musl-cross.tgz" |
76 | | - ;; |
77 | | - s390x) |
78 | | - TOOLCHAIN_URL="$MUSL_CC_HOST/s390x-linux-musl-cross.tgz" |
79 | | - ;; |
| 53 | + amd64) BOOTLIN_ARCH="x86-64" ;; |
| 54 | + arm64) BOOTLIN_ARCH="aarch64" ;; |
| 55 | + armv7) BOOTLIN_ARCH="armv7-eabihf"; export GOARCH=arm GOARM=7 ;; |
| 56 | + armv6) BOOTLIN_ARCH="armv6-eabihf"; export GOARCH=arm GOARM=6 ;; |
| 57 | + armv5) BOOTLIN_ARCH="armv5-eabi"; export GOARCH=arm GOARM=5 ;; |
| 58 | + 386) BOOTLIN_ARCH="x86-i686" ;; |
| 59 | + s390x) BOOTLIN_ARCH="s390x-z13" ;; |
80 | 60 | esac |
81 | | - echo "Downloading musl toolchain for ${{ matrix.platform }}" |
82 | | - curl -LO "$TOOLCHAIN_URL" |
83 | | - tar -xf *.tgz |
84 | | - TOOLCHAIN_DIR=$(find . -maxdepth 1 -type d -name "*-cross" | head -n1) |
85 | | - TOOLCHAIN_DIR=$(realpath "$TOOLCHAIN_DIR") |
86 | | - export PATH="$TOOLCHAIN_DIR/bin:$PATH" |
87 | | - # Detect compiler |
88 | | - export CC=$(find $TOOLCHAIN_DIR/bin -name '*-gcc' | head -n1) |
89 | | - echo "Using CC=$CC" |
| 61 | + echo "Resolving Bootlin musl toolchain for arch=$BOOTLIN_ARCH (platform=${{ matrix.platform }})" |
| 62 | + TARBALL_BASE="https://toolchains.bootlin.com/downloads/releases/toolchains/$BOOTLIN_ARCH/tarballs/" |
| 63 | + TARBALL_URL=$(curl -fsSL "$TARBALL_BASE" | grep -oE "${BOOTLIN_ARCH}--musl--stable-[^\"]+\\.tar\\.xz" | sort -r | head -n1) |
| 64 | + [ -z "$TARBALL_URL" ] && { echo "Failed to locate Bootlin musl toolchain for arch=$BOOTLIN_ARCH" >&2; exit 1; } |
| 65 | + echo "Downloading: $TARBALL_URL" |
| 66 | + cd /tmp |
| 67 | + curl -fL -sS -o "$(basename "$TARBALL_URL")" "$TARBALL_BASE/$TARBALL_URL" |
| 68 | + tar -xf "$(basename "$TARBALL_URL")" |
| 69 | + TOOLCHAIN_DIR=$(find . -maxdepth 1 -type d -name "${BOOTLIN_ARCH}--musl--stable-*" | head -n1) |
| 70 | + export PATH="$(realpath "$TOOLCHAIN_DIR")/bin:$PATH" |
| 71 | + export CC=$(realpath "$(find "$TOOLCHAIN_DIR/bin" -name '*-gcc.br_real' -type f -executable | head -n1)") |
| 72 | + [ -z "$CC" ] && { echo "No gcc.br_real found in $TOOLCHAIN_DIR/bin" >&2; exit 1; } |
| 73 | + cd - |
90 | 74 | go build -ldflags "-w -s -linkmode external -extldflags '-static'" -o xui-release -v main.go |
91 | 75 | file xui-release |
92 | 76 | ldd xui-release || echo "Static binary confirmed" |
|
0 commit comments