From 389157d8cfab7b6e84cdcdb2863421bd2c93bd7f Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 23 Jan 2009 05:56:01 +0000 Subject: * 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 at [ruby-core:21448]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 9 ++++++++- lib/mkmf.rb | 29 ++++++++++++++++++++++++++--- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 90062e675e..e82d2deb0e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,11 @@ -Fri Jan 23 14:36:06 2009 Nobuyoshi Nakada +Fri Jan 23 14:57:18 2009 Nobuyoshi Nakada + + * 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 at + [ruby-core:21448]. * lib/mkmf.rb (try_func): got rid of c-mode confusion. diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 0f6f61d984..9038630e2f 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -1299,6 +1299,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 = $VPATH.dup @@ -1318,9 +1341,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 = #{CONFIG["hdrdir"].quote} +srcdir = #{srcdir.gsub(/\$\((srcdir)\)|\$\{(srcdir)\}/) {mkintpath(CONFIG[$1||$2])}.quote} +topdir = #{mkintpath($extmk ? CONFIG["topdir"] : $topdir).quote} +hdrdir = #{mkintpath(CONFIG["hdrdir"]).quote} arch_hdrdir = #{$arch_hdrdir} VPATH = #{vpath.join(CONFIG['PATH_SEPARATOR'])} } -- cgit v1.2.3