An MSYS2-style environment built on the winlibs GCC toolchains.
  • C 51.7%
  • Shell 35.6%
  • CMake 6.6%
  • PowerShell 6.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Michael J. Manley 2000069074 Fix fmt, sentry-native and Boost builds
- fmt (ucrt32): i686's 80-bit long double sends format_hexfloat
  through fmt's own uint128, which has no operator~; prepare() adds it.
- sentry-native (ucrt32): SENTRY_THREAD_FN expands to "static unsigned
  DWORD" for 32-bit MinGW GCC, which does not compile, and lacks the
  WINAPI CreateThread needs; prepare() makes it static DWORD WINAPI.
- Boost: Cobalt (through Asio) names Winsock only by #pragma
  comment(lib), which GCC ignores; b2 links ws2_32 and mswsock with
  find-shared-library, after the objects.

Built locally for ucrt64 and ucrt32 (fmt, spdlog, sentry-native, boost).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 09:18:36 -07:00
.forgejo/workflows Cygwin-style installer, more libraries, memory checkers, clang switch 2026-10-27 23:22:04 -07:00
cmake Cygwin-style installer, more libraries, memory checkers, clang switch 2026-10-27 23:22:04 -07:00
installer tinygettext; download-only without a root; published site list 2026-10-27 23:54:00 -07:00
recipes Fix fmt, sentry-native and Boost builds 2026-10-28 09:18:36 -07:00
scripts Toolchain with LLVM, autotools, tessdata, package revisions 2026-10-27 16:07:59 -07:00
shell Cygwin-style installer, more libraries, memory checkers, clang switch 2026-10-27 23:22:04 -07:00
.gitattributes Put make in the base package; remove comments 2026-10-26 13:25:29 -07:00
.gitignore Put make in the base package; remove comments 2026-10-26 13:25:29 -07:00
bootstrap.ps1 Put make in the base package; remove comments 2026-10-26 13:25:29 -07:00
build.sh Toolchain with LLVM, autotools, tessdata, package revisions 2026-10-27 16:07:59 -07:00
env.ps1 Cygwin-style installer, more libraries, memory checkers, clang switch 2026-10-27 23:22:04 -07:00
README.md tinygettext; download-only without a root; published site list 2026-10-27 23:54:00 -07:00
toolchain.env Toolchain with LLVM, autotools, tessdata, package revisions 2026-10-27 16:07:59 -07:00
usr-packages.in Put make in the base package; remove comments 2026-10-26 13:25:29 -07:00
usr-packages.lock Put make in the base package; remove comments 2026-10-26 13:25:29 -07:00

toolchain

An MSYS2-style environment built on the winlibs toolchains (GCC and LLVM, UCRT, POSIX threads) instead of MSYS2's own:

  • usr/ - bash and the basic Unix tools
  • ucrt64/ and ucrt32/ - the 64- and 32-bit compilers and libraries
  • ucrt64.exe / ucrt32.exe - start a shell in either
  • wtc-setup.exe - adds, removes and upgrades packages, as Cygwin's setup does

A set of common third-party libraries is compiled into both environments, static and shared libraries together, one library per .7z package.

There is no pacman and no MSYS2 install. usr/ is MSYS2's package files for bash, coreutils and friends, pinned by SHA-256 in usr-packages.lock, because a bash on Windows needs a POSIX runtime and MSYS2's (msys-2.0.dll) is that runtime. /etc, the launchers, the installer and the compilers are this project's own.

Contents

Quick start

  1. Run wtc-setup.exe from a release, keep the defaults (root C:\wtc, base and both toolchains), and add the libraries you need.

  2. Start UCRT64 from the Start menu (or C:\wtc\ucrt64.exe).

  3. Build:

    cmake -B build && cmake --build build
    

Installation

The installer is a wizard laid out like Cygwin's setup.exe:

  1. Choose A Download Source - Install from Internet, Download Without Installing, or Install from Local Directory.
  2. Select Root Install Directory - default C:\wtc (skipped for Download Without Installing, which installs nothing).
  3. Choose A Download Site (the published site list and the sites used before; add your own as a User URL) or Select Local Package Directory - for Download Without Installing, the directory to download into, then the download site.
  4. Select Packages, then Review and confirm changes.
  5. Progress, then Create Icons: Add icons to Start Menu (WTC\UCRT64, WTC\UCRT32) and Create icons on Desktop (WTC UCRT64, WTC UCRT32).

