8000 Mkmf with space by nobu · Pull Request #185 · ruby/ruby · GitHub
[go: up one dir, main page]

Skip to content

Mkmf with space #185

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
10000
Diff view
Prev Previous commit
mkmf.rb: unspace
* lib/mkmf.rb (String#unspace): unescape with backslashes.  normal
  makes need to escape spaces with backslashes.  nmake is not the
  case.
  • Loading branch information
nobu committed Sep 21, 2012
commit 1357c65f90a03e0af9d9c91d7714d62b641c53fa
15 changes: 10 additions & 5 deletions lib/mkmf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ def quote
/\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")
Expand Down Expand Up @@ -1723,7 +1728,7 @@ def mkintpath(path)
end
unless defined?(mkintpath)
def mkintpath(path)
path
path.unspace
end
end

Expand Down Expand Up @@ -1751,9 +1756,9 @@ def configuration(srcdir)

#### 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])}}
topdir = #{mkintpath($extmk ? CONFIG["topdir"] : $topdir)}
hdrdir = #{mkintpath(CONFIG["hdrdir"])}
arch_hdrdir = #{$arch_hdrdir.quote}
VPATH = #{vpath.join(CONFIG['PATH_SEPARATOR'])}
}
Expand All @@ -1765,7 +1770,7 @@ def configuration(srcdir)
end
CONFIG.each do |key, var|
next unless /prefix$/ =~ key
mk << "#{key} = #{with_destdir(var)}\n"
mk << "#{key} = #{with_destdir(var).unspace}\n"
end
CONFIG.each do |key, var|
next if /^abs_/ =~ key
Expand Down
0