1
0
mirror of https://github.com/skeeto/w64devkit.git synced 2026-10-23 06:08:56 +03:00
Commit Graph

357 Commits

Author SHA1 Message Date
g-berthiaume
16ed33fa2d Add make2compdb, JSON Compilation Database tool
Closes #251.
2026-09-17 08:17:43 -04:00
Christopher Wellons
bfd76abc0c Bump to 2.10.0 2026-09-13 20:56:27 -04:00
Christopher Wellons
3e233990e0 Rename the crossgcc patch queue to gcc-final
"crossgcc" names a property both GCC builds share: /x-gcc is a plain
cross build and /gcc is a Canadian cross, so "cross" does not tell them
apart, and it points at the bootstrap compiler, which is the one queue
it does not apply to.

What separates the queues is reach. Both push onto the same tree, which
is never popped: src/gcc goes on before the bootstrap compiler and is
still applied when the shipped compiler configures, so it reaches both.
The second queue goes on top afterward and reaches only the compiler
that ships. Name it for that.

As a bonus the directories now sort in push order; crossgcc sorted
before gcc while being applied after it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-03 08:43:31 -04:00
Christopher Wellons
8a587db9a7 Upgrade to CMake 4.4.3
Per the upstream release notes, the only documented change is that Swift
policy CMP0215's NEW behavior now also requires CMP0157 and CMP0195 to
be set to NEW. force-ninja.patch still applies.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-31 18:15:17 -04:00
Christopher Wellons
8be14c351d Upgrade to Expat 2.8.4
Security release fixing 4 vulnerabilities.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-31 18:14:53 -04:00
Christopher Wellons
5179007b22 Manage patch queues with quilt series files
Move each component's patches from flat, prefixed file names into a
per-component directory with a quilt series file, dropping the number
prefixes: application order is now stated by series rather than
enforced by lexicographic glob expansion. Outside the build, a queue
is managed by our own quilt against an unpacked tarball from source/
with QUILT_PATCHES=/path/to/src/<component>. The shipped kit carries
the same layout under $W64DEVKIT_HOME/src, consumable by the bundled
quilt.exe the same way.

Inside the build, apply queues with Debian's original quilt rather
than a native build of src/quilt.cpp, whose amalgamation is
Windows-only. This keeps battle-tested GNU patch as the engine, and
makes every image build a conformance check: series semantics mean
whatever the reference implementation says, and a queue our clone
manages must be accepted by original quilt. The .pc state is removed
after each push because source trees are never popped, and a stale
.pc from one queue blocks pushing a second queue onto the same tree,
which happens twice: gcc then crossgcc, mingw then gendef.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-30 17:25:31 -04:00
Christopher Wellons
666c7c1983 Ship x86 NSIS stubs in the multilib kit
makensis is retargetable: the architecture of the installers it emits
is decided by which precompiled stub it attaches, stubs and plugins
are stored under target-suffixed names, and a script selects one with
"Target x86-unicode" (or CPU x86). Its default remains amd64, chosen
by the bitness of makensis itself. Add a second stub-and-plugin pass
so the multilib kit can emit 32-bit installers, which remain the
traditional choice even for 64-bit payloads since they run on every
Windows and can fail politely on 32-bit hosts.

The NSIS build derives each tool from XGCC_W32_PREFIX and never adds
-m32 on its own, so present the multilib compiler through an i686
interface: wrapper scripts that forward with -m32, --32, and
--target=pe-i386, mirroring the aliases the kit itself ships. The
x86-ansi extras come along unconditionally, matching the standalone
x86 kit's layout.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-30 13:13:16 -04:00
Christopher Wellons
7b39d30a7b Namespace the CMake profile flags
CMAKE_C_FLAGS and CMAKE_CXX_FLAGS are real CMake variable names, and
profile values sit in the environment of every RUN, including the other
cmake invocations that do not pass these flags explicitly. CMake does
not read them from the environment today, but it honors a growing list
of CMAKE_* environment variables, so real names are a latent hazard.
Rename them and document the naming discipline alongside the profiles,
which also covers why CRT_LIB32/CRT_LIB64 avoid their obvious names.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-30 13:13:16 -04:00
Peter0x44
f7ba9d67da Merge multilib support into x64 variant 2026-08-30 13:13:16 -04:00
Peter0x44
e293462e2b Simplify variant profile controls
Use the selected VARIANT directly for multilib-only control flow rather
than maintaining a separate EXTRA_32 boolean. Redeclare the global build
argument in the selected cross stage so each conditional can state the
actual profile requirement explicitly.