Selecting packages

  • The list is a tree as in Cygwin: All, then one row per category (Base, Toolchains, Tools, System, and Libraries for each environment) with its count. Click a category's box, or double-click it, to open it.
  • View switches to the Full, Pending, Up To Date or Not Installed lists; Search filters by name or description.
  • A package's New column (click it, right-click the row, or press Space) chooses Skip, Install or Upgrade to a version, Keep, Reinstall or Uninstall. On a category it chooses Default, Install, Reinstall or Uninstall for all of it.
  • Installing a package adds what it needs; uninstalling one offers to uninstall what needs it. A new root starts with base and both toolchains.
  • Keep holds every installed package at its version; Best (the default) upgrades whatever the source has newer.

Package sources and offline installation

The default source is the release the installer was built with (stamped in by the workflow). A wtc-index.txt beside the exe makes that folder the default instead. Otherwise the source can be a folder holding wtc-index.txt and the packages (a downloaded release, or the build's out/), or a URL: a release's download folder, or a GitHub or Forgejo (or Gitea) repository or release page, which the installer turns into one:

Source Packages from
https://<host>/<owner>/<repo> or .../releases or .../releases/latest the latest release (on Forgejo, found with /api/v1/repos/<owner>/<repo>/releases/latest)
https://<host>/<owner>/<repo>/releases/tag/<tag> that release
https://<host>/<owner>/<repo>/releases/download/<tag> that release, as it is

For a private Forgejo repository, set WTC_TOKEN to an access token with read access to it. The installer sends it only to the source's host.

The download site list comes, like Cygwin's mirror list, from a text file the installer fetches when it starts: https://code.wisesourcery.com/wiseglobalsolutions/toolchain/raw/branch/dev/url-list.txt (build-setup.sh --sites-url builds in another; the WTC_SITES_URL environment variable overrides it). One source URL per line; blank lines, # comments and anything not http(s):// are skipped. The last list fetched is kept in the registry for when the file cannot be reached, and the sites you add yourself are kept apart from it.

Download Without Installing asks for no root: it downloads the selected packages (base and both toolchains to start with), 7zr.exe and a wtc-index.txt into a local package directory - one that Install from Local Directory can use later, on a machine without the internet.

Unattended installation

As Cygwin's -q:

wtc-setup.exe -q -R C:\wtc -s https://github.com/<owner>/<repo>/releases/latest/download -P usr/meson,ucrt64/curl
wtc-setup.exe -q -R C:\wtc -s https://forgejo.example.com/<owner>/<repo> -P ucrt64/glib
wtc-setup.exe -q -R C:\wtc -x ucrt64/zstd             :: also removes what needs it
wtc-setup.exe -q -R C:\wtc -u                         :: upgrade everything installed
wtc-setup.exe -q -D -l D:\wtc-packages -P ucrt64/curl :: download only: curl and what it needs
wtc-setup.exe -q -D -l D:\wtc-packages                :: download only: base and both toolchains
wtc-setup.exe -q -D -l D:\wtc-packages -R C:\wtc      :: download only: what C:\wtc has installed
wtc-setup.exe -L -R C:\wtc                            :: list: available vs installed

The log is <root>\var\log\wtc-setup.log (none for -D without -R); the exit code is 0 on success.

Installer storage and implementation

  • Packages are checked against the index's SHA-256, cached in <root>\var\cache\wtc, and unpacked with 7zr (fetched and checked from the index's @7zr line).
  • What is installed is in <root>\etc\wtc\installed.txt, each package's file list in <root>\etc\wtc\files\. Removing a package deletes exactly its files and the folders it leaves empty - never a file another installed package has (such as a winlibs DLL a library also ships).
  • The installer runs as the user (no elevation), is per-monitor DPI aware, and remembers the root, sources and icon choices in HKCU\Software\WTC\Setup.
  • It is Win32 C (installer/: main.c, gui.c, engine.c, util.c - WinHTTP for downloads, BCrypt for SHA-256), built by installer/build-setup.sh with the ucrt64 gcc and linked statically: a ~200 KB exe that needs nothing but Windows.

Using the environment

Shell and configuration

  • ucrt64.exe opens a login bash in mintty, in $HOME (/home/<user>). ucrt32.exe is the same for 32-bit. Each has its own icon (blue 64, amber 32) and version info.
  • ucrt64.exe ARGS... runs bash --login ARGS... in the current console and directory and returns its exit code: ucrt64.exe -c "make".
  • ucrt64.ini sets variables first, one KEY=VALUE per line:
    • MSYS2_PATH_TYPE=inherit - the whole Windows PATH after /usr/bin (the default is only System32 and friends)
    • CHERE_INVOKING=1 - stay in the starting directory
    • WTC_LINK=static - see Shared or static linking
    • WTC_COMPILER=clang - see GCC or Clang

PATH is /ucrt64/bin:/usr/bin:..., so cmake, ninja and pkg-config are the environment's own, from winlibs. /etc/profile.d/wtc.sh sets CC/CXX, PKG_CONFIG_PATH, CMAKE_GENERATOR=Ninja, CMAKE_TOOLCHAIN_FILE (CMake 3.21+ reads it from the environment), ACLOCAL_PATH (/ucrt64/share/aclocal first) and TESSDATA_PREFIX (share/tessdata). So cmake -B build, meson setup build and ./configure build for the environment with no extra flags.

Shared or static linking

WTC_LINK picks which kind of library a CMake project links (see cmake/wtc-toolchain.cmake):

  • shared (default) - import libraries. Ship the DLLs from /ucrt64/bin with your program, libgcc_s_*.dll, libstdc++-6.dll and libwinpthread-1.dll among them (ntldd -R app.exe lists them).
  • static - find_library() takes only .a files and executables link with -static: one self-contained .exe. A CMake package whose config names both kinds (CURL::libcurl_static, zstd::libzstd_static, ...) still needs its static target chosen. For pkg-config, use pkgconf --static.
cmake -B build && cmake --build build                          # shared
WTC_LINK=static cmake -B build-static && cmake --build build-static
meson setup build && ninja -C build

PowerShell

Without the shell, . .\env.ps1 -Env ucrt64 [-Link static] [-Compiler clang] sets up the same for CMake in the current PowerShell session.

Choosing GCC or Clang

Each toolchain has both GCC 16 and Clang (LLVM 23) - clang, clang++, lld, lldb, clangd, clang-tidy and clang-format. Clang here targets x86_64-w64-windows-gnu (i686- in ucrt32): the same MinGW-w64 runtime and the same libstdc++ as GCC, so every library package works with either compiler, and GCC and Clang object files link together. The library packages themselves are built with GCC.

Selecting the compiler

Switch the whole environment with WTC_COMPILER=clang - in ucrt64.ini, exported in the shell before configuring, or env.ps1 -Compiler clang. The shell then sets CC=clang CXX=clang++, and the CMake toolchain file uses clang.exe / clang++.exe and links with lld.

WTC_COMPILER=clang cmake -B build-clang && cmake --build build-clang
WTC_COMPILER=clang WTC_LINK=static cmake -B build-clang-static
cmake -B build-clang -DWTC_COMPILER=clang                       # the same, as a cache variable

CMake keeps the compiler of a build directory: use a new build directory to switch, not a re-run of the old one.

Using Clang without CMake

Use clang directly:

clang++ -O2 -fuse-ld=lld -pthread main.cpp -o app.exe $(pkgconf --cflags --libs zlib)
clang++ -O2 -fuse-ld=lld -pthread -static main.cpp -o app.exe $(pkgconf --static --cflags --libs zlib)
CC=clang CXX=clang++ meson setup build-clang
  • -pthread is needed for a -static link: unlike this GCC, clang's MinGW driver does not add winpthreads, which the static libstdc++ and libgcc need. The CMake toolchain file adds it.
  • -fuse-ld=lld is optional, but GNU ld prints harmless "duplicate section has different size" warnings for clang objects in a static link.
  • PDB debug info: -g -gcodeview -fuse-ld=lld -Wl,--pdb= writes app.pdb beside app.exe, for Visual Studio, WinDbg and Sentry's Crashpad backend. Plain -g is DWARF, for gdb, lldb, heob, Dr. Memory and cpptrace.
  • No sanitizers: the toolchain ships no compiler-rt sanitizer runtimes, so -fsanitize=address does not link with either compiler. See memory checking.

