summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-23 05:56:01 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-23 05:56:01 +0000
commit36144c4fa6a400222dfb00d25a9897e1d4a4cc6c (patch)
treec6ca8b65991c46ed3d19d324b6f9cd1d76ad9c53 /lib
parent1190cc82ca62b89dd91722136b7b6b2ae6a448d5 (diff)
* lib/mkmf.rb (mkintpath): new function which converts native path
to format acceptable in Makefile. * lib/mkmf.rb (configuration): convers srcdir, topdir and hdrdir. a patch by Alexey Borzenkov <snaury AT gmail.com> at [ruby-core:21448]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@21749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/mkmf.rb29
1 files changed, 26 insertions, 3 deletions
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 28c9dc44d8..ac47b56f89 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -1242,6 +1242,29 @@ def winsep(s)
s.tr('/', '\\')
end
+# Converts native path to format acceptable in Makefile
+#
+# Internal use only.
+#
+if !CROSS_COMPILING
+ case CONFIG['build_os']
+ when 'mingw32'
+ def mkintpath(path)
+ # mingw uses make from msys and it needs special care
+ # converts from C:\some\path to /C/some/path
+ path = path.dup
+ path.tr!('\\', '/')
+ path.sub!(/\A([A-Za-z]):(?=\/)/, '/\1')
+ path
+ end
+ end
+end
+unless defined?(mkintpath)
+ def mkintpath(path)
+ path
+ end
+end
+
def configuration(srcdir)
mk = []
vpath = %w[$(srcdir) $(topdir) $(hdrdir)]
@@ -1260,9 +1283,9 @@ SHELL = /bin/sh
#### Start of system configuration section. ####
#{"top_srcdir = " + $top_srcdir.sub(%r"\A#{Regexp.quote($topdir)}/", "$(topdir)/") if $extmk}
-srcdir = #{srcdir.gsub(/\$\((srcdir)\)|\$\{(srcdir)\}/) {CONFIG[$1||$2]}.quote}
-topdir = #{($extmk ? CONFIG["topdir"] : $topdir).quote}
-hdrdir = #{$extmk ? CONFIG["hdrdir"].quote : '$(topdir)'}
+srcdir = #{srcdir.gsub(/\$\((srcdir)\)|\$\{(srcdir)\}/) {mkintpath(CONFIG[$1||$2])}.quote}
+topdir = #{mkintpath($extmk ? CONFIG["topdir"] : $topdir).quote}
+hdrdir = #{$extmk ? mkintpath(CONFIG["hdrdir"]).quote : '$(topdir)'}
VPATH = #{vpath.join(CONFIG['PATH_SEPARATOR'])}
}
if $extmk