Represent GCC multilib and mingw-w64 CRT selections as enable or disable
state instead of storing complete configure options. Form the GCC and CRT
arguments at their call sites, which keeps punctuation out of the profile
data and makes the three configurations easier to compare.

Remove the standalone x86 WINNT_FLAGS override. The
mingw-default-win32-winnt patch already substitutes Windows XP for every
__i386__ compilation, so passing the same header default through configure
was redundant. Keep the separate Windows 7 CMake flags because CMake and
its bundled curl cannot build against the XP target.

Rename the remaining values that intentionally contain complete command
arguments to GCC_ARCH_FLAG, GCC_MANIFEST_FLAG, and ZSTD_THREAD_FLAG. The
component scope and representation are now visible in each name.

Verify the resulting x64, x86, and multilib Dockerfiles with build checks
and complete cross-toolchain builds. Confirm that only the multilib profile
executes the secondary 32-bit runtime and alias blocks and that each GCC and
CRT configure command receives the expected enable or disable options.
2026-08-30 13:13:16 -04:00
Peter0x44
2e424d7941 Replace variant arguments with build profiles
Replace the loosely coordinated collection of x86 build arguments with
a single VARIANT selector. Define x64, x86, and multilib configuration
stages, then select the requested stage as the common cross-compiler
base. This keeps each supported configuration closed and prevents
callers from combining incompatible architecture settings.

Make x64 the default standalone profile. It targets
x86_64-w64-mingw32, disables GCC multilib support, builds only the
64-bit CRT, and omits the secondary 32-bit libraries and aliases.

Keep the standalone x86 behavior in its own profile. It targets
i686-w64-mingw32, retains the Pentium 4 default, enables only the
32-bit CRT, preserves the Windows XP header default and manifest
behavior, selects the 32-bit BusyBox and NSIS configurations, disables
zstd threading, and raises _WIN32_WINNT only while building CMake.
CMake and its bundled curl require at least Windows Vista APIs, so the
C and C++ flags continue to target Windows 7 without changing the
XP-oriented default of the installed toolchain.

Define multilib as an x86_64 compiler with GCC multilib enabled, both
CRT library sets installed, and the existing i686 forwarding aliases.
Use a dedicated EXTRA_32 setting for the secondary lib32 libraries,
winpthreads builds, thread support object, and aliases instead of
inferring that work from the spelling of a GCC configure option.
Expose independent CRT_LIB32 and CRT_LIB64 settings so each profile
selects exactly the runtime libraries it needs.

Pass the profile's CMake C and C++ flags directly rather than building
an optional argument list through shell positional parameters. Keep all
other profile-specific values next to the selected base stage, including
GCC architecture and manifest flags, BusyBox configuration, zstd
options, and NSIS target architecture.

Simplify multibuild.sh to pass only VARIANT to Docker. Add -m for the
multilib flavor, make -a build all three profiles, and remove the old
argument-file and Dockerfile-patch fallback paths. Update unsigned and
signed CI builds to select x64 or x86 directly, remove the obsolete
variant-x86.args bundle, and document the new build interface.

Verify all three profiles with docker build --check and complete cross
toolchain builds. Smoke-test x64 and x86 compilation, plus both the
64-bit compiler and i686 alias in the multilib profile. Also build the
x64 and x86 CMake targets to exercise both the empty and Windows 7
CMake flag configurations.
2026-08-30 13:13:16 -04:00
Christopher Wellons
5daabd5683 Replace the variant patch with Dockerfile build args
Hoist every variant-sensitive value into an ARG at the top of the cross
stage, with defaults producing the x64 kit, and gate the multilib-only
sidecar builds on MULTILIB. The x86 variant becomes a set of NAME=value
overrides in src/variant-x86.args, which multibuild.sh turns into
--build-arg options. A plain "docker build" continues to work untouched,
downloads stay shared between variants, and the patch mechanism remains
available as a fallback for a future variant needing structural changes.

One hazard of this approach: ARGs leak into the environment of every
subsequent RUN in the stage, and configure scripts read arbitrary
environment variables. mingw-w64-crt decides whether to build the Win64
runtime by testing whether a shell variable named LIB64 is merely set,
so an ARG of that name forced lib64 on past an explicit --disable-lib64.
Hence CRT_LIB64. Keep ARG names clear of names configure might consult.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-30 13:13:16 -04:00
Christopher Wellons
60cfbd242c Remove dllwrap from the distribution
It's been deprecated for 6 years and unmaintained for 20 years.
2026-08-30 13:13:16 -04:00
Peter0x44
47e0092d6d Fix i686 multilib tool aliases 2026-08-30 13:13:16 -04:00
Peter0x44
0f358cbe71 Default x86 Windows target version in headers 2026-08-30 13:13:16 -04:00
Peter0x44
83f3251d4a Add x86 multilib toolchain support
Keep x86_64 as the default output while enabling the GCC and mingw-w64
32-bit multilib under lib32. Build 32-bit support archives, CRT
libraries, and winpthreads for both the bootstrap and final sysroots so
each compiler stage has a complete i686 runtime.

