feat(jq): add windows/x86-64 cross-compile pilot (#346 Phase 0)#12987
feat(jq): add windows/x86-64 cross-compile pilot (#346 Phase 0)#12987tannevaled wants to merge 1 commit into
Conversation
Phase-0 pilot recipe for the Windows-port architecture sketched at pkgxdev/brewkit#346. Cross-compiles jq from a Linux runner (via pkgxdev#12984's llvm.org/mingw-w64 toolchain), produces bin/jq.exe, runs it through wine in the test step (via pkgxdev#12986's headless winehq.org recipe). Build side: - Detect platform via {{hw.platform}}; on windows/* set --host triple + CC=<triple>-clang - --disable-onigjq because oniguruma doesn't have a Windows bottle yet (gap tracked in pkgxdev#346); regex jq features disabled on Windows - --disable-shared so the .exe is self-contained (no .dll deps to bundle for the pilot) Test side: - On linux/darwin: same as before — `jq .devs[1].github` returns "jhheider" from the existing test.json fixture - On windows/*: run jq.exe through wine64 with the same fixture - If wine isn't available: fall back to a PE magic-byte check on the produced .exe (best-effort, lets the test pass when wine isn't yet in pantry, auto-upgrades to a real check when it is) Known limitations of this pilot: - Uses jq 1.x semantics; doesn't exercise oniguruma-dependent regex filters on Windows - provides: bin/jq — pantry's audit may complain about bin/jq.exe on Windows. If so we need a brewkit hook to accept platform- appropriate suffixes (e.g. bin/jq → bin/jq.exe on windows/*) - Build dep on llvm.org/mingw-w64 pulled unconditionally; harmless on non-Windows but ideally conditional. Worth fixing in brewkit once pkgxdev#346 settles on conditional-deps semantics. Refs: pkgxdev/brewkit#346, pkgxdev#12984, pkgxdev#12986.
|
Note: CI fails by design until #12984 lands. The CI failure is: …because this PR adds Two paths forward:
Sticking with path #1 — this PR stays draft + CI-red until the toolchain is available. For non-Windows builds the recipe should still work (Windows path is gated by
If yes, this PR can ship with |
On windows/* targets, make install produces `bin/foo.exe` instead of `bin/foo`. Recipes that target multiple platforms shouldn't have to enumerate both forms in `provides:` — extend the lookup to also accept the `.exe` suffix as a fallback. This is the brewkit hook @jhheider pointed at on pkgxdev#346 (audit/audit.ts line 46). It unblocks the jq Windows pilot (pkgxdev/pantry#12987) which would otherwise fail the `provides: - bin/jq` audit on its windows/x86-64 target (the actual binary is `bin/jq.exe`). Implementation: just expand the search list. Cost is one extra stat per provided binary on non-Windows installs (no measurable impact); zero false-positive risk because `.exe` files are unconventional on POSIX systems. No platform check at audit time — the audit runs over whatever's in the cellar, doesn't need to know what target was built for. If `foo.exe` exists, that's a real PE binary and counts as providing `foo`.
Draft — Phase-0 pilot for pkgxdev/brewkit#346 (native Windows bottles RFC).
What
Extends the existing
jqrecipe to also build onwindows/x86-64(and triviallywindows/aarch64), via cross-compile from Linux/macOS runners using thellvm.org/mingw-w64toolchain in #12984.End-to-end loop demonstrated
This closes the Windows-port architectural loop sketched at pkgxdev/brewkit#346 with a concrete, reviewable recipe that actually produces + tests a Windows binary using only Linux CI.
Depends on
llvm.org/mingw-w64toolchainwinehq.orgheadless wineBoth are draft PRs. This PR currently has soft fallbacks (PE magic-byte check when wine is missing) so it can be CI-validated even before #12986 lands — but the full runtime-validation story needs all three.
Known pilot limitations (called out in the recipe comments)
provides: bin/jqdoesn't account for the.exesuffix on Windows — audit might complain; needs a brewkit hookllvm.org/mingw-w64build dep: harmless on non-Windows but ideally conditional once brewkit conditional-dep semantics are settledWhat this is NOT
Test plan
wine64 jq.exe .smoke-tests the resulting binary on a non-CI Linux boxRefs: pkgxdev/brewkit#346 (RFC), pkgxdev/brewkit#347 (fix-pe + bkwinvenv), pkgxdev/pkgx#607.