From fcb58bdb3826a3ba6eaeb133313fea148d843926 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 29 Jul 2013 05:52:53 +0000 Subject: [PATCH] mkmf.rb: expand all macros * lib/mkmf.rb (xsystem): expand environment variable in all macros not expanded with RbConfig. [Bug #8702] * test/mkmf/test_framework.rb (create_framework): replace all $@ not only once. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42223 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ lib/mkmf.rb | 2 +- test/mkmf/test_framework.rb | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 07b8caf31d..7709123933 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Mon Jul 29 14:52:46 2013 Nobuyoshi Nakada + + * lib/mkmf.rb (xsystem): expand environment variable in all macros not + expanded with RbConfig. [Bug #8702] + + * test/mkmf/test_framework.rb (create_framework): replace all $@ not + only once. + Mon Jul 29 06:54:30 2013 Nobuyoshi Nakada * win32/win32.c (rb_w32_pipe): use enum for compile time constants, diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 0e78d74e1b..682eb46572 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -378,7 +378,7 @@ module MakeMakefile def xsystem command, opts = nil varpat = /\$\((\w+)\)|\$\{(\w+)\}/ if varpat =~ command - vars = Hash.new {|h, k| h[k] = ''; ENV[k]} + vars = Hash.new {|h, k| h[k] = ENV[k]} command = command.dup nil while command.gsub!(varpat) {vars[$1||$2]} end diff --git a/test/mkmf/test_framework.rb b/test/mkmf/test_framework.rb index 1b595aab7a..48e8bf7213 100644 --- a/test/mkmf/test_framework.rb +++ b/test/mkmf/test_framework.rb @@ -12,8 +12,8 @@ class TestMkmf File.write(src, "void #{fw}(void) {}") cmd = LINK_SO.dup RbConfig.expand(cmd, RbConfig::CONFIG.merge("OBJS"=>src)) - cmd.sub!("$@", "#{fwdir}/#{fw}") - cmd.sub!(/ -bundle /, ' -dynamiclib ') + cmd.gsub!("$@", "#{fwdir}/#{fw}") + cmd.gsub!(/ -bundle /, ' -dynamiclib ') assert(xsystem(cmd), MKMFLOG) $INCFLAGS << " " << "-F#{dir}".quote yield fw, hdrname