ruby-changes:24965
From: nobu <ko1@a...>
Date: Sun, 23 Sep 2012 21:53:50 +0900 (JST)
Subject: [ruby-changes:24965] nobu:r37017 (trunk): mkmf.rb: unspace
nobu 2012-09-23 21:52:01 +0900 (Sun, 23 Sep 2012) New Revision: 37017 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=37017 Log: 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] Modified files: trunk/ChangeLog trunk/lib/mkmf.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 37016) +++ ChangeLog (revision 37017) @@ -1,5 +1,9 @@ -Sun Sep 23 21:48:08 2012 Nobuyoshi Nakada <nobu@r...> +Sun Sep 23 21:51:59 2012 Nobuyoshi Nakada <nobu@r...> + * lib/mkmf.rb (String#unspace): unescape with backslashes. normal + makes need to escape spaces with backslashes. nmake is not the + case. [Bug #7036] + * lib/mkmf.rb (create_makefile): use timestamp file dependencies for directories. Index: lib/mkmf.rb =================================================================== --- lib/mkmf.rb (revision 37016) +++ lib/mkmf.rb (revision 37017) @@ -12,6 +12,11 @@ /\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 @@ #### 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 @@ 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/