|
22 | 22 | platform: |
23 | 23 | - amd64 |
24 | 24 | - arm64 |
25 | | - include: |
26 | | - - platform: amd64 |
27 | | - goarch: amd64 |
28 | | - suffix: "" |
29 | | - - platform: arm64 |
30 | | - goarch: arm64 |
31 | | - suffix: "-arm64" |
| 25 | + - 386 |
32 | 26 |
|
33 | 27 | runs-on: ubuntu-latest |
34 | | - |
35 | 28 | steps: |
36 | 29 | - name: Checkout repository |
37 | 30 | uses: actions/checkout@v5.0.0 |
@@ -60,31 +53,38 @@ jobs: |
60 | 53 | mv frontend/dist web/html |
61 | 54 | rm -fr frontend |
62 | 55 |
|
63 | | - - name: Build S-UI for Windows |
| 56 | + - name: Build s-ui |
64 | 57 | run: | |
65 | 58 | export CGO_ENABLED=1 |
66 | | - export GOOS=windows |
67 | | - export GOARCH=${{ matrix.goarch }} |
68 | | - |
69 | | - # Install MinGW-w64 for Windows cross-compilation |
70 | | - sudo apt-get update |
71 | | - sudo apt-get install -y mingw-w64 |
72 | | - |
73 | | - # Set CC based on architecture |
74 | | - case "${{ matrix.goarch }}" in |
75 | | - amd64) export CC=x86_64-w64-mingw32-gcc ;; |
76 | | - arm64) export CC=x86_64-w64-mingw32-gcc ;; # MinGW doesn't support ARM64 well, use x86_64 |
| 59 | + export GOOS=linux |
| 60 | + export GOARCH=${{ matrix.platform }} |
| 61 | + # Use Bootlin prebuilt cross-toolchains (musl 1.2.5 in stable series) |
| 62 | + case "${{ matrix.platform }}" in |
| 63 | + amd64) BOOTLIN_ARCH="x86-64" ;; |
| 64 | + arm64) BOOTLIN_ARCH="aarch64" ;; |
| 65 | + 386) BOOTLIN_ARCH="x86-i686" ;; |
77 | 66 | esac |
78 | | - |
79 | | - echo "Using CC: $CC" |
80 | | - echo "GOOS: $GOOS, GOARCH: $GOARCH" |
| 67 | + echo "Resolving Bootlin musl toolchain for arch=$BOOTLIN_ARCH (platform=${{ matrix.platform }})" |
| 68 | + TARBALL_BASE="https://toolchains.bootlin.com/downloads/releases/toolchains/$BOOTLIN_ARCH/tarballs/" |
| 69 | + TARBALL_URL=$(curl -fsSL "$TARBALL_BASE" | grep -oE "${BOOTLIN_ARCH}--musl--stable-[^\"]+\\.tar\\.xz" | sort -r | head -n1) |
| 70 | + [ -z "$TARBALL_URL" ] && { echo "Failed to locate Bootlin musl toolchain for arch=$BOOTLIN_ARCH" >&2; exit 1; } |
| 71 | + echo "Downloading: $TARBALL_URL" |
| 72 | + cd /tmp |
| 73 | + curl -fL -sS -o "$(basename "$TARBALL_URL")" "$TARBALL_BASE/$TARBALL_URL" |
| 74 | + tar -xf "$(basename "$TARBALL_URL")" |
| 75 | + TOOLCHAIN_DIR=$(find . -maxdepth 1 -type d -name "${BOOTLIN_ARCH}--musl--stable-*" | head -n1) |
| 76 | + export PATH="$(realpath "$TOOLCHAIN_DIR")/bin:$PATH" |
| 77 | + export CC=$(realpath "$(find "$TOOLCHAIN_DIR/bin" -name '*-gcc.br_real' -type f -executable | head -n1)") |
| 78 | + [ -z "$CC" ] && { echo "No gcc.br_real found in $TOOLCHAIN_DIR/bin" >&2; exit 1; } |
| 79 | + cd - |
| 80 | +
|
| 81 | + ### Build s-ui |
| 82 | + go build -ldflags="-w -s -linkmode external -extldflags '-static'" -tags "with_quic,with_grpc,with_utls,with_acme,with_gvisor" -o sui main.go |
| 83 | + file sui |
| 84 | + ldd sui || echo "Static binary confirmed" |
81 | 85 |
|
82 | | - ### Build s-ui for Windows |
83 | | - go build -ldflags="-w -s" -tags "with_quic,with_grpc,with_utls,with_acme,with_gvisor" -o "sui${{ matrix.suffix }}.exe" main.go |
84 | | - file "sui${{ matrix.suffix }}.exe" |
85 | | - |
86 | 86 | mkdir s-ui-windows |
87 | | - cp "sui${{ matrix.suffix }}.exe" s-ui-windows/sui.exe |
| 87 | + cp sui s-ui-windows/sui.exe |
88 | 88 | cp -r windows/* s-ui-windows/ |
89 | 89 |
|
90 | 90 | - name: Package |
|
0 commit comments