Debugging crashes and memory

Crash reporting

  • Sentry Native (sentry-native) catches crashes, and anything you report, and sends them to a Sentry server: sentry.io, self-hosted Sentry, or GlitchTip. It is built with the in-process backend, because under MinGW Sentry's Crashpad backend (out-of-process minidumps) needs clang and -gcodeview .pdb files.
  • cpptrace turns a stack into function, file and line from the DWARF debug info GCC (and clang with plain -g) writes, and is safe to call from a crash handler. Use it in your own std::set_terminate or SetUnhandledExceptionFilter handler to log the trace, or to attach it to a Sentry event.

Memory checking

Neither compiler has AddressSanitizer or LeakSanitizer here (LeakSanitizer does not exist on Windows at all), so the usr packages bring two checkers that run an unmodified program. Build it with -g; both read DWARF for file and line.

heob64 -p1 ./myapp.exe args     # leaks, overflows, use-after-free, double frees (heob32 for ucrt32 programs)
drmemory -- ./myapp.exe args    # leaks, uninitialized reads, invalid accesses (32- or 64-bit)
  • heob is small and fast. It reads DWARF through dwarfstack64.dll / dwarfstack32.dll, which sit beside it in usr/bin.
  • Dr. Memory is slower and more thorough. The package is a DynamoRIO cron build, because release 2.6.0 predates fixes for current Windows 11; it lives in usr/lib/drmemory, with drmemory and drmemory.cmd in usr/bin.

CI integration

The wtc-action repository (its own project, beside this one) sets the environment up on a Windows runner the way msys2/setup-msys2 does, and gives later steps a wtc shell:

runs-on: windows-11
steps:
  - uses: https://<forgejo-host>/<owner>/wtc-action@dev
    with:
      repository: <owner>/toolchain     # this repository: its latest release
      msystem: ucrt64                   # or ucrt32, or msys (usr/ only)
      install: zlib curl usr/meson
  - shell: wtc {0}
    run: cmake -B build && cmake --build build

It installs from this repository's latest release with wtc-setup.exe -q (base, the msystem's toolchain, the packages and their dependencies), caches the downloads, and runs each wtc step as bash --login -eo pipefail in the step's directory. Inputs, outputs and details are in its README.

Package reference

Package Environment Contents
base-<date>-1-usr.7z usr the shell: usr/ (bash, coreutils, findutils, diffutils, sed, grep, gawk, which, less, ncurses, patch, make, tar, gzip, bzip2, xz, zstd, mintty, the runtime) and etc/
toolchain-16.2.0-r3-1-ucrt64.7z ucrt64 ucrt64.exe + ucrt64.ini, and winlibs x86_64: GCC 16.2.0 and LLVM 23.1.3 (clang, lld, lldb, clangd, clang-tidy, clang-format), MinGW-w64 14.0.0 UCRT, POSIX threads, SEH, and the rest of winlibs: gdb, make (mingw32-make), cmake, ninja, nasm, yasm, ccache, doxygen, cppcheck, ctags, ntldd and pkgconf (also as pkg-config)
toolchain-16.2.0-r3-1-ucrt32.7z ucrt32 ucrt32.exe + ucrt32.ini, and winlibs i686 (DWARF exceptions)
<library>-<version>-<rel>-<env>.7z ucrt64 / ucrt32 one library, static and shared: lib/libfoo.a beside lib/libfoo.dll.a, the DLL in bin/ - see Libraries
wtc-libs-<env>.7z ucrt64 / ucrt32 every library of the environment in one archive
meson-1.12.1-1-usr.7z usr the global meson in usr/bin, on an embedded Python (usr/lib/meson); meson.cmd for cmd/PowerShell. It runs the environment's ninja
openssh-…, perl-…, m4-…, flex-…, bison-…, autotools-… (usr) usr system packages from MSYS2's own builds: ssh/scp/sftp/ssh-keygen/ssh-agent, Perl, m4, flex, bison, and autotools (autoconf, automake, libtool, autoconf-archive, pkgconf's pkg.m4)
heob-4.2-1-usr.7z, drmemory-2.6.20434-1-usr.7z usr memory checkers - see Debugging
wtc-index.txt the index the installer reads
wtc-setup.exe the installer

