[前][次][番号順一覧][スレッド一覧]

ruby-changes:10205

From: nobu <ko1@a...>
Date: Fri, 23 Jan 2009 14:56:20 +0900 (JST)
Subject: [ruby-changes:10205] Ruby:r21749 (ruby_1_8, trunk): * lib/mkmf.rb (mkintpath): new function which converts native path

nobu	2009-01-23 14:56:01 +0900 (Fri, 23 Jan 2009)

  New Revision: 21749

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=21749

  Log:
    * 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].

  Modified files:
    branches/ruby_1_8/ChangeLog
    branches/ruby_1_8/lib/mkmf.rb
    trunk/ChangeLog
    trunk/lib/mkmf.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 21748)
+++ ChangeLog	(revision 21749)
@@ -1,5 +1,12 @@
-Fri Jan 23 14:36:06 2009  Nobuyoshi Nakada  <nobu@r...>
+Fri Jan 23 14:57:18 2009  Nobuyoshi Nakada  <nobu@r...>
 
+	* 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].
+
 	* lib/mkmf.rb (try_func): got rid of c-mode confusion.
 
 Fri Jan 23 13:26:45 2009  Nobuyoshi Nakada  <nobu@r...>
Index: lib/mkmf.rb
===================================================================
--- lib/mkmf.rb	(revision 21748)
+++ lib/mkmf.rb	(revision 21749)
@@ -1299,6 +1299,29 @@
   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 @@
 
 #### 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'])}
 }
Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 21748)
+++ ruby_1_8/ChangeLog	(revision 21749)
@@ -1,5 +1,12 @@
-Fri Jan 23 14:36:06 2009  Nobuyoshi Nakada  <nobu@r...>
+Fri Jan 23 14:57:18 2009  Nobuyoshi Nakada  <nobu@r...>
 
+	* 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].
+
 	* lib/mkmf.rb (try_func): got rid of c-mode confusion.
 
 Thu Jan 22 12:19:29 2009  Nobuyoshi Nakada  <nobu@r...>
Index: ruby_1_8/lib/mkmf.rb
===================================================================
--- ruby_1_8/lib/mkmf.rb	(revision 21748)
+++ ruby_1_8/lib/mkmf.rb	(revision 21749)
@@ -1242,6 +1242,29 @@
   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 @@
 
 #### 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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]