1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/template/configure-ext.mk.tmpl
nobu 14693ba549 Escape MINIRUBY in --make-flags to extmk.rb
If MINIRUBY had arguments, which is the case of cross compiling
they wouldn't be parsed correctly and compiling would fail as a RUBY
without arguments would then be present in the Makefile's in ext/*
[ruby-core:85620] [Bug #14486] [Fix GH-1819]

Author:    Carl Hörberg <carl.hoerberg@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-19 01:45:17 +00:00

44 lines
1 KiB
Cheetah

V = 0
Q1 = $(V:1=)
Q = $(Q1:0=@)
ECHO1 = $(V:1=@:)
ECHO = $(ECHO1:0=@echo)
<%
srcdir = miniruby = script_args = nil
opt = OptionParser.new do |o|
o.on('--srcdir=SRCDIR') {|v| srcdir = v}
o.on('--miniruby=MINIRUBY') {|v| miniruby = v}
o.on('--script-args=MINIRUBY') {|v| script_args = v}
o.order!(ARGV)
end
srcdir ||= File.dirname(File.dirname(__FILE__))
exts = {}
[
["exts", "ext", "--extstatic $(EXTSTATIC)"],
["gems", "gems", "--no-extstatic"],
].each do |t, d, o|
exts[t] = [o, Dir.glob("#{srcdir}/#{d}/*/").map {|n| n[(srcdir.size+1)..-2]}]
end
%>
MINIRUBY = <%=miniruby%>
SCRIPT_ARGS = <%=script_args%>
EXTMK_ARGS = $(SCRIPT_ARGS) --gnumake=$(gnumake) --extflags="$(EXTLDFLAGS)" \
--make-flags="MINIRUBY='$(MINIRUBY)'"
all: exts gems
exts:
gems:
% exts.each do |t, (o, dirs)|
% dirs.each do |d|
<%=t%>: <%=d%>/exts.mk
<%=d%>/exts.mk: FORCE
$(Q)$(MINIRUBY) $(srcdir)/ext/extmk.rb --make='$(MAKE)' \
--command-output=$@ $(EXTMK_ARGS) <%=o%> \
-- configure $(@D)
% end
% end
.PHONY: FORCE all exts gems
FORCE: