My experimental port of Homebrew to Windows.
(Note: homebrew-mingw is an old repo and should not be used anymore)
brew commands that work: info list create install remove link unlink audit search --config
See further down for packages that build.
Porting Homebrew itself
Main pain points when porting Homebrew to Windows:
- References to the 'MacOS' classes, to the XCode toolchain, to 'xcrun' are irrelevant
- For example, something like 'MacOS.locate' doesn't belong in MacOS. It belongs in 'utils.rb' with 'which', imho.
- ':' is the path separator magic constant in the homebrew codebase - on MRI for Windows, ';' is the path separator
- fork() is not available on Windows, I'm using a Process.spawn() based logic instead
- I have no idea if using Process.spawn has significant downsides compared to the current macbrew logic - does it mess up ENV?
- Process.spawn only works with executables, but we launch shell scripts as well - sometimes an explicit 'sh' is needed
- In a MinGW environment, some executables don't have '.exe'. Ruby's pathname module will report them as non-executable, but they are
- Different library/executable extensions, e.g. '.dll', '.lib', '.exe', etc. (in cellar checks)
- 'brew doctor' would really be useful on Windows as well, can it be split up like 'os/hardware' is?
- Many executables referred through their complete paths, e.g. '/usr/bin/curl' - why not use locate/which/plain name?
- readlink doesn't exist on Windows, it's being called in 'brew search'
Compared to Linux & Windows, OSX has a ton of built-ins, which makes it harder for macbrew to make sure they're out of the path if outdated, or keg-only if installed from formulas, but often on Windows you have nothing, so dependencies like zlib and openssl are not optional.
Main pain points when porting formulas, so far:
- openssl formula copies OSX certs - obviously non-existent on Windows
- some packages have a Makefile.win32 or Makefile.m32, but that doesn't fit with the brew style
- example for above: curl has Makefile.m32 but it doesn't install - had to find a way to make the Unix way work (autotools)
- it's hard to disable optimizations - 'env :std' does not seem to do anything, curl's configure will fail with optimizations
Otherwise, pretty much a breeze :)
Old (macbrew) formulas that build
- readline => libreadline (Reason: Ruby has a 'Readline' class since 1.9.3, so the original formula doesn't work)
New (winbrew-specific formulas)
- zsh (Don't think we'll ever get this one to work.. there's WinZsh but it's an antique - it asks for termio.h / termios.h or sgtty.h)
- mercurial (Python native modules compilation fails + some python tests from Homebrew fail too)