New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mingw-make

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mingw-make

  • 1.2.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

When it comes to C-based extension Ruby gems on Windows, the status quo depends on the heavyweight MSYS2 to build and install them. However, Minimum GNU for Windows (MinGW), a key component of MSYS2, is sufficient for half of the jobs all on its own.

mingw-make is a set of tiny non-intrusive mods for RubyInstaller2 for Windows that solves the hurdles on the other half minimally, namely by replacing rbconfig entries of compilation commands. With the aid of the secret ruby -run capability it has unleashed, all it took was a couple of quick hacks and we have ourselves a lightweight Devkit.

Setups with MinGW and RubyInstaller’s prebuilds with these patches are ideal to keep footprints small, though experts strongly recommend WSL for a fully-fledged Ruby environment.

Compatibility

I’m glad to announce that, except for Prism for which I have sent PRs, this experiment works with gem update versions of every Default and Bundled C extension 📈.

While I have only tested this experiment with the following projects, In theory, it’s compatible with anything that doesn’t leave rbconfig+mkmf’s comfort zone, which I expect to be the majority of C-based gems. (It will indeed “take a while” when “Building native extensions”.) Please do let me know if it doesn’t meet the expectations on something not unusual.

builds
  • railties 7.1.3
    • bigdecimal 3.1.6..3.1.8
    • racc 1.7.3..1.8.0
    • io-console 0.7.2
  • json 2.7.2
  • nkf 0.2.0
  • prism 9bb8710
  • strscan 3.1.0
  • debug 1.9.2
  • rbs 3.4.4
fails
  • prism ..0.29.0:
    • It must be possible to build prism without needing ruby/rake/etc. Because once prism is the single parser in TruffleRuby, JRuby or CRuby there won't be another Ruby parser around to parse such Ruby code. […]

    The main solution for the second point seems a Makefile, otherwise many of the usages would have to duplicate the logic to build prism.

    https://github.com/ruby/prism/blob/19c67fb/docs/build_system.md#requirements

  • ffi (the platform-agnostic edition)
    • RubyGems will instead prefer the prebuilt gem once it leaves RC. For now, you can join the preview manually with gem install --prerelease ffi.
      • This transitive dependency is the last obstable before steep becomes available!

not thoroughly tested

  • syslog 0.1.2: It’s UNIX-specific.
  • readline-ext 0.2.0: extconf.rb:64:in `<main>': Neither readline nor libedit was found (RuntimeError)

Setup

Requirements

  • Windows
    • Linux need MinGW not.
  • Ruby from RubyInstaller2 without DevKit (MSYS2)
    • Does it work with other Rubies? Well… maybe?
  • MinGW for the Universal C Runtime (UCRT), with the binaries folder on the PATH
    • Will it work with MSYS? Uhh… likely not.

Installation

gem install mingw-make

Use with gem

Thanks to gem’s plugins system, it’s online out of the box!

Use with rake-compiler

Slap this somewhere in the Rakefile:

begin
  require 'mingw-make'
rescue LoadError
  # ignore
end

Use manually

Prepend (so it takes precedence) the lib/mingw-make/mkmf.rb script to the Ruby $LOAD_PATH. Because RubyGems require 'rbconfig', we must explicitly apply the rbconfig replacements.

set RUBYOPT=-Ipath/to/gems/mingw-make/lib/mingw-make/ -rrbconfig-patch

You may also need to specify a fallback for the MAKE tool, e.g.:

set MAKE=mingw32-make

How to Contribute

Ackchyually – I would much prefer you don’t, but instead forward my tinkering to their corresponding upstreams. Windows users like me would love if our chérie lang doesn’t require more (WSL) or less (MSYS) a Linux Virtual Machine. (Imagine… Ruby VM in a Linux VM in a Windows VM… 🫠) After all, the WTFPL means that I’ve decided to release my knowledge to the public domain, so no need to thank me and go bring developer happiness to its next level!

FAQs

Package last updated on 30 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc