Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 11 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name: ci

jobs:
lint-unit:
uses: sous-chefs/.github/.github/workflows/lint-unit.yml@5.0.8
uses: sous-chefs/.github/.github/workflows/lint-unit.yml@6.0.0
permissions:
actions: write
checks: write
Expand All @@ -18,32 +18,28 @@ jobs:

integration:
needs: lint-unit
runs-on: windows-2025
runs-on: windows-latest
strategy:
matrix:
os:
- "windows-2019"
suite:
- "tools32"
- "tools64"
- "msys2-tools64"
- default
- tools32
- tools64
- msys2-tools64
fail-fast: false
steps:
- name: Check out code
uses: actions/checkout@v5
- name: Install Chef
uses: actionshub/chef-install@main
- name: test-kitchen
uses: actionshub/test-kitchen@main
- name: Install Cinc Workstation
uses: sous-chefs/.github/.github/actions/install-workstation@6.0.0
- name: Test Kitchen
run: kitchen test ${{ matrix.suite }}
env:
CHEF_LICENSE: accept-no-persist
KITCHEN_LOCAL_YAML: kitchen.exec.yml
with:
suite: ${{ matrix.suite }}
os: ${{ matrix.os }}

final:
runs-on: ubuntu-latest
needs: [integration]
steps:
- run: echo ${{needs.integration.outputs}}
- run: echo Done
5 changes: 4 additions & 1 deletion .github/workflows/prevent-file-change.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ name: prevent-file-change
- edited
- synchronize

permissions:
pull-requests: write

jobs:
prevent-file-change:
uses: sous-chefs/.github/.github/workflows/prevent-file-change.yml@5.0.8
uses: sous-chefs/.github/.github/workflows/prevent-file-change.yml@6.0.0
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ permissions:

jobs:
release:
uses: sous-chefs/.github/.github/workflows/release-cookbook.yml@5.0.8
uses: sous-chefs/.github/.github/workflows/release-cookbook.yml@6.0.0
secrets:
token: ${{ secrets.PORTER_GITHUB_TOKEN }}
supermarket_user: ${{ secrets.CHEF_SUPERMARKET_USER }}
supermarket_key: ${{ secrets.CHEF_SUPERMARKET_KEY }}
slack_bot_token: ${{ secrets.SLACK_BOT_TOKEN }}
slack_channel_id: ${{ secrets.SLACK_CHANNEL_ID }}
1 change: 1 addition & 0 deletions .markdownlint-cli2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ config:
maximum: 2
ignores:
- .github/copilot-instructions.md
- .windsurf/**
9 changes: 0 additions & 9 deletions Berksfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
def fixture(name)
cookbook "mingw_#{name}", path: "test/fixtures/cookbooks/mingw_#{name}"
end

source 'https://supermarket.chef.io'

metadata

group :integration do
fixture 'tdm_install'
fixture 'msys2_install'
end
34 changes: 34 additions & 0 deletions LIMITATIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Limitations

## Package Availability

This cookbook manages Windows toolchains. It does not use APT, DNF/YUM, or Zypper package repositories.

### MSYS2

* MSYS2 pre-built packages currently require 64-bit Windows 10 or Windows Server 2016 or later.
* The MSYS2 GUI installer currently requires 64-bit Windows 10 1809 or Windows Server 2019 or later.
* MSYS2 still publishes `x86_64` base archives from `https://repo.msys2.org/distrib/x86_64/`.
* 32-bit Windows MSYS2 archives are no longer actively supported.
* The `MINGW32` and `MINGW64` environments can still target Windows 7 and later, but running current MSYS2 packages requires a newer host OS.

### MinGW and TDM-GCC

* `mingw_get` and `mingw_tdm_gcc` install legacy SourceForge-hosted archives.
* TDM-GCC 5.1.0 artifacts are from 2015 and should be treated as legacy compatibility tooling.
* The cookbook only supports the TDM-GCC archive checksums already encoded in the resource.

## Architecture Limitations

* The MSYS2 default base archive used by this cookbook is `x86_64`.
* `msys2_package` package names decide whether 32-bit or 64-bit MinGW packages are installed inside the MSYS2 root.
* `mingw_tdm_gcc` supports the existing `:sjlj_32` and `:seh_sjlj_64` flavors only.

## Source/Compiled Installation

This cookbook installs pre-built toolchain archives and packages. It does not build MinGW, MSYS2, or TDM-GCC from source.

## Known Issues

* Windows Server 2012 R2 is no longer a suitable default test target. Microsoft regular support ended on October 10, 2023, and MSYS2 dropped active support for Windows 8.1 / Windows Server 2012 R2 on February 28, 2026.
* `mingw_get` and `mingw_tdm_gcc` rely on old SourceForge URLs. They remain for compatibility but MSYS2 should be preferred for new installs.
32 changes: 19 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,58 @@
# mingw Cookbook

Installs a mingw/msys based compiler tools chain on windows. This is required for compiling C software from source.
Installs MinGW / MSYS2 / TDM-GCC compiler toolchains on Windows. Use it to bootstrap a C/C++ build environment for software that needs to be compiled from source.

## Requirements

### Platforms

- Windows
- Windows Server 2019, 2022, 2025 (or equivalent client SKUs)

### Chef

- Chef 15.3+
- Chef Infra Client 16+

### Cookbooks

- seven_zip
None.

## Upgrading from 4.x

The 4.x line shipped a `mingw::default` recipe and `node['msys2']` attributes. Both have been removed in favor of resource properties. See [migration.md](./migration.md) for a step-by-step upgrade guide.

## Usage

Add this cookbook as a dependency to your cookbook in its `metadata.rb` and include the default recipe in one of your recipes.
Add the cookbook as a dependency:

```ruby
# metadata.rb
depends 'mingw'
```

Then call any of the resources from your own recipes — there is no recipe to include.

```ruby
# your recipe.rb
include_recipe 'mingw::default'
msys2_package 'base-devel' do
root 'C:\msys2'
end
```

Use the `msys2_package` resource in any recipe to fetch msys2 based packages. Use the `mingw_get` resource in any recipe to fetch mingw packages. Use the `mingw_tdm_gcc` resource to fetch a version of the TDM GCC compiler.
By default, prefer the MSYS2 packages: they are newer and better supported.

By default, you should prefer the msys2 packages as they are newer and better supported. C/C++ compilers on windows use various different exception formats and you need to pick the right one for your task. In the 32-bit world, you have SJLJ (set-jump/long-jump) based exception handling and DWARF-2 (shortened to DW2) based exception handling. SJLJ produces code that can happily throw exceptions across stack frames of code compiled by MSVC. DW2 involves more extensive metadata but produces code that cannot unwind MSVC generated stack-frames - hence you need to ensure that you don't have any code that throws across a "system call". Certain languages and runtimes have specific requirements as to the exception format supported. As an example, if you are building code for Rust, you will probably need a modern gcc from msys2 with DW2 support as that's what the panic/exception formatter in Rust depends on. In a 64-bit world, you may still use SJLJ but compilers all commonly support SEH (structured exception handling).
C/C++ compilers on Windows use different exception formats and you need to pick the one your build expects. In 32-bit, you have SJLJ (set-jump/long-jump) and DWARF-2 (DW2). SJLJ can throw across MSVC-built stack frames; DW2 cannot. Some toolchains require a specific format — for example, Rust needs a modern gcc from MSYS2 with DW2. In 64-bit you can still use SJLJ but compilers commonly support SEH (structured exception handling) too.

Of course, to further complicate matters, different versions of different compilers support different exception handling. The default compilers that come with mingw_get are 32-bit only compilers and support DW2\. The TDM compilers come in 3 flavors: a 32-bit only version with SJLJ support, a 32-bit only version with DW2 support and a "multilib" compiler which supports only SJLJ in 32-bit mode but can produce 64-bit SEH code. The standard library support varies drastically between these various compiler flavors (even within the same version). In msys2, you can install a mingw-w64 based compilers for either 32-bit DW2 support or 64-bit SEH support. If all this hurts your brain, I can only apologize.
The compilers shipped via `mingw_get` are 32-bit DW2. TDM-GCC ships in three flavors: 32-bit SJLJ, 32-bit DW2, and a multi-lib that builds 64-bit SEH and 32-bit SJLJ. MSYS2 lets you install mingw-w64 toolchains for either 32-bit DW2 or 64-bit SEH.

## Resources

- [minw_get](./documentation/mingw_get.md)
- [mingw_get](./documentation/mingw_get.md)
- [mingw_tdm_gcc](./documentation/mingw_tdm_gcc.md)
- [msys2_package](./documentation/msys2_package.md)

## License & Authors

**Author:** Cookbook Engineering Team ([cookbooks@chef.io](mailto:cookbooks@chef.io))

**Copyright:** 2009-2016, Chef Software, Inc.
**Author:** Sous Chefs ([help@sous-chefs.org](mailto:help@sous-chefs.org))

```text
Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
3 changes: 0 additions & 3 deletions attributes/default.rb

This file was deleted.

18 changes: 11 additions & 7 deletions documentation/mingw_get.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
# mingw_get

Manages legacy MinGW packages from SourceForge using `mingw-get.exe`. Prefer `msys2_package` for new installs; `mingw_get` exists for compatibility with legacy toolchains and is required by `mingw_tdm_gcc` in 32-bit mode.

## Actions

- `:install` - Installs a mingw package from sourceforge using mingw-get.exe.
- `:remove` - Uninstalls a mingw package.
- `:upgrade` - Upgrades a mingw package (even to a lower version).
- `:install` - Installs the named mingw-get package. Default action.
- `:remove` - Uninstalls the named mingw-get package.
- `:upgrade` - Upgrades the named mingw-get package (may downgrade).

## Parameters
## Properties

- `package` - A mingw-get package (or meta-package) to fetch and install. You may use a legal package wild-card pattern here if you are installing. This is the name attribute.
- `root` - The root directory where msys and mingw tools will be installed. This directory must not contain any spaces in order to pacify old posix tools and most Makefiles.
- `package` - A mingw-get package or meta-package. Wildcards are accepted. This is the name attribute.
- `root` - The directory where MinGW/MSYS will be installed. Must not contain spaces.
- `source_url` - URL to the `mingw-get` archive. Defaults to the SourceForge mirror that the cookbook ships with.
- `checksum` - SHA-256 checksum of the `mingw-get` archive.

## Examples

To get the core msys developer tools in `C:\mingw32`
Install the core MSYS developer tools at `C:\mingw32`:

```ruby
mingw_get 'msys-base=2013072300-msys-bin.meta' do
Expand Down
33 changes: 27 additions & 6 deletions documentation/mingw_tdm_gcc.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,43 @@
# mingw_tdm_gcc

Installs a TDM-GCC compiler toolchain on Windows. Provides a compiler only — pair with `mingw_get` (or `msys2_package`) for support tools (`make`, `grep`, `awk`, `bash`, etc.).

## Actions

- `:install` - Installs the TDM compiler toolchain at the given path. This only gives you a compiler. If you need any support tooling such as make/grep/awk/bash etc., see `mingw_get`.
- `:install` - Downloads and extracts the TDM-GCC archives at `root`. Default action.
- `:remove` - Recursively deletes the install root.

## Parameters
## Properties

- `flavor` - Either `:sjlj_32` or `:seh_sjlj_64`. TDM-64 is a 32/64-bit multi-lib "cross-compiler" toolchain that builds 64-bit by default. It uses structured exception handling (SEH) in 64-bit code and setjump-longjump exception handling (SJLJ) in 32-bit code. TDM-32 only builds 32-bit binaries and uses SJLJ.
- `root` - The root directory where compiler tools and runtime will be installed. This directory must not contain any spaces in order to pacify old posix tools and most Makefiles.
- `version` - The version of the compiler to fetch and install. This is the name attribute. Currently, '5.1.0' is supported.
- `flavor` - Either `:sjlj_32` or `:seh_sjlj_64`. The 64-bit flavor is a multi-lib cross-compiler that defaults to 64-bit output and uses SEH for 64-bit code; SJLJ for any 32-bit code it produces. The 32-bit flavor only builds 32-bit binaries and uses SJLJ.
- `root` - The install root. Must not contain spaces.
- `version` - The TDM-GCC version. Currently only `'5.1.0'` is supported. This is the name attribute.

## Examples

To get the 32-bit TDM GCC compiler in `C:\mingw32`
Install the 32-bit TDM-GCC compiler at `C:\mingw32`:

```ruby
mingw_tdm_gcc '5.1.0' do
flavor :sjlj_32
root 'C:\mingw32'
end
```

Install the 64-bit TDM-GCC compiler at `C:\mingw64`:

```ruby
mingw_tdm_gcc '5.1.0' do
flavor :seh_sjlj_64
root 'C:\mingw64'
end
```

Remove a TDM-GCC install (deletes the entire `root` tree):

```ruby
mingw_tdm_gcc '5.1.0' do
root 'C:\mingw64'
action :remove
end
```
42 changes: 31 additions & 11 deletions documentation/msys2_package.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,47 @@
# msys2_package

- ':install' - Installs an msys2 package using pacman.
- ':remove' - Uninstalls any existing msys2 package.
- ':upgrade' - Upgrades the specified package using pacman.
Manages MSYS2 packages on Windows. The first call against a given `root` bootstraps the MSYS2 base file system at that path; subsequent calls reuse it.

All options also automatically attempt to install a 64-bit based msys2 base file system at the root path specified. Note that you probably won't need a "32-bit" msys2 unless you are actually on a 32-bit only platform. You can still install both 32 and 64-bit compilers and libraries in a 64-bit msys2 base file system.
## Actions

## Attributes
- `:install` - Installs the named MSYS2 package via `pacman -S --needed --noconfirm`. Default action.
- `:remove` - Uninstalls the named MSYS2 package via `pacman -R --noconfirm`.
- `:upgrade` - Upgrades the named MSYS2 package (and all dependencies — pacman) via `pacman -Syu --noconfirm`.

- `node['msys2']['url']` - overrides the url from which to download the package.
- `node['msys2']['checksum']` - overrides the checksum used to verify the downloaded package.
All actions automatically install the 64-bit MSYS2 base file system at `root` if it is not already present. You will not normally need a 32-bit MSYS2 base; you can still install both 32-bit and 64-bit compilers and libraries from inside a 64-bit base.

## Parameters
## Properties

- `package` - An msys2 pacman package (or meta-package) to fetch and install. You may use a legal package wild-card pattern here if you are installing. This is the name attribute.
- `root` - The root directory where msys2 tools will be installed. This directory must not contain any spaces in order to pacify old posix tools and most Makefiles.
- `package` - The pacman package (or meta-package) name. Wildcards are accepted by pacman. This is the name attribute.
- `root` - The directory where the MSYS2 base file system lives (and where `pacman` runs). Must not contain spaces.
- `source_url` - URL to the MSYS2 base archive. Defaults to the SourceForge `msys2-base-x86_64-20160205.tar.xz` mirror that the cookbook ships with.
- `checksum` - SHA-256 checksum of the base archive. Must match `source_url`.

## Examples

To get the core msys2 developer tools in `C:\msys2`
Install the `base-devel` meta-package using the bundled MSYS2 base archive:

```ruby
msys2_package 'base-devel' do
root 'C:\msys2'
end
```

Pin the cookbook to a custom MSYS2 base archive:

```ruby
msys2_package 'base-devel' do
root 'C:\msys2'
source_url 'https://example.test/msys2-base-x86_64.tar.xz'
checksum 'abc123...'
end
```

Remove a package:

```ruby
msys2_package 'base-devel' do
root 'C:\msys2'
action :remove
end
```
Loading
Loading