summaryrefslogtreecommitdiff
path: root/ext/extmk.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-17 14:14:44 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-17 14:14:44 (GMT)
commit9839d82d1efe7466b0a9dc8f1d3a86f1ef5e332b (patch)
tree69a1062ea08ead0edb403452025dbe6ed18b4c1d /ext/extmk.rb
parent39e3db3510066d259d3a22d1179d7178a8e77de3 (diff)
gem extensions
* ext/extmk.rb: build gem extensions into separate directories * tool/rbinstall.rb: install pre-built gem extension files gem extension directories. [ruby-core:76931] [Bug #12681] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/extmk.rb')
-rwxr-xr-xext/extmk.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/ext/extmk.rb b/ext/extmk.rb
index aa9b0d8..a65a281 100755
--- a/ext/extmk.rb
+++ b/ext/extmk.rb
@@ -565,12 +565,24 @@ end
Dir.chdir('..')
FileUtils::makedirs('gems')
-FileUtils::makedirs('.ext/gems')
+FileUtils::makedirs("#$extout/gems")
Dir.chdir('gems')
extout = $extout
gems.each do |d|
$extout = extout.dup
extmake(d, 'gems')
+ open("#{d}/Makefile", "r+b") do |f|
+ mf = f.read
+ f.rewind
+ mf.sub!(/^RUBYARCHDIR *= *(\$\(extout\))\/(\$\(arch\))(.*)/) {
+ "TARGET_SO_DIR = #$1/gems/#$2/#{d[%r{\A[^/]+}]}#$3\n" \
+ "TARGET_SO_TIME = .gems.-.arch.-.#{d[/\A[^\/]+/]}.time"
+ }
+ mf.gsub!(/\bRUBYARCHDIR\b/, 'TARGET_SO_DIR')
+ mf.gsub!(/\.TARGET_SO_DIR\.time/, '$(TARGET_SO_TIME)')
+ f.write(mf)
+ f.truncate(f.pos)
+ end
end
$extout = extout
Dir.chdir('../ext')