Use pentium4 as the 32-bit architecture baseline. Add a GCC specs rule
that defaults _WIN32_WINNT to 0x0501 only under -m32 and only when the
caller has not supplied a value, preserving the existing x64 default and
explicit overrides.

Retain the x86_64-w64-mingw32-prefixed tools and add a separate build
step for an i686-w64-mingw32 interface. Compiler drivers inject -m32.
Target-sensitive binutils select their 32-bit modes explicitly: as uses
--32, ld uses -m i386pe, dlltool uses -m i386 with --as-flags=--32, and
windres uses --target=pe-i386. Input-driven inspection and archive tools
forward without a target override.

These forwarding executables provide both prefixed interfaces without
duplicating a second binutils installation. They deliberately remain
selectors for the underlying x86_64-configured multilib compiler rather
than spoofing its configured target identity.

Direct, Autoconf, CMake, and Libtool probes using the i686-prefixed
interface all produced PE-i386 output.
2026-08-30 13:13:16 -04:00
Christopher Wellons
90c83d12a6 Swap GNU downloads to a mirror
The main GNU site has been down for a few days.
2026-08-28 06:52:43 -04:00
Christopher Wellons
700c0611fc Fetch sources with ADD --checksum instead of curl
BuildKit keys ADD --checksum on the checksum and the URL basename, not
on the host, so re-pointing a download at another mirror is a cache hit
and does not even resolve the host. Swapping mirrors during an ftp.gnu.org
outage no longer costs a re-download of everything, which is the trap
that made the recent debian:trixie-slim digest bump so expensive.

Stages that fetched several tarballs in one curl now get one ADD each,
so a mirror change re-fetches a single file rather than all of dl-cross.

Names come from ADD's dest where the URL basename differs, replacing
curl --remote-header-name. This matters beyond cosmetics: every stage's
/dl/*.* is copied into /source/, so these names ship in the source
distribution. GitHub archive refs are the four affected downloads.

ADD cannot run a shell, so expat's tag gains an EXPAT_TAG arg rather
than deriving it from EXPAT_VERSION with tr.

Drops curl from base. BuildKit verifies TLS with its own trust store,
so the downloads are now authenticated rather than passing --insecure.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-27 22:46:07 -04:00
Christopher Wellons
c17ba6fb19 Fetch busybox-w32 from GitHub instead of frippery.org
The archives are identical except for .frp_describe, which is gitignored
and absent from GitHub archives. Without it the Makefile finds neither a
git checkout nor a source directory named after the tag, and the version
degrades from 1.38.0.git-6075-g169694ebd to 1.38.0.git. Recreate the
file after extraction.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-27 21:11:48 -04:00
Christopher Wellons
af35517988 Upgrade to ccache 4.14
- Windows path rewriting is now case-insensitive and Unicode-aware, and
  ignore_headers_in_manifest matches case-insensitively on Windows.
- Detects C23 #embed directives and assembler .incbin directives,
  preventing false cache hits.
- Removed the cpp_extension (CCACHE_EXTENSION) option; preprocessor
  output is now processed in memory instead of via temporary files.
- Fixed a size overflow when allocating very large files on Windows.

Both Windows console output patches were regenerated against 4.14.
2026-08-23 15:29:42 -04:00
Peter0x44
8611d4d242 Fixes for ccache output on Windows consoles
Ccache captures compiler diagnostics and writes them to the terminal
itself. Its Unix-style isatty and TERM checks do not reliably describe
Win32 console capabilities, and its byte-oriented output path cannot
preserve Unicode outside the active code page.

The color bug can be reproduced in a legacy console without virtual
terminal processing:

    printf 'int main(void) { return undeclared; }\n' > error.c
    TERM=cygwin ccache gcc -c error.c

The diagnostic contains literal escape sequences such as ?[01m?[K
instead of colored text.

The Unicode bug can be reproduced with a non-ASCII identifier:

    printf 'float π(void) { return 3; }\nvoid f(void) { float unused = π(); }\n' > unicode.c
    ccache gcc -Wall -Wextra -c unicode.c
    ccache gcc -Wall -Wextra -c unicode.c

The source line emitted by ccache renders π as mojibake on both captured
and cached diagnostic output.

Add two ccache patches. The first detects native console handles with
GetConsoleMode, enables virtual terminal processing when available, and
otherwise translates supported SGR and erase-line sequences with Win32
console APIs. Redirected output remains unchanged.

The second decodes valid UTF-8 and writes non-ASCII text to native
consoles with WriteConsoleW. ASCII, invalid UTF-8, and redirected output
retain the existing byte-oriented path.

Apply both patches when building ccache.

Fixes skeeto/w64devkit#413.
2026-08-16 15:32:43 -05:00
Christopher Wellons
1f5f751172 Upgrade to Expat 2.8.3
Security release fixing CVE-2026-72522.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-14 14:30:33 -04:00
Christopher Wellons
d0d13ce550 Drop arch-prefixed elfedit and readelf aliases
The actual tools are not included and these aliases point at nothing.
Plucked from #412.
2026-08-11 18:56:58 -04:00
Christopher Wellons
6082530e86 Bump to 2.9.1 2026-08-09 20:04:42 -04:00
Christopher Wellons
5a10dca37f Upgrade to GCC 16.2.0
All seven gcc-*/crossgcc-* patches still apply, with line offsets only.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-07 13:09:08 -04:00
Christopher Wellons
a2884c316a Upgrade to CMake 4.4.2
Per the upstream release notes: "This version made no changes to
documented features or interfaces. Some implementation updates were
made to support ecosystem changes and/or fix regressions."

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-02 19:33:04 -04:00
Christopher Wellons
1233cbea80 Upgrade to CMake 4.4.1
> The FindPython, FindPython3 modules learned to manage, on Windows
> systems, the pydebug ABI flag.
2026-07-29 09:58:11 -04:00
Christopher Wellons
c1a00cccd0 Bump to 2.9.0 2026-07-26 22:34:55 -04:00
Christopher Wellons
c05722d917 Drop libbacktrace COFF hack after bigobj changes 2026-07-26 21:12:46 -04:00
Peter0x44
d37cd99adc Drop patches Binutils 2.47 obsoleted
Binutils 2.47 includes several fixes for PE-COFF weak external fixes
from 2e2848327d8f, afec39e439ea, and 65043894aaac. The last of these
fixes GCC PR124263 so gcc-contract-violation-handler is no longer
needed.

