Skip to content

Conversation

@mrpippy
Copy link
Contributor

@mrpippy mrpippy commented Dec 19, 2025

  • Have you followed the guidelines for contributing?
  • Have you ensured that your commits follow the commit style guide?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Is your test running fine brew test <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>)? If this is a new formula, does it pass brew audit --new <formula>?

Add a formula for llvm-mingw-w64, providing cross-compilers targeting Windows on ARM64, ARM64EC, i686, and x86_64.
This is the combination of LLVM's compiler/linker (from the installed lld and llvm), LLVM's compiler-rt/libc++, and mingw-w64's headers/libraries/tools.

As such there isn't really a single upstream project that this represents. Martin Storsjö's llvm-mingw pioneered this combination and provides self-contained binaries for various platforms. I also used Gentoo's llvm-mingw64 ebuild as a reference, since it similarly uses an existing LLVM.

I decided to use LLVM's version number, since this formula needs to stay in-sync with the llvm formula (and is added to synced_versions_formulae.json).

This formula unfortunately conflicts with mingw-w64, since they both provide {i686,x86_64}-w64-mingw32-{addr2line,ar,as,dlltool,ld,nm,objcopy,objdump,ranlib,readelf,size,strings,strip,widl,winres} binaries. This formula should be a drop-in replacement for mingw-w64 (as much as LLVM is a drop-in replacement for GCC), just specify CC={arch}-w64-mingw32-clang instead of -gcc. It may also be necessary to specify LD={arch}-w64-mingw32-ld, unfortunately clang -print-prog-name=ld always returns /usr/bin/ld (regardless of -target or -fuse-ld=lld) and this may confuse autoconf.

I have tested this by building FEX and vkd3d, but it's very possible that building other packages will shake out more bugs.

@github-actions github-actions bot added automerge-skip `brew pr-automerge` will skip this pull request new formula PR adds a new formula to Homebrew/homebrew-core labels Dec 19, 2025
@mrpippy mrpippy force-pushed the llvm-mingw-w64 branch 3 times, most recently from 8cccfb4 to a03a79c Compare December 20, 2025 04:05
@mrpippy
Copy link
Contributor Author

mrpippy commented Dec 21, 2025

This should be successfully building and passing tests now, but I think needs the long build label added.

@chenrui333 chenrui333 requested a review from carlocab December 22, 2025 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge-skip `brew pr-automerge` will skip this pull request new formula PR adds a new formula to Homebrew/homebrew-core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant