Project

General

Profile

Actions

Feature #15914

open

mkmf without libruby

Added by glebm (Gleb Mazovetskiy) over 5 years ago. Updated over 5 years ago.

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

Description

It would be nice to be able to use mkmf without libruby.

Motivating use-case:
Many gems provide Ruby bindings to C ABI via Ruby FFI instead of libruby.
This is because Ruby FFI is easier to use, is compatible with JRuby out-of-the-box, and allows binding to system libraries without compilation.

I currently use the following set of hacks to stop mkmf from including libruby:

ext/extconf.rb:

# Don't link libruby.
$LIBRUBYARG = nil

# Disable .def file generation for mingw, as it defines an
# `Init_libsass` export which we don't have.
MakeMakefile.send(:remove_const, :EXPORT_PREFIX)
MakeMakefile::EXPORT_PREFIX = nil

ext/depend:

# Replaces default mkmf dependencies. Default mkmf dependencies include all libruby headers.
# We don't need libruby and some of these headers are missing on JRuby (breaking compilation there).
$(OBJS): $(HDRS)

(full example: https://github.com/sass/sassc-ruby/tree/master/ext)

It'd be nice to have mkmf support for this without hacks.

Actions #1

Updated by glebm (Gleb Mazovetskiy) over 5 years ago

  • Description updated (diff)

Updated by shevegen (Robert A. Heiler) over 5 years ago

It took me a moment to understand what you mean; I first misread it as "not
depending on mkmf".

I guess the intention for your change is to have more more flexibility; if
this is the case then personally I think this may be a useful change. May
be best to see what nobu and others from the core team think about your
suggestion.

Actions #3

Updated by glebm (Gleb Mazovetskiy) over 5 years ago

  • Description updated (diff)
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0