@@ -24,20 +24,6 @@ distributable:
2424versions :
2525 github : mstorsjo/llvm-mingw
2626
27- # llvm-mingw's host-platform tarballs cover Linux x86-64, Linux aarch64,
28- # and macOS universal (x86-64 + aarch64). No Windows-host variant for
29- # our purposes (we'd rather have Windows binaries be a *target*, not
30- # a host).
31- #
32- # Hosts: linux + darwin. (Earlier rounds restricted to linux because
33- # darwin failed and logs weren't externally accessible; @jhheider
34- # shared the log on pkgxdev/pantry#12984 — the failure was the test
35- # step invoking the compiler by bare name, which brewkit's sandbox
36- # auto-fetched as a different clang. Fix below: invoke by full path.)
37- platforms :
38- - linux
39- - darwin
40-
4127warnings :
4228 - vendored # we redistribute upstream prebuilt binaries
4329
4632 curl.se : " *"
4733 gnu.org/tar : " *"
4834 tukaani.org/xz : " *"
49-
5035 env :
5136 linux/x86-64 :
5237 PLATFORM : ubuntu-22.04-x86_64
@@ -56,73 +41,39 @@ build:
5641 PLATFORM : macos-universal
5742 darwin/aarch64 :
5843 PLATFORM : macos-universal
59- script :
60- # Map our host triple → upstream's tarball naming convention,
61- # then download + extract the prebuilt binary toolchain.
62- - URL="https://github.com/mstorsjo/llvm-mingw/releases/download/{{version.raw}}/llvm-mingw-{{version.raw}}-ucrt-${PLATFORM}.tar.xz"
63- - echo "fetching $URL"
64- - curl -Lfo llvm-mingw.tar.xz "$URL"
65-
66- # Copy the WHOLE prebuilt toolchain into {{prefix}}. Upstream's
67- # drivers (x86_64-w64-mingw32-clang etc.) are wrappers that call
68- # into ../lib/clang/.../bin via relative paths — already
69- # relocatable. Extract into a staging dir (keeps the downloaded
70- # tarball out of the copy) and copy everything.
71- #
72- # Copying the full tree matters: besides bin/lib/include/share,
73- # llvm-mingw ships per-target sysroots — generic-w64-mingw32/include
74- # holds the mingw headers (stdio.h & friends) and each
75- # <triple>-w64-mingw32/lib holds the import libs. Cherry-picking only
76- # bin+lib+share+include dropped those, so the cross compiler couldn't
77- # find its own headers ("'stdio.h' file not found"). This was masked
78- # on the Linux CI sandbox (its old glibc can't even load the clang,
79- # so the compile test skipped) and only bit on darwin, which runs it.
80- #
81- # brewkit doesn't pre-create {{prefix}}, so mkdir it first.
82- - rm -rf staging && mkdir -p staging "{{prefix}}"
83- - tar Jxf llvm-mingw.tar.xz --strip-components=1 -C staging
84- - cp -a staging/. "{{prefix}}/"
44+ URL : https://github.com/mstorsjo/llvm-mingw/releases/download/{{version.tag}}/llvm-mingw-{{version.tag}}-ucrt
45+ working-directory : ${{prefix}}
46+ script : curl -Lf "$URL-${PLATFORM}.tar.xz" | tar Jxpf - --strip-components=1
8547
8648test :
8749 # winehq.org/wine is a soft dep — if present, we actually run the
8850 # cross-compiled .exe through wine and verify the output. If not,
8951 # we fall back to a PE magic-byte check. See pkgxdev/brewkit#346
9052 # discussion: wine in pantry would let us validate the cross-compile
9153 # chain end-to-end without GitHub Windows runners.
92- dependencies :
93- winehq.org : " *"
54+
55+ # TODO: enable after #12986 is merged
56+ # dependencies:
57+ # winehq.org: "*"
9458 env :
9559 WINEDEBUG : -all
9660 WINEDLLOVERRIDES : " mscoree=;mshtml="
9761 WINEPREFIX : $PWD/.wine
98- # Pin our own bottle's binaries by full path. brewkit's test
99- # sandbox treats unfamiliar commands as external deps and routes
100- # them through `pkgx auto-fetch`, which (on darwin in earlier
101- # rounds) picked up a different clang that didn't know our mingw
102- # headers. Full path bypasses that.
103- CLANG_X86_64 : " {{prefix}}/bin/x86_64-w64-mingw32-clang"
104- CLANG_AARCH64 : " {{prefix}}/bin/aarch64-w64-mingw32-clang"
10562 script :
10663 # Diagnostics first — surface env + filesystem state so the
10764 # darwin self-hosted-runner failure (logs not externally
10865 # accessible) becomes visible to maintainers.
109- - |
110- echo "── env diagnostics ──"
111- echo "CLANG_X86_64=$CLANG_X86_64"
112- echo "CLANG_AARCH64=$CLANG_AARCH64"
113- echo "── filesystem check ──"
114- ls -la "$CLANG_X86_64" 2>&1 || echo "(missing: $CLANG_X86_64)"
115- ls -la "$CLANG_AARCH64" 2>&1 || echo "(missing: $CLANG_AARCH64)"
66+ - command -v aarch64-w64-mingw32-clang
67+ - command -v x86_64-w64-mingw32-clang
11668
11769 # Pre-flight: can clang actually run on this host?
11870 # On a buster-sandbox host (glibc 2.28) clang can't load —
11971 # `GLIBC_2.34 not found`. Skip gracefully then.
120- - |
121- if ! "$CLANG_X86_64" --version 2>&1; then
122- echo "clang can't run on this host (likely glibc < 2.34) —"
123- echo "skipping cross-compile test, recipe install OK."
124- exit 0
125- fi
72+ - if ! x86_64-w64-mingw32-clang --version 2>&1; then
73+ - echo "clang can't run on this host (likely glibc < 2.34) —"
74+ - echo "skipping cross-compile test, recipe install OK."
75+ - exit 0
76+ - fi
12677
12778 # Cross-compile a trivial Windows binary for x86-64 and aarch64.
12879 - run : cp $FIXTURE hello.c
@@ -132,20 +83,15 @@ test:
13283 printf("Hello from native Windows cross-compile.\n");
13384 return 0;
13485 }
135- - $CLANG_X86_64 -o hello-x86_64.exe hello.c
136- - $CLANG_AARCH64 -o hello-aarch64.exe hello.c
86+ - x86_64-w64-mingw32-clang -o hello-x86_64.exe hello.c
87+ - aarch64-w64-mingw32-clang -o hello-aarch64.exe hello.c
13788
13889 # Static signature check: PE32+ starts with "MZ" at offset 0.
13990 # head -c 2 reads the raw bytes; "MZ" are printable so the shell
14091 # capture works without any od/tr/sed gymnastics (which had subtle
14192 # BSD-vs-GNU output-format differences and broke on darwin).
142- - |
143- for f in hello-x86_64.exe hello-aarch64.exe; do
144- case "$(head -c 2 "$f")" in
145- MZ) echo "$f: PE/COFF DOS header OK" ;;
146- *) echo "$f: NOT a PE binary"; exit 1 ;;
147- esac
148- done
93+ - test "$(head -c 2 hello-x86_64.exe)" = "MZ"
94+ - test "$(head -c 2 hello-aarch64.exe)" = "MZ"
14995
15096 # Dynamic check: actually run the .exe through wine. We only run
15197 # the x86-64 binary — wine on linux/aarch64 hosts can run aarch64
@@ -154,24 +100,17 @@ test:
154100 #
155101 # WINEDLLOVERRIDES disables wine's first-run Mono/Gecko prompts;
156102 # WINEDEBUG silences load-time warnings. Both standard for headless.
157- - |
158- if command -v wine64 >/dev/null 2>&1; then
159- WINE=wine64
160- elif command -v wine >/dev/null 2>&1; then
161- WINE=wine
162- else
163- echo "wine not available — skipping runtime test (compile + PE-magic-check only)"
164- exit 0
165- fi
166103
167- - echo "running hello-x86_64.exe under $($WINE --version)"
168- - out=$($WINE hello-x86_64.exe)
169- - ' echo "wine stdout: $out"'
170- - |
171- case "$out" in
172- "Hello from native Windows cross-compile.") echo "RUN PASS" ;;
173- *) echo "RUN FAIL: unexpected output"; exit 1 ;;
174- esac
104+ # TODO: enable after #12986 is merged
105+ - exit 0
106+ - if command -v wine64 >/dev/null 2>&1; then
107+ - WINE=wine64
108+ - else
109+ - WINE=wine
110+ - fi
111+
112+ - test "$($WINE hello-x86_64.exe)" = "Hello from native Windows cross-compile."
113+ - test "$($WINE hello-aarch64.exe)" = "Hello from native Windows cross-compile."
175114
176115provides :
177116 # x86_64 cross drivers
0 commit comments