summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-09-01 15:55:13 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-09-01 15:55:13 +0000
commitc06ec0bc3d9f5ddf5e7577303025ef208fdccab2 (patch)
treef5192495dc1236ff22aac3bb3e8749ac089fc0a8
parentcea6c9d2f548d3fea8af0d912306b271d7ec8001 (diff)
extmk.rb: fix conflict of timestamp files
* ext/extmk.rb (timestamp_file): move extmk.rb specific tricks from lib/mkmf.rb. keep RUBYCOMMONDIR prefix not to conflict with a timestamp file in the toplevel. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rwxr-xr-xext/extmk.rb12
-rw-r--r--lib/mkmf.rb2
3 files changed, 16 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 36be6d971b2..ae727c31508 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Fri Sep 2 00:55:11 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/extmk.rb (timestamp_file): move extmk.rb specific tricks
+ from lib/mkmf.rb. keep RUBYCOMMONDIR prefix not to conflict
+ with a timestamp file in the toplevel.
+
Thu Sep 1 14:24:16 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/extmk.rb (gems): move dirty hacks for bundled gems from
diff --git a/ext/extmk.rb b/ext/extmk.rb
index 0a7c589063f..2f320a6737c 100755
--- a/ext/extmk.rb
+++ b/ext/extmk.rb
@@ -548,6 +548,12 @@ gems = Dir.glob(File.join(ext_prefix, ($extension || ''), '**/extconf.rb')).coll
with_config(ext, &cond)
}.sort
+extend Module.new {
+ def timestamp_file(name, target_prefix = nil)
+ super.sub(%r[/\.extout\.(?:-\.)?], '/.')
+ end
+}
+
dir = Dir.pwd
FileUtils::makedirs('ext')
Dir::chdir('ext')
@@ -570,7 +576,7 @@ Dir.chdir('gems')
extout = $extout
unless gems.empty?
def self.timestamp_file(name, target_prefix = nil)
- name = @sodir if name == '$(TARGET_SO_DIR)'
+ name = "$(arch)/gems/#{@gemname}" if name == '$(TARGET_SO_DIR)'
super
end
@@ -578,7 +584,7 @@ unless gems.empty?
super(*args) do |conf|
conf.find do |s|
s.sub!(/^(TARGET_SO_DIR *= *)\$\(RUBYARCHDIR\)/) {
- $1 + @sodir
+ "#{$1}$(extout)/gems/$(arch)/#{@gemname}"
}
end
conf << %{
@@ -598,7 +604,7 @@ $(build_complete): $(TARGET_SO)
end
gems.each do |d|
$extout = extout.dup
- @sodir = "$(extout)/gems/$(arch)/#{d[%r{\A[^/]+}]}"
+ @gemname = d[%r{\A[^/]+}]
extmake(d, 'gems')
end
$extout = extout
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 8eb2b29ba53..53f9fd96fa4 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -2025,9 +2025,9 @@ preload = #{defined?($preload) && $preload ? $preload.join(' ') : ''}
pat[n] = $` if /\$\(target_prefix\)\z/ =~ d
end
name = name.gsub(/\$\((#{pat.keys.join("|")})\)/) {pat[$1]+target_prefix}
- name.sub!(/\A\$\((?:extout|RUBYCOMMONDIR)\)\/*/, '')
name.sub!(/(\$\((?:site)?arch\))\/*/, '')
arch = $1 || ''
+ name.chomp!('/')
name = name.gsub(/(\$[({]|[})])|(\/+)|[^-.\w]+/) {$1 ? "" : $2 ? ".-." : "_"}
File.join("$(TIMESTAMP_DIR)", arch, "#{name.sub(/\A(?=.)/, '.')}.time")
end