From d78a00cc0ccc69f8e27f8e415506837d0c9f5592 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 21 Jan 2013 04:51:24 +0000 Subject: [PATCH] mkmf.rb: $extmk for symlink * lib/mkmf.rb ($extmk): traverse parent directories for the case srcdir is a symlink. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ lib/mkmf.rb | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index beec695847..44f6fcef5b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Jan 21 13:51:21 2013 Nobuyoshi Nakada + + * lib/mkmf.rb ($extmk): traverse parent directories for the case + srcdir is a symlink. + Sun Jan 20 23:55:37 2013 Nobuyoshi Nakada * marshal.c (w_object, r_object0): separate respond_to checks and diff --git a/lib/mkmf.rb b/lib/mkmf.rb index e54f6113c5..7f7d13627f 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -199,9 +199,14 @@ module MakeMakefile topdir = File.dirname(File.dirname(__FILE__)) path = File.expand_path($0) - $extmk = path[0, topdir.size+1] == topdir+"/" - $extmk &&= %r"\A(?:ext|enc|tool|test(?:/.+)?)\z" =~ File.dirname(path[topdir.size+1..-1]) - $extmk &&= true + until (dir = File.dirname(path)) == path + if File.identical?(dir, topdir) + $extmk = true if %r"\A(?:ext|enc|tool|test)\z" =~ File.basename(path) + break + end + path = dir + end + $extmk ||= false if not $extmk and File.exist?(RbConfig::CONFIG["rubyhdrdir"] + "/ruby/ruby.h") $hdrdir = CONFIG["rubyhdrdir"] $topdir = $hdrdir