diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-09-23 12:52:01 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-09-23 12:52:01 +0000 |
commit | aed254f314b9c2bdae46d34dd17300cadace3907 (patch) | |
tree | b8eb599e14c434f28f513c8953ca3edf54743ec5 /lib | |
parent | ba3d6005837aab1815131512ca4918f17ee12d07 (diff) | |
download | ruby-aed254f314b9c2bdae46d34dd17300cadace3907.tar.gz |
mkmf.rb: unspace
* lib/mkmf.rb (String#unspace): unescape with backslashes. normal
makes need to escape spaces with backslashes. nmake is not the
case. [Bug #7036]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mkmf.rb | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/mkmf.rb b/lib/mkmf.rb index a01d317756..b77e7da231 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -12,6 +12,11 @@ class String /\s/ =~ self ? "\"#{self}\"" : "#{self}" end + # Escape whitespaces for Makefile. + def unspace + gsub(/\s/, '\\\\\\&') + end + # Generates a string used as cpp macro name. def tr_cpp strip.upcase.tr_s("^A-Z0-9_*", "_").tr_s("*", "P") @@ -1749,9 +1754,9 @@ ECHO = $(ECHO1:0=@echo) #### Start of system configuration section. #### #{"top_srcdir = " + $top_srcdir.sub(%r"\A#{Regexp.quote($topdir)}/", "$(topdir)/") if $extmk} -srcdir = #{srcdir.gsub(/\$\((srcdir)\)|\$\{(srcdir)\}/) {mkintpath(CONFIG[$1||$2])}.quote} -topdir = #{mkintpath($extmk ? CONFIG["topdir"] : $topdir).quote} -hdrdir = #{mkintpath(CONFIG["hdrdir"]).quote} +srcdir = #{srcdir.gsub(/\$\((srcdir)\)|\$\{(srcdir)\}/) {mkintpath(CONFIG[$1||$2]).unspace}} +topdir = #{mkintpath($extmk ? CONFIG["topdir"] : $topdir).unspace} +hdrdir = #{mkintpath(CONFIG["hdrdir"]).unspace} arch_hdrdir = #{$arch_hdrdir.quote} VPATH = #{vpath.join(CONFIG['PATH_SEPARATOR'])} } @@ -1762,9 +1767,9 @@ VPATH = #{vpath.join(CONFIG['PATH_SEPARATOR'])} if destdir = prefix[$dest_prefix_pattern, 1] mk << "\nDESTDIR = #{destdir}\n" end - mk << "prefix = #{with_destdir(prefix)}\n" + mk << "prefix = #{with_destdir(prefix).unspace}\n" CONFIG.each do |key, var| - mk << "#{key} = #{with_destdir(mkintpath(var))}\n" if /.prefix$/ =~ key + mk << "#{key} = #{with_destdir(mkintpath(var)).unspace}\n" if /.prefix$/ =~ key end CONFIG.each do |key, var| next if /^abs_/ =~ key |