Skip to content

Commit 0fac2df

Browse files
committed
ci: update
1 parent d4549ba commit 0fac2df

1 file changed

Lines changed: 23 additions & 8 deletions

File tree

.github/workflows/bytecode-compilers.yml

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ jobs:
118118
# ---------------------------------------------------------------------------
119119
# QuickJS (bellard) — build via its own Makefile (libquickjs.a, which injects
120120
# -D_GNU_SOURCE -DCONFIG_VERSION), then link our blob-emitting shim.
121-
# Unix only: bellard QuickJS has no upstream Windows/MSVC support (use
122-
# QuickJS-NG for Windows).
121+
# win32-x64 is CROSS-compiled on Linux via bellard's CONFIG_WIN32 (mingw-w64);
122+
# win32-arm64 is not possible (mingw-w64 targets x86 only).
123123
# ---------------------------------------------------------------------------
124124
quickjs:
125125
name: quickjs (${{ matrix.host }})
@@ -132,11 +132,17 @@ jobs:
132132
- { host: linux-arm64, runner: ubuntu-24.04-arm }
133133
- { host: darwin-x64, runner: macos-13 }
134134
- { host: darwin-arm64, runner: macos-14 }
135+
- { host: win32-x64, runner: ubuntu-24.04 } # mingw cross-compile
135136
steps:
136137
- uses: actions/checkout@v4
137138
- name: Install toolchain (Linux)
138139
if: runner.os == 'Linux'
139-
run: sudo apt-get update && sudo apt-get install -y build-essential
140+
run: |
141+
set -euxo pipefail
142+
sudo apt-get update
143+
sudo apt-get install -y build-essential
144+
# mingw-w64 for the win32-x64 cross build.
145+
if [ "${{ matrix.host }}" = "win32-x64" ]; then sudo apt-get install -y mingw-w64; fi
140146
# macOS: make + clang ship with the Xcode command-line tools.
141147

142148
- name: Clone QuickJS
@@ -156,12 +162,21 @@ jobs:
156162
run: |
157163
set -euxo pipefail
158164
cd quickjs
159-
# Use bellard's own Makefile so CONFIG_VERSION / _GNU_SOURCE and the
160-
# correct source set come from upstream.
161-
make -j"$(getconf _NPROCESSORS_ONLN)" libquickjs.a
165+
jobs="$(getconf _NPROCESSORS_ONLN)"
162166
out="../out/quickjs/${{ matrix.host }}"; mkdir -p "$out"
163-
cc -O2 -DNSBC_MAGIC='"NSBCQJS"' -I. -o "$out/nsbc-quickjs" "$SHIM" libquickjs.a -lm
164-
"$out/nsbc-quickjs" || true # usage line (exit 2) proves it links & runs
167+
if [ "${{ matrix.host }}" = "win32-x64" ]; then
168+
# CONFIG_WIN32=y selects the x86_64-w64-mingw32- cross toolchain.
169+
make -j"$jobs" CONFIG_WIN32=y libquickjs.a
170+
x86_64-w64-mingw32-gcc -O2 -DNSBC_MAGIC='"NSBCQJS"' -I. \
171+
-o "$out/nsbc-quickjs.exe" "$SHIM" libquickjs.a -lm
172+
# Cross-built Windows binary — not runnable on the Linux host.
173+
else
174+
# Use bellard's own Makefile so CONFIG_VERSION / _GNU_SOURCE and the
175+
# correct source set come from upstream.
176+
make -j"$jobs" libquickjs.a
177+
cc -O2 -DNSBC_MAGIC='"NSBCQJS"' -I. -o "$out/nsbc-quickjs" "$SHIM" libquickjs.a -lm
178+
"$out/nsbc-quickjs" || true # usage line (exit 2) proves it links & runs
179+
fi
165180
166181
- uses: actions/upload-artifact@v4
167182
with:

0 commit comments

Comments
 (0)