Project

General

Profile

Actions

Feature #20152

open

mkmf / extconf: Add a proper way to not compile the extension

Added by byroot (Jean Boussier) 4 months ago. Updated 4 months ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:116028]

Description

Context

There are various gems that ship with a native extension as a way to speedup part of the gem, but also ship with a pure Ruby version of these methods as a fallback. So they only want to compile the extension if the platform supports it, and if not, just fallback to the slightly slower Ruby version.

Right now users rely on one of two hacks to do this. Either they create an empty Makefile, but then still depend on make being available, or publish platform specific packages without any extension in them.

Examples:

Feature

It would be very useful to have some proper first class API to skip compiling the extension.

Something like:

require "mkmf"

if RUBY_ENGINE != "ruby" || RUBY_PLATFORM.match?(/mswin/)
  skip_compilation
else
  # ...
end

cc @k0kubun (Takashi Kokubun) @headius (Charles Nutter)

Actions

Also available in: Atom PDF

Like1
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0