It also includes 18ca02157d9c, which automatically promotes oversized
PE-COFF objects to BigObj. The limit was also increased to the safe
limit for regular COFF in d9d09c878e56.
2026-07-26 20:02:44 -05:00
Christopher Wellons
f0cdd55068 Upgrade to Binutils 2.47
https://lists.gnu.org/archive/html/info-gnu/2026-07/msg00006.html
2026-07-26 20:28:57 -04:00
Christopher Wellons
adadb3e9f5 Upgrade to CMake 4.4.0
The debugger breakpoint path normalization fix landed upstream (as
cmSystemTools::ToNormalizedPathOnDisk), so drop the local patch.
cmake-force-ninja.patch is still needed.

CMake 4.4.0 bundles curl 8.20.0, whose curl_setup.h now hard-errors
if _WIN32_WINNT < 0x0600. CMake's bundled copy explicitly disables
curl's CURL_TARGET_WINDOWS_VERSION option (wrapped in "if(0) XXX
not needed for build within cmake"), so the flag has to reach C
compilation directly. Add CMAKE_C_FLAGS matching the existing
CMAKE_CXX_FLAGS override.
2026-07-21 09:09:14 -04:00
Christopher Wellons
9a11bb6f53 crt: __MINGW_IMP_SYMBOL for _strtof_l and _wcstof_l
These functions are static emulations present in every libmsvcr*.a,
but the headers declare them dllimport (_CRTIMP), so callers reference
__imp__strtof_l and __imp__wcstof_l, which nothing defines, and the
link fails. Define fake import pointers alongside the definitions, as
already done for other statically-emulated functions such as
__acrt_iob_func and _initialize_onexit_table.

The _strtof_l half was merged upstream after v14.0.0 as 373c7dd0
("crt: Add missing __MINGW_IMP_SYMBOL for _strtof_l()"). The
_wcstof_l half is the same fix for the wide variant, which remains
broken upstream.
2026-07-10 20:24:08 -04:00
Christopher Wellons
9aff35afb5 Upgrade to Expat 2.8.2
Security release fixing 13 vulnerabilities.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-07-06 15:08:42 -04:00
Christopher Wellons
402c2c06eb Upgrade to Binutils 2.46.1 2026-06-08 21:53:09 -04:00
Christopher Wellons
614fe39553 Introduce most of C11 threads
Closes #388.
2026-05-25 20:53:35 -04:00
Christopher Wellons
c70b87233c Upgrade to CMake 4.3.3 2026-05-25 09:19:12 -04:00
Christopher Wellons
a208bcb70c Include aas-sign source in source.tar
dl-aas-sign was added but never added to the source-collection
stage, so the aas-sign source tarball was missing from the published
source.tar release artifact even though we now ship aas-sign.exe.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19 19:03:08 -04:00
Christopher Wellons
4c1c3bccab Upgrade to Expat 2.8.1 2026-05-16 13:46:38 -04:00
Christopher Wellons
ef29c3cbfa Upgrade to GDB 17.2
https://lists.gnu.org/archive/html/info-gnu/2026-05/msg00003.html
2026-05-16 13:46:38 -04:00
Christopher Wellons
c791bc9e02 nsis: Nudge options around to fix x86 patch
Some patch programs, including busybox-w32, won't apply the patch
otherwise.
2026-05-09 00:44:12 -04:00
Christopher Wellons
6c3bc7d550 Cross-compile aas-sign.exe for the toolchain
Adds aas-sign as a Windows binary in $PREFIX/bin/ so users can sign
their own PE outputs with Azure Trusted Signing from inside the
toolchain. Same source as build-aas-sign (the Linux helper used at
release time); on Windows aas-sign's CMakeLists uses WinHTTP + BCrypt
instead of mbedtls, so the build is self-contained.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-08 22:56:33 -04:00
Christopher Wellons
7523c6755b busybox: Swap x86 to mingw32w_defconfig (#315) 2026-05-08 22:45:45 -04:00
Christopher Wellons
75ee239be7 Add NSIS 3.12 (makensis only)
Adds a CLI-only NSIS install for compiling .nsi scripts. Skips the
GUI wizards (makensisw, the NSIS installer creator) and documentation.

Path-resolution problem: makensis at $PREFIX/bin/makensis.exe would
auto-detect NSISDIR=$PREFIX (parent dir of bin), so NSIS would look
for $PREFIX/{Include,Stubs,Plugins,...} -- collides with w64devkit's
own $PREFIX/include on Windows's case-insensitive filesystem. Solve
by installing the real makensis under $PREFIX/share/nsis/bin/, where
auto-detection lands correctly on $PREFIX/share/nsis. A small alias
EXE at $PREFIX/bin/makensis.exe (built from the existing alias.c)
exec's it. Fully relocatable, no env vars.

New stages: dl-nsis, build-nsis. SCons + python3 only inside
build-nsis (not base) to avoid cache invalidation. TARGET_ARCH
derived from $ARCH at build time so the same Dockerfile works for
x64 and x86 -- no variant-x86.patch hunk needed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-08 22:44:05 -04:00
Christopher Wellons
74bdb3a1d5 busybox: disable bash applet and bash.exe alias
The busybox-w32 mingw64u_defconfig sets CONFIG_BASH_IS_ASH=y so the
ash shell is also installed under the name "bash". That collides
with any real bash on PATH (e.g. Git for Windows). Flip the Kconfig
"choice" to BASH_IS_NONE and drop bash from the alias list. The shell
is still available as ash and as sh.

CONFIG_ASH_BASH_COMPAT etc. (bash-style features inside ash) are
unrelated and remain enabled.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-08 10:31:16 -04:00
Christopher Wellons
ba3f4a86ef Upgrade to ccache 4.13.6
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-07 13:48:36 -04:00
Christopher Wellons
7c89bcd74c Move quilt build into its own stage
quilt is the only C++20 source in the project and pulls in libstdc++
headers, so its compile takes much longer than the other ~10 -nostdlib
C utilities built inline in `final`. Splitting it out lets BuildKit
cache it independently -- it's now only rebuilt when src/quilt.cpp
itself changes, rather than on every final-stage cache miss.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-07 13:40:18 -04:00
Christopher Wellons
b79f08a16b Upgrade to busybox-w32 FRP-6075
Drop busybox-005-disable-utf8-check.patch, now handled upstream.

Add a join.exe alias for the new join applet.

busybox-w32 gained crond and crontab applets, but I have decided to
disable them. It also gained a uuidgen applet, but we already have a
more complete, more appropriate implementation.

https://frippery.org/busybox/release-notes/FRP-6075.html
2026-05-07 13:32:50 -04:00
Christopher Wellons
f80f7818b0 Bump to 2.8.0 2026-05-03 11:16:34 -04:00
Christopher Wellons
b2dd6f9971 Upgrade to Expat 2.8.0
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-03 11:14:03 -04:00