None of the winlibs tools is duplicated in usr/. For ssh, ~/.ssh is /home/<user>/.ssh; Windows' own ssh.exe is not on the shell's PATH and does not work in mintty. pkg-config is the environment's (pkgconf), not autotools'.

Package revisions

The number after the version is the package revision (a recipe's PKGREL, or TOOLCHAIN_PKGREL / BASE_PKGREL in toolchain.env). Raising it makes a rebuild of the same upstream version a new version, so wtc-setup.exe -u and the installer's Best upgrade to it.

Package layout and relocation

Every package's paths are relative to the root (usr/..., etc/..., ucrt64/..., ucrt64.exe), so extracting packages into one folder - with the installer or plain 7-Zip - builds the environment: base and a toolchain give a working shell, and tools and libraries go on top. Their .pc and CMake files use paths relative to themselves, so the folder can be anywhere.

Library reference

Library Version Notes
zlib, xz (liblzma), zstd, LZ4 1.3.2, 5.8.4, 1.5.7, 1.10.0 compression
libarchive 3.8.10 tar, zip, 7z, cpio, ISO...; with zlib, xz, zstd and LZ4, Windows CNG for hashes
libsodium, Mbed TLS, LibreSSL, Argon2 1.0.22, 3.6.7, 4.4.0, 20190702 crypto and TLS; LibreSSL is the OpenSSL API (libcrypto, libssl, libtls)
curl 8.23.0 Schannel for TLS
SQLite, MariaDB Connector/C, libpq 3.54.1, 3.4.11, 18.6 databases; libpq is the PostgreSQL client, on LibreSSL
Lua 5.5.1
Boost 1.92.0 all but Python and MPI, built with b2; Iostreams with zlib, lzma and zstd; CMake config in lib/cmake
{fmt}, spdlog, CLI11, magic_enum, toml++ 12.2.0, 1.17.0, 2.7.2, 0.9.8, 3.4.0 formatting, logging (on the external {fmt}), command lines, enums, TOML
nlohmann/json, json-schema-validator, yaml-cpp, pugixml, libxml2, libxslt, libbson 3.12.0, 2.4.1, 0.9.0, 1.16, 2.15.4, 1.1.45, 2.5.7 data formats
libuv 1.53.0 async I/O: event loop, sockets, pipes, timers, processes
tinygettext 0.1.0-0ebef71 translations: gettext .po files read at run time, with plural forms and contexts; static only, UTF-8 .po files (no iconv). Boost.Locale also reads compiled .mo catalogs
Eigen, GLM 5.0.1, 1.0.3 linear algebra, graphics maths (header-only)
GoogleTest, Google Benchmark 1.18.0, 1.10.0 unit tests (with GoogleMock), microbenchmarks
cpptrace, libdwarf 1.0.4, 2.3.3 stack traces with file and line - see Debugging
Sentry Native 0.17.4 crash and error reporting - see Debugging
libjpeg-turbo, libpng, giflib, libwebp, libtiff, OpenJPEG 3.2.0, 1.6.59, 5.2.2, 1.6.0, 4.7.2, 2.5.4 images
Leptonica, Tesseract, tessdata-eng 1.87.0, 5.5.3, 4.1.0 OCR; tessdata-eng is the English and OSD language data, in share/tessdata
FreeType, SDL2, OpenAL Soft 2.15.0, 2.32.10, 1.25.2 fonts, media, audio
wxWidgets, wxPdfDocument 3.3.4, 1.4.0 wxWidgets without the Edge web view; release libraries only, which Debug builds use too
zint, zxing-cpp, miniz, nanosvg, Clipper2 2.16.0, 3.1.1, 3.0.2, 239e102, 2.0.1 barcodes, zip, SVG, polygon clipping
GLib, libffi, PCRE2, proxy-libintl, win-iconv 2.90.1, 3.8.0, 10.49, 0.5, 0.0.10 GLib (with GIO and GObject) and what it needs
libslirp 4.9.6 user-mode networking, on GLib
libpcap 1.10.7 packet capture, on Npcap - see Npcap requirement for libpcap

Not built here: ALSA (Linux only), OpenGL (the system's) and jbig2dec (AGPL).

Npcap requirement for libpcap

libpcap is built against the Npcap SDK: $NPCAP_SDK if set, else C:\npcap, else the pinned SDK download. The package has pcap.dll, libpcap.a and libpacket.a (an import library for Npcap's Packet.dll, made from the SDK's export list), but not Npcap itself. Programs need Npcap installed, and Packet.dll must be findable: Npcap puts it in System32\Npcap, so call SetDllDirectory() with that before pcap.dll or a static libpcap is loaded (delay-load it), or install Npcap in WinPcap API-compatible mode.

Static linking with GLib

GLib links proxy-libintl statically, so it adds no libintl-8.dll (the toolchain's own one is left alone). For a -static link use pkgconf --static: the .pc files of GLib, PCRE2 and libslirp carry the *_STATIC defines in Cflags.private.

Maintainer guide

Bootstrap the build environment

The build runs in the environment it produces. Once, from PowerShell:

powershell -File bootstrap.ps1        # or -Envs ucrt64; -ShellOnly for usr/ and etc/ only

It downloads and checks the pinned usr/ packages, 7zr and both winlibs releases into env/, installs etc/ and the CMake toolchain file, and builds the launchers (with their icons) using the new gcc and windres. Run it again after changing usr-packages.lock, shell/, cmake/ or toolchain.env.

  • With a ucrt64/ucrt32 shell open, Windows keeps bash.exe, msys-2.0.dll and that launcher locked: bootstrap then unpacks usr/ over what is there and keeps the running launcher, with a warning. Close the shells and run it again for a clean result.
  • If PowerShell will not run scripts, Unblock-File bootstrap.ps1 or Set-ExecutionPolicy -Scope CurrentUser RemoteSigned.

Build and package

Then, in env\ucrt64.exe (or ucrt32.exe), from this folder:

./scripts/package-base.sh ucrt64          # toolchain package - before any library build
./build.sh --env ucrt64 --keep-going      # every library, static and shared
./build.sh --env ucrt32 libpng            # one, plus any missing dependency
./build.sh --env ucrt64 --bundle zlib     # ...and the wtc-libs-ucrt64.7z bundle
./build.sh --env usr                      # meson, the memory checkers and the system packages into usr/
./scripts/package-base.sh usr             # the base package
./scripts/make-index.sh                   # out/wtc-index.txt from out/*.7z
./scripts/pin-hashes.sh                   # fill empty SHA-256s from the cache
./installer/build-setup.sh                # out/wtc-setup.exe (--source <url>: its default source; --sites-url <url>: its site list)

out/ is then a complete package source: point wtc-setup.exe at it. ./scripts/install-packages.sh <package>.7z... extracts packages without the installer. ./build.sh --list lists the recipes with their versions and dependencies.

Recipes

recipes/NNN-<name>.sh (libraries, for ucrt64 and ucrt32) and recipes/usr/NNN-<name>.sh (global tools and system packages) are built in NNN order. A recipe sets:

Variable Meaning
VERSION, URL, SHA256 required
DESCRIPTION the installer's text
ARCHIVE the download's file name, when the URL's is not unique
NO_EXTRACT=1 the download is a single file, copied into the source tree
DEPENDS other recipes of the same environment
TOOLS usr tools it runs, such as meson - build.sh builds any that are missing into usr/ first
ONE_PASS=1 build once: upstream makes the archive and the DLL in one configure, or the library is header-only
LICENSE_FILES licence files beyond the usual LICENSE*, COPYING*, ...
CATEGORY the installer's group (default Libraries, or Tools in usr)
PKGREL the package revision, appended to the version (1.3.2-1); default 1 - raise it to make installs upgrade to a rebuild of the same version

It defines build(), and can define prepare() (once, in the fresh source tree) and post_install() (in the stage). build() calls one of:

  • cmake_build [-S subdir] [-D...] - upstream's CMake, with BUILD_SHARED_LIBS and the toolchain file set
  • cmake_wrapper <dir> [-D...] - a CMake build from cmake/wrappers/<dir>, for upstreams without one: sqlite, lua, argon2, libsodium, giflib, nanosvg, wxpdfdoc
  • its own build (Boost runs b2; libpq runs meson), or, for a usr tool, copies of the prebuilt release into $STAGE

$SHARED / $STATIC are ON/OFF for the pass being built. A library recipe without ONE_PASS is built twice into the same stage, static then shared, so where both write the same CMake package or .pc file the shared build's copy is kept - the archives are still there for -static and .a-only lookups.

Extra downloads use the same pattern with a prefix (PYTHON_URL / PYTHON_SHA256, as meson does). A download with an empty SHA-256 is reported in the build log and out/unpinned-sha256.txt; ./scripts/pin-hashes.sh fills them in from the cache.

Updating the tools in usr/

usr/ is made of MSYS2 package files, pinned in locks:

  • usr-packages.in names the base package's MSYS2 packages -> usr-packages.lock.
  • A recipe in recipes/usr/ that sets MSYS2_PACKAGES is a system package (openssh, perl, m4, flex, bison, autotools) -> recipes/usr/NNN-<name>.lock. It needs nothing else: its version and files come from the lock, which holds the named packages and their dependencies, minus what the base and the recipe's DEPENDS (other such recipes) already have, so no two packages ship the same files. build.sh --env usr unpacks a lock into its package at the root (usr/, and etc/ - openssh brings etc/ssh/); the licences, from each MSYS2 package's metadata, go in share/licenses/<name>/MSYS2-PACKAGES.txt.

To add one, write a recipe with a DESCRIPTION, MSYS2_PACKAGES="...", CATEGORY=System and any DEPENDS. Then, in the shell, ./scripts/update-usr-packages.sh resolves every lock against MSYS2's current package index (dependencies and "provides" included, MSYS2's own filesystem left out), warning when two unrelated recipes would ship the same package - put that package in the base (as libdb and libxcrypt are) or make one recipe depend on the other. Run bootstrap.ps1 again afterwards: the build environment gets the base and every system package. Pinned package files can disappear from repo.msys2.org once superseded; updating the locks is then the fix.

Branches and release CI

Work happens on dev. .forgejo/workflows/build-packages.yml builds the whole package set:

  • a usr job: base, meson, the memory checkers and the system packages
  • one job per environment: the toolchain package first, then every library and the bundle; ucrt64 also builds wtc-setup.exe, with the release it is published in as its source
  • on a libs-* tag, or a manual run with release ticked, a release with every package, wtc-index.txt, wtc-setup.exe and SHA256SUMS.txt

A manual run can name the library recipes to build (space-separated; empty builds all). Pull requests into dev that touch the build run it too.

  • Runners are your own. Register a forgejo-runner on a Windows 11 machine in host mode, labelled windows-11 (e.g. --labels windows-11:host), with PowerShell 7 (pwsh), Node.js 20+ (the checkout, cache and artifact actions are JavaScript) and git on PATH. The release job runs on a Linux runner labelled debian-trixie (e.g. debian-trixie:docker://node:20-trixie).
  • Artifacts and releases use Forgejo's actions: code.forgejo.org/forgejo/upload-artifact@v4, .../download-artifact@v4 and code.forgejo.org/actions/forgejo-release@v2. The release uses the repository secret WTC_RELEASE_TOKEN if set (a token allowed to write releases), else the job's automatic token.
  • The installer's built-in source is the release it is published in: <server>/<owner>/<repo>/releases/download/<tag>.
  • A self-hosted runner keeps its workspace, so each job starts by clearing the previous run's env/, out/ and .work/; downloads stay in .cache/ and the runner's action cache.
  • No step summary: the package list is printed in the job log.

The workflow expects this folder to be the repository root.