From e55c361749d5d6cfd66b5094e75bcfc90d6ee462 Mon Sep 17 00:00:00 2001 From: tannevaled Date: Fri, 29 May 2026 09:01:32 +0200 Subject: [PATCH 01/10] new(mingw-w64.org): Windows runtime libs (headers + CRT + winpthreads) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pure runtime — Windows API headers, C runtime, and pthread emulation. NOT a compiler; just the *target-side* libs that a Windows-targeting clang/gcc needs to actually produce working .exe/.dll output. The compiler itself comes from pantry's existing llvm.org (clang + lld). Built from source for x86_64-w64-mingw32 + aarch64-w64-mingw32 using pantry's llvm.org clang as the cross compiler (LLVM is multi-target by default; --target=*-w64-mingw32 works natively). Build order per target: 1. mingw-w64-headers — install only (.h files) 2. mingw-w64-crt — CRT compiled against headers from (1) 3. winpthreads — pthread emulation on top of (2) Composed by llvm.org/mingw-w64 (separate recipe) which wraps clang into per-target driver scripts (x86_64-w64-mingw32-clang, etc.). This replaces the previous vendored-tarball approach of llvm.org/mingw-w64 — pkgx pantry policy is from-source over vendored binaries. --- projects/mingw-w64.org/package.yml | 119 +++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 projects/mingw-w64.org/package.yml diff --git a/projects/mingw-w64.org/package.yml b/projects/mingw-w64.org/package.yml new file mode 100644 index 0000000000..7c7485bf38 --- /dev/null +++ b/projects/mingw-w64.org/package.yml @@ -0,0 +1,119 @@ +# mingw-w64 — Windows runtime libraries for cross-compilation. +# +# Pure runtime: Windows API headers, C runtime (CRT), and threading +# library (winpthreads). NOT a compiler — provides the *target-side* +# libs that a Windows-targeting clang/gcc needs to actually produce +# working .exe / .dll output. The compiler itself comes from +# `llvm.org` (clang + lld-link). +# +# This recipe + llvm.org together let pkgx build a true from-source +# Windows cross-toolchain — no vendored upstream binaries. +# +# Composed by `llvm.org/mingw-w64` which wraps clang into per-target +# driver scripts (`x86_64-w64-mingw32-clang`, etc.). + +distributable: + url: https://github.com/mingw-w64/mingw-w64/archive/refs/tags/v{{ version.raw }}.tar.gz + strip-components: 1 + +versions: + github: mingw-w64/mingw-w64 + +# Cross-compiler runtime — runs on any host that has clang+lld, so +# the host platform set matches our viable cross-compile hosts. +platforms: + - linux/x86-64 + - linux/aarch64 + - darwin/x86-64 + - darwin/aarch64 + +build: + dependencies: + llvm.org: '*' # clang (--target=*-w64-mingw32) + lld-link + gnu.org/make: '*' + gnu.org/coreutils: '*' + gnu.org/m4: '*' + gnu.org/autoconf: '*' + gnu.org/automake: '*' + gnu.org/libtool: '*' + gnu.org/sed: '*' + gnu.org/findutils: '*' + + script: + # mingw-w64 is built per-target-arch (x86_64-w64-mingw32, + # aarch64-w64-mingw32). LLVM's clang supports both natively + # (LLVM is multi-target by default), so a single clang from + # pantry's llvm.org acts as the cross compiler for all targets. + # + # Build order per target: + # 1. mingw-w64-headers (no compilation — just install .h files) + # 2. mingw-w64-crt (the C runtime, compiled against (1)) + # 3. mingw-w64-libraries/winpthreads (pthreads-w32 emulation) + # + # Toolchain envvars: clang as CC, llvm-ar as AR, llvm-ranlib as + # RANLIB. The configure scripts probe for $CC and friends, so + # exporting them once at the top of the loop is enough. + + - run: | + export AR="llvm-ar" + export RANLIB="llvm-ranlib" + export DLLTOOL="llvm-dlltool" + + for T in x86_64-w64-mingw32 aarch64-w64-mingw32; do + echo "══════ building mingw-w64 for $T ══════" + + export CC="clang --target=$T" + export CXX="clang++ --target=$T" + + # 1) Headers — install-only. + ( + mkdir -p build-headers-$T + cd build-headers-$T + ../mingw-w64-headers/configure \ + --prefix="{{prefix}}/$T" \ + --host="$T" \ + --enable-secure-api + make install + ) + + # 2) CRT — the actual C runtime. + ( + mkdir -p build-crt-$T + cd build-crt-$T + case "$T" in + x86_64-*) ENABLE_FLAGS="--disable-lib32 --enable-lib64" ;; + aarch64-*) ENABLE_FLAGS="--enable-libarm64 --disable-lib32 --disable-lib64" ;; + esac + ../mingw-w64-crt/configure \ + --prefix="{{prefix}}/$T" \ + --host="$T" \ + $ENABLE_FLAGS + make --jobs {{ hw.concurrency }} + make install + ) + + # 3) winpthreads — pthread emulation on top of the CRT. + ( + mkdir -p build-winpthreads-$T + cd build-winpthreads-$T + ../mingw-w64-libraries/winpthreads/configure \ + --prefix="{{prefix}}/$T" \ + --host="$T" \ + --enable-static \ + --enable-shared + make --jobs {{ hw.concurrency }} + make install + ) + done + +test: + # Lib-only package — no binaries to invoke. Verify the expected + # runtime files landed in their per-target subdirs. + script: + - test -f "{{prefix}}/x86_64-w64-mingw32/include/windows.h" + - test -f "{{prefix}}/x86_64-w64-mingw32/include/stdio.h" + - test -f "{{prefix}}/x86_64-w64-mingw32/lib/libmingw32.a" + - test -f "{{prefix}}/x86_64-w64-mingw32/lib/libmsvcrt.a" + - test -f "{{prefix}}/x86_64-w64-mingw32/lib/libpthread.a" + - test -f "{{prefix}}/aarch64-w64-mingw32/include/windows.h" + - test -f "{{prefix}}/aarch64-w64-mingw32/lib/libmingw32.a" From 303eb170e82512881737f239be5bfcf108f211f6 Mon Sep 17 00:00:00 2001 From: tannevaled Date: Fri, 29 May 2026 10:14:38 +0200 Subject: [PATCH 02/10] fix(mingw-w64.org): use tags mode for versions (upstream has no releases) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Upstream `mingw-w64/mingw-w64` only publishes git tags (v9.0.0, v10.0.0, ... v14.0.0) — no GitHub releases. Default `github:` mode queries the releases endpoint first and falls back to tags, but the fallback wasn't producing entries in CI. Force tags mode explicitly via `github: mingw-w64/mingw-w64/tags` and add `strip: - /^v/` to drop the v prefix. Fixes "no versions parsed" failure on all 4 CI runners. --- projects/mingw-w64.org/package.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/mingw-w64.org/package.yml b/projects/mingw-w64.org/package.yml index 7c7485bf38..44ede5c9a2 100644 --- a/projects/mingw-w64.org/package.yml +++ b/projects/mingw-w64.org/package.yml @@ -17,7 +17,10 @@ distributable: strip-components: 1 versions: - github: mingw-w64/mingw-w64 + # Upstream only ships tags, not GitHub releases — force tags mode. + github: mingw-w64/mingw-w64/tags + strip: + - /^v/ # Cross-compiler runtime — runs on any host that has clang+lld, so # the host platform set matches our viable cross-compile hosts. From 6b6392313e4d96d7551ffc981cbf018e31c08032 Mon Sep 17 00:00:00 2001 From: tannevaled Date: Fri, 29 May 2026 10:33:04 +0200 Subject: [PATCH 03/10] fix(mingw-w64.org): CC needs --sysroot for CRT to find headers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CRT configure failed with "Please check if the mingw-w64 header set and the build/host option are set properly." — it probes `` via CC, but clang had no sysroot pointing at the just-installed headers. Re-order: install headers first, THEN export CC/CXX with `--sysroot={{prefix}}/$T` so the cross-compiler can find them. Matches what llvm-mingw upstream does. --- projects/mingw-w64.org/package.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/projects/mingw-w64.org/package.yml b/projects/mingw-w64.org/package.yml index 44ede5c9a2..b525af1744 100644 --- a/projects/mingw-w64.org/package.yml +++ b/projects/mingw-w64.org/package.yml @@ -65,10 +65,9 @@ build: for T in x86_64-w64-mingw32 aarch64-w64-mingw32; do echo "══════ building mingw-w64 for $T ══════" - export CC="clang --target=$T" - export CXX="clang++ --target=$T" - - # 1) Headers — install-only. + # 1) Headers FIRST — no CC dependency, just installs .h files. + # CRT/winpthreads configure scripts then probe via + # CC so headers must exist before --sysroot points at them. ( mkdir -p build-headers-$T cd build-headers-$T @@ -79,6 +78,11 @@ build: make install ) + # Now headers exist at {{prefix}}/$T/include — point clang there + # via --sysroot. Matches what llvm-mingw upstream does. + export CC="clang --target=$T --sysroot={{prefix}}/$T" + export CXX="clang++ --target=$T --sysroot={{prefix}}/$T" + # 2) CRT — the actual C runtime. ( mkdir -p build-crt-$T From a6be6fb36e11e0be3e8442d50a44c2ce7b1038fb Mon Sep 17 00:00:00 2001 From: tannevaled Date: Fri, 29 May 2026 10:50:01 +0200 Subject: [PATCH 04/10] fix(mingw-w64.org): export RC for winpthreads .rc compilation Headers + CRT now build cleanly with --sysroot, but winpthreads failed at the resource-compile step: libtool: error: unrecognised option: '-i' libtool needs RC set so it recognises the windres-compile path through its wrapper. Add `export RC=llvm-windres` (and WINDRES for configure-script consistency). --- projects/mingw-w64.org/package.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/mingw-w64.org/package.yml b/projects/mingw-w64.org/package.yml index b525af1744..ebc663350f 100644 --- a/projects/mingw-w64.org/package.yml +++ b/projects/mingw-w64.org/package.yml @@ -61,6 +61,11 @@ build: export AR="llvm-ar" export RANLIB="llvm-ranlib" export DLLTOOL="llvm-dlltool" + # winpthreads compiles .rc resource files via libtool; + # libtool needs RC set to recognise the rc-compile path. + # Without it, libtool errors with "unrecognised option: '-i'". + export RC="llvm-windres" + export WINDRES="llvm-windres" for T in x86_64-w64-mingw32 aarch64-w64-mingw32; do echo "══════ building mingw-w64 for $T ══════" From c3f43a71257dca073baf0420050196c919f45271 Mon Sep 17 00:00:00 2001 From: tannevaled Date: Fri, 29 May 2026 11:04:05 +0200 Subject: [PATCH 05/10] fix(mingw-w64.org): pass RCFLAGS=-I/include to windres MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit winpthreads' version.rc includes from the mingw-w64 headers. CC --sysroot handles regular C compiles, but windres uses its own include path — and without `-I`, it can't find winver.h: ../mingw-w64-libraries/winpthreads/src/version.rc:23:10: fatal error: 'winver.h' file not found Pass RCFLAGS=-I{{prefix}}/$T/include to the winpthreads configure so windres looks in the same place clang's sysroot does. --- projects/mingw-w64.org/package.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/projects/mingw-w64.org/package.yml b/projects/mingw-w64.org/package.yml index ebc663350f..e2cf34d387 100644 --- a/projects/mingw-w64.org/package.yml +++ b/projects/mingw-w64.org/package.yml @@ -105,6 +105,10 @@ build: ) # 3) winpthreads — pthread emulation on top of the CRT. + # version.rc includes which lives in mingw-w64 + # headers; windres needs `-I` to find them. The configure's + # CC --sysroot covers C compiles but windres uses its own + # include path — pass via RCFLAGS. ( mkdir -p build-winpthreads-$T cd build-winpthreads-$T @@ -112,7 +116,8 @@ build: --prefix="{{prefix}}/$T" \ --host="$T" \ --enable-static \ - --enable-shared + --enable-shared \ + RCFLAGS="-I{{prefix}}/$T/include" make --jobs {{ hw.concurrency }} make install ) From fe45a523b8909278917980bc834269b7b158c1ef Mon Sep 17 00:00:00 2001 From: tannevaled Date: Fri, 29 May 2026 22:31:29 +0200 Subject: [PATCH 06/10] fix(mingw-w64): export NM/STRIP/OBJDUMP/OBJCOPY (PE/COFF-aware) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit winpthreads' libtool link step failed with: checking command to parse nm output from clang --target=x86_64-w64-mingw32 --sysroot=... object... failed make[2]: *** [libwinpthread.la] Error 1 because the host's GNU nm doesn't grok PE/COFF objects emitted by clang's mingw32 target. Wire libtool to llvm-nm (which handles every object format LLVM emits, including PE) plus the rest of the binutils libtool probes — llvm-strip / llvm-objdump / llvm-objcopy — so we don't hit the same wall again on the next libtool stage. Co-Authored-By: Claude Opus 4.7 --- projects/mingw-w64.org/package.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/projects/mingw-w64.org/package.yml b/projects/mingw-w64.org/package.yml index e2cf34d387..ef5bc38c9c 100644 --- a/projects/mingw-w64.org/package.yml +++ b/projects/mingw-w64.org/package.yml @@ -60,7 +60,19 @@ build: - run: | export AR="llvm-ar" export RANLIB="llvm-ranlib" + export NM="llvm-nm" + export STRIP="llvm-strip" export DLLTOOL="llvm-dlltool" + export OBJDUMP="llvm-objdump" + export OBJCOPY="llvm-objcopy" + # libtool's nm-detection probe (`checking command to parse nm + # output from object... failed`) needs an nm that + # understands PE/COFF — the host's GNU nm refuses Windows + # objects, which collapses winpthreads' libtool link step. + # llvm-nm handles every object format LLVM does (incl. PE). + # Same logic for the rest: every binutil libtool probes has + # a PE/COFF-aware llvm-* counterpart, so wire them all. + # winpthreads compiles .rc resource files via libtool; # libtool needs RC set to recognise the rc-compile path. # Without it, libtool errors with "unrecognised option: '-i'". From 6a79bcfedb85ad4a303f378ebe3879419cebccc1 Mon Sep 17 00:00:00 2001 From: tannevaled Date: Fri, 29 May 2026 23:28:41 +0200 Subject: [PATCH 07/10] fix(mingw-w64): build winpthreads static-only to avoid libtool PE/COFF pipe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit libtool's configure-time nm probe constructs a global_symbol_pipe that, with llvm-nm on PE/COFF objects, ends up missing a filter stage and emits `llvm-nm ... | | sed ...` (double pipe → shell syntax error). This only affects the shared (DLL) link path; the static .a build never goes through that pipeline. Switch winpthreads to --enable-static --disable-shared so we get libpthread.a (which is what mingw-w64 consumers link against) and sidestep the broken libtool nm-probe. Co-Authored-By: Claude Opus 4.7 --- projects/mingw-w64.org/package.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/projects/mingw-w64.org/package.yml b/projects/mingw-w64.org/package.yml index ef5bc38c9c..9b6f19dbe0 100644 --- a/projects/mingw-w64.org/package.yml +++ b/projects/mingw-w64.org/package.yml @@ -121,6 +121,15 @@ build: # headers; windres needs `-I` to find them. The configure's # CC --sysroot covers C compiles but windres uses its own # include path — pass via RCFLAGS. + # + # Build STATIC ONLY. The shared (DLL) link goes through + # libtool's PE/COFF "global_symbol_pipe" which configure + # constructs from probing nm output; with llvm-nm the probe + # ends up with an empty sed slot and emits a broken + # `llvm-nm ... | | sed ...` pipeline (double pipe = shell + # syntax error). The static lib doesn't need that pipe. + # We can revisit shared once libtool's PE detection is fixed + # upstream. ( mkdir -p build-winpthreads-$T cd build-winpthreads-$T @@ -128,7 +137,7 @@ build: --prefix="{{prefix}}/$T" \ --host="$T" \ --enable-static \ - --enable-shared \ + --disable-shared \ RCFLAGS="-I{{prefix}}/$T/include" make --jobs {{ hw.concurrency }} make install From f197f44902f648b85c3ee632bcc20535427f351c Mon Sep 17 00:00:00 2001 From: tannevaled Date: Fri, 29 May 2026 23:41:05 +0200 Subject: [PATCH 08/10] fix(mingw-w64): accept libwinpthread.lib (darwin libtool variant) in test darwin libtool installs the static winpthread as libwinpthread.lib (PE-style .lib extension), not libpthread.a. linux libtool installs libpthread.a. The build itself succeeds on both; only our verify step rejected darwin output. Accept either filename so the darwin job goes green. Co-Authored-By: Claude Opus 4.7 --- projects/mingw-w64.org/package.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/mingw-w64.org/package.yml b/projects/mingw-w64.org/package.yml index 9b6f19dbe0..46193f823e 100644 --- a/projects/mingw-w64.org/package.yml +++ b/projects/mingw-w64.org/package.yml @@ -147,11 +147,15 @@ build: test: # Lib-only package — no binaries to invoke. Verify the expected # runtime files landed in their per-target subdirs. + # + # winpthreads ships its static lib under different names depending + # on the host libtool: linux installs `libpthread.a`, darwin's + # libtool produces `libwinpthread.lib` (PE-style). Accept either. script: - test -f "{{prefix}}/x86_64-w64-mingw32/include/windows.h" - test -f "{{prefix}}/x86_64-w64-mingw32/include/stdio.h" - test -f "{{prefix}}/x86_64-w64-mingw32/lib/libmingw32.a" - test -f "{{prefix}}/x86_64-w64-mingw32/lib/libmsvcrt.a" - - test -f "{{prefix}}/x86_64-w64-mingw32/lib/libpthread.a" + - test -f "{{prefix}}/x86_64-w64-mingw32/lib/libpthread.a" -o -f "{{prefix}}/x86_64-w64-mingw32/lib/libwinpthread.lib" - test -f "{{prefix}}/aarch64-w64-mingw32/include/windows.h" - test -f "{{prefix}}/aarch64-w64-mingw32/lib/libmingw32.a" From 3c28b6546db392b67267343768850265d85fe4e3 Mon Sep 17 00:00:00 2001 From: Jacob Heider Date: Sat, 30 May 2026 00:10:18 -0400 Subject: [PATCH 09/10] Update package.yml for version handling and build process --- projects/mingw-w64.org/package.yml | 202 +++++++++++++---------------- 1 file changed, 91 insertions(+), 111 deletions(-) diff --git a/projects/mingw-w64.org/package.yml b/projects/mingw-w64.org/package.yml index 46193f823e..280f3b4c3f 100644 --- a/projects/mingw-w64.org/package.yml +++ b/projects/mingw-w64.org/package.yml @@ -13,34 +13,43 @@ # driver scripts (`x86_64-w64-mingw32-clang`, etc.). distributable: - url: https://github.com/mingw-w64/mingw-w64/archive/refs/tags/v{{ version.raw }}.tar.gz + url: https://github.com/mingw-w64/mingw-w64/archive/refs/tags/{{ version.tag }}.tar.gz strip-components: 1 versions: # Upstream only ships tags, not GitHub releases — force tags mode. github: mingw-w64/mingw-w64/tags - strip: - - /^v/ - -# Cross-compiler runtime — runs on any host that has clang+lld, so -# the host platform set matches our viable cross-compile hosts. -platforms: - - linux/x86-64 - - linux/aarch64 - - darwin/x86-64 - - darwin/aarch64 build: dependencies: - llvm.org: '*' # clang (--target=*-w64-mingw32) + lld-link - gnu.org/make: '*' - gnu.org/coreutils: '*' - gnu.org/m4: '*' - gnu.org/autoconf: '*' - gnu.org/automake: '*' - gnu.org/libtool: '*' - gnu.org/sed: '*' - gnu.org/findutils: '*' + llvm.org: "*" # clang (--target=*-w64-mingw32) + lld-link + gnu.org/m4: "*" + gnu.org/autoconf: "*" + gnu.org/automake: "*" + gnu.org/libtool: "*" + env: + # libtool's nm-detection probe (`checking command to parse nm + # output from object... failed`) needs an nm that + # understands PE/COFF — the host's GNU nm refuses Windows + # objects, which collapses winpthreads' libtool link step. + # llvm-nm handles every object format LLVM does (incl. PE). + # Same logic for the rest: every binutil libtool probes has + # a PE/COFF-aware llvm-* counterpart, so wire them all. + AR: "llvm-ar" + RANLIB: "llvm-ranlib" + NM: "llvm-nm" + STRIP: "llvm-strip" + DLLTOOL: "llvm-dlltool" + OBJDUMP: "llvm-objdump" + OBJCOPY: "llvm-objcopy" + # winpthreads compiles .rc resource files via libtool; + # libtool needs RC set to recognise the rc-compile path. + # Without it, libtool errors with "unrecognised option: '-i'". + RC: "llvm-windres" + WINDRES: "llvm-windres" + TARGETS: + - x86_64-w64-mingw32 + - aarch64-w64-mingw32 script: # mingw-w64 is built per-target-arch (x86_64-w64-mingw32, @@ -56,93 +65,65 @@ build: # Toolchain envvars: clang as CC, llvm-ar as AR, llvm-ranlib as # RANLIB. The configure scripts probe for $CC and friends, so # exporting them once at the top of the loop is enough. + - for T in $TARGETS; do + - echo "══════ building mingw-w64 for $T ══════" - - run: | - export AR="llvm-ar" - export RANLIB="llvm-ranlib" - export NM="llvm-nm" - export STRIP="llvm-strip" - export DLLTOOL="llvm-dlltool" - export OBJDUMP="llvm-objdump" - export OBJCOPY="llvm-objcopy" - # libtool's nm-detection probe (`checking command to parse nm - # output from object... failed`) needs an nm that - # understands PE/COFF — the host's GNU nm refuses Windows - # objects, which collapses winpthreads' libtool link step. - # llvm-nm handles every object format LLVM does (incl. PE). - # Same logic for the rest: every binutil libtool probes has - # a PE/COFF-aware llvm-* counterpart, so wire them all. - - # winpthreads compiles .rc resource files via libtool; - # libtool needs RC set to recognise the rc-compile path. - # Without it, libtool errors with "unrecognised option: '-i'". - export RC="llvm-windres" - export WINDRES="llvm-windres" - - for T in x86_64-w64-mingw32 aarch64-w64-mingw32; do - echo "══════ building mingw-w64 for $T ══════" + # 1) Headers FIRST — no CC dependency, just installs .h files. + # CRT/winpthreads configure scripts then probe via + # CC so headers must exist before --sysroot points at them. + - run: + - ../mingw-w64-headers/configure + --prefix="{{prefix}}/$T" + --host="$T" + --enable-secure-api + - make install + working-directory: build-headers-$T - # 1) Headers FIRST — no CC dependency, just installs .h files. - # CRT/winpthreads configure scripts then probe via - # CC so headers must exist before --sysroot points at them. - ( - mkdir -p build-headers-$T - cd build-headers-$T - ../mingw-w64-headers/configure \ - --prefix="{{prefix}}/$T" \ - --host="$T" \ - --enable-secure-api - make install - ) + # Now headers exist at {{prefix}}/$T/include — point clang there + # via --sysroot. Matches what llvm-mingw upstream does. + - export CC="clang --target=$T --sysroot={{prefix}}/$T" + - export CXX="clang++ --target=$T --sysroot={{prefix}}/$T" - # Now headers exist at {{prefix}}/$T/include — point clang there - # via --sysroot. Matches what llvm-mingw upstream does. - export CC="clang --target=$T --sysroot={{prefix}}/$T" - export CXX="clang++ --target=$T --sysroot={{prefix}}/$T" + # 2) CRT — the actual C runtime. + - run: + - | + case "$T" in + x86_64-*) ENABLE_FLAGS="--disable-lib32 --enable-lib64" ;; + aarch64-*) ENABLE_FLAGS="--enable-libarm64 --disable-lib32 --disable-lib64" ;; + esac + - ../mingw-w64-crt/configure + --prefix="{{prefix}}/$T" + --host="$T" + $ENABLE_FLAGS + - make --jobs {{ hw.concurrency }} + - make install + working-directory: build-crt-$T - # 2) CRT — the actual C runtime. - ( - mkdir -p build-crt-$T - cd build-crt-$T - case "$T" in - x86_64-*) ENABLE_FLAGS="--disable-lib32 --enable-lib64" ;; - aarch64-*) ENABLE_FLAGS="--enable-libarm64 --disable-lib32 --disable-lib64" ;; - esac - ../mingw-w64-crt/configure \ - --prefix="{{prefix}}/$T" \ - --host="$T" \ - $ENABLE_FLAGS - make --jobs {{ hw.concurrency }} - make install - ) - - # 3) winpthreads — pthread emulation on top of the CRT. - # version.rc includes which lives in mingw-w64 - # headers; windres needs `-I` to find them. The configure's - # CC --sysroot covers C compiles but windres uses its own - # include path — pass via RCFLAGS. - # - # Build STATIC ONLY. The shared (DLL) link goes through - # libtool's PE/COFF "global_symbol_pipe" which configure - # constructs from probing nm output; with llvm-nm the probe - # ends up with an empty sed slot and emits a broken - # `llvm-nm ... | | sed ...` pipeline (double pipe = shell - # syntax error). The static lib doesn't need that pipe. - # We can revisit shared once libtool's PE detection is fixed - # upstream. - ( - mkdir -p build-winpthreads-$T - cd build-winpthreads-$T - ../mingw-w64-libraries/winpthreads/configure \ - --prefix="{{prefix}}/$T" \ - --host="$T" \ - --enable-static \ - --disable-shared \ - RCFLAGS="-I{{prefix}}/$T/include" - make --jobs {{ hw.concurrency }} - make install - ) - done + # 3) winpthreads — pthread emulation on top of the CRT. + # version.rc includes which lives in mingw-w64 + # headers; windres needs `-I` to find them. The configure's + # CC --sysroot covers C compiles but windres uses its own + # include path — pass via RCFLAGS. + # + # Build STATIC ONLY. The shared (DLL) link goes through + # libtool's PE/COFF "global_symbol_pipe" which configure + # constructs from probing nm output; with llvm-nm the probe + # ends up with an empty sed slot and emits a broken + # `llvm-nm ... | | sed ...` pipeline (double pipe = shell + # syntax error). The static lib doesn't need that pipe. + # We can revisit shared once libtool's PE detection is fixed + # upstream. + - run: + - ../mingw-w64-libraries/winpthreads/configure + --prefix="{{prefix}}/$T" + --host="$T" + --enable-static + --disable-shared + RCFLAGS="-I{{prefix}}/$T/include" + - make --jobs {{ hw.concurrency }} + - make install + working-directory: build-winpthreads-$T + - done # for T in $TARGETS test: # Lib-only package — no binaries to invoke. Verify the expected @@ -151,11 +132,10 @@ test: # winpthreads ships its static lib under different names depending # on the host libtool: linux installs `libpthread.a`, darwin's # libtool produces `libwinpthread.lib` (PE-style). Accept either. - script: - - test -f "{{prefix}}/x86_64-w64-mingw32/include/windows.h" - - test -f "{{prefix}}/x86_64-w64-mingw32/include/stdio.h" - - test -f "{{prefix}}/x86_64-w64-mingw32/lib/libmingw32.a" - - test -f "{{prefix}}/x86_64-w64-mingw32/lib/libmsvcrt.a" - - test -f "{{prefix}}/x86_64-w64-mingw32/lib/libpthread.a" -o -f "{{prefix}}/x86_64-w64-mingw32/lib/libwinpthread.lib" - - test -f "{{prefix}}/aarch64-w64-mingw32/include/windows.h" - - test -f "{{prefix}}/aarch64-w64-mingw32/lib/libmingw32.a" + - test -f "{{prefix}}/x86_64-w64-mingw32/include/windows.h" + - test -f "{{prefix}}/x86_64-w64-mingw32/include/stdio.h" + - test -f "{{prefix}}/x86_64-w64-mingw32/lib/libmingw32.a" + - test -f "{{prefix}}/x86_64-w64-mingw32/lib/libmsvcrt.a" + - test -f "{{prefix}}/x86_64-w64-mingw32/lib/libpthread.a" -o -f "{{prefix}}/x86_64-w64-mingw32/lib/libwinpthread.lib" + - test -f "{{prefix}}/aarch64-w64-mingw32/include/windows.h" + - test -f "{{prefix}}/aarch64-w64-mingw32/lib/libmingw32.a" From 3caf6c4712da49ce75b9bf1ae1be337b1531a803 Mon Sep 17 00:00:00 2001 From: Jacob Heider Date: Sat, 30 May 2026 00:13:31 -0400 Subject: [PATCH 10/10] Fix indentation for make install command --- projects/mingw-w64.org/package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/mingw-w64.org/package.yml b/projects/mingw-w64.org/package.yml index 280f3b4c3f..a757079b6b 100644 --- a/projects/mingw-w64.org/package.yml +++ b/projects/mingw-w64.org/package.yml @@ -76,7 +76,7 @@ build: --prefix="{{prefix}}/$T" --host="$T" --enable-secure-api - - make install + - make install working-directory: build-headers-$T # Now headers exist at {{prefix}}/$T/include — point clang there