1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

common.mk: extract-gems

* common.mk (extract-gems): extract gem files to install them even
  if zlib is not available.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-01-16 04:52:59 +00:00
parent d0cf23b57e
commit 983cbb1aed
2 changed files with 27 additions and 0 deletions

View file

@ -924,6 +924,14 @@ update-gems: PHONY
-e 'File.unlink(*(old-[gem]))' \
bundled_gems
extract-gems: PHONY
$(ECHO) Extracting bundled gem files...
$(Q) $(RUNRUBY) -C "$(srcdir)/gems" \
-I../tool -rgem-unpack -answ \
-e 'gem, ver = *$$F' \
-e 'Gem.unpack("#{gem}-#{ver}.gem")' \
bundled_gems
UPDATE_LIBRARIES = no
### set the following environment variable or uncomment the line if
@ -973,6 +981,9 @@ extract-extlibs:
clean-extlibs:
$(Q) $(RMALL) $(srcdir)/.downloaded-cache
clean-gems:
$(Q) $(RM) gems/*.gem
CLEAN_CACHE = clean-extlibs
info: info-program info-libruby_a info-libruby_so info-arch

16
tool/gem-unpack.rb Executable file
View file

@ -0,0 +1,16 @@
require 'rubygems'
require 'rubygems/package'
def Gem.unpack(file, dir = nil)
pkg = Gem::Package.new(file)
pkg.security_policy = Gem::Security::LowSecurity
spec = pkg.spec
target = spec.full_name
target = File.join(dir, target) if dir
pkg.extract_files target
spec_file = File.join(target, "#{spec.name}.gemspec")
open(spec_file, 'wb') do |f|
f.print spec.to_ruby
end
puts "Unpacked #{file}"
end