summaryrefslogtreecommitdiff
path: root/tool/make-snapshot
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-12 10:11:11 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-12 10:11:11 +0000
commit12096f588feb3e2ee08509bb921f2fde1703cc47 (patch)
tree84b08777b01678cdd4f8b91d573be6a4346a512d /tool/make-snapshot
parentf65719e5c66f5db60c17e87540e886e7b3f92521 (diff)
* tool/make-snapshot: fix for enc.mk.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/make-snapshot')
-rwxr-xr-xtool/make-snapshot89
1 files changed, 61 insertions, 28 deletions
diff --git a/tool/make-snapshot b/tool/make-snapshot
index 997582b..05c4dc2 100755
--- a/tool/make-snapshot
+++ b/tool/make-snapshot
@@ -1,4 +1,4 @@
-#!/usr/bin/ruby
+#!/usr/bin/ruby -s
require 'uri'
require 'digest/md5'
require 'digest/sha2'
@@ -17,6 +17,7 @@ ENV["RUBY"] ||= "ruby"
ENV["MV"] ||= "mv"
ENV["MINIRUBY"] ||= "ruby"
+$patch_file &&= File.expand_path($patch_file)
path = ENV["PATH"].split(File::PATH_SEPARATOR)
%w[YACC BASERUBY RUBY MV MINIRUBY].each do |var|
cmd = ENV[var]
@@ -31,15 +32,17 @@ end
unless destdir = ARGV.shift
abort "usage: #{File.basename $0} new-directory-to-save [version ...]"
end
-FileUtils.mkpath(destdir)
-destdir = File.expand_path(destdir)
revisions = ARGV.empty? ? ["trunk"] : ARGV
-tmp = Dir.mktmpdir("ruby-snapshot")
-FileUtils.mkpath(tmp)
-at_exit {
- Dir.chdir "/"
- FileUtils.rm_rf(tmp)
-}
+unless tmp = $exported
+ FileUtils.mkpath(destdir)
+ destdir = File.expand_path(destdir)
+ tmp = Dir.mktmpdir("ruby-snapshot")
+ FileUtils.mkpath(tmp)
+ at_exit {
+ Dir.chdir "/"
+ FileUtils.rm_rf(tmp)
+ } unless $keep_temp
+end
Dir.chdir tmp
def package(rev, destdir)
@@ -70,43 +73,72 @@ def package(rev, destdir)
end
revision = `svn info #{url}`[/Last Changed Rev: (\d+)/, 1]
end
- puts "Exporting #{rev}@#{revision}"
- IO.popen("svn export #{url} ruby") do |pipe|
- pipe.each {|line| /^A/ =~ line or print line}
- end
- unless $?.success?
- warn("Export failed")
- return
+ unless $exported
+ puts "Exporting #{rev}@#{revision}"
+ IO.popen("svn export #{url} ruby") do |pipe|
+ pipe.each {|line| /^A/ =~ line or print line}
+ end
+ unless $?.success?
+ warn("Export failed")
+ return
+ end
end
- open("ruby/revision.h", "wb") {|f| f.puts "#define RUBY_REVISION #{revision}"}
- version ||= (versionhdr = IO.read("ruby/version.h"))[RUBY_VERSION_PATTERN, 1]
+
+ v = "ruby-#{version}-#{tag}"
+ File.directory?(v) or File.rename "ruby", v
+ system("patch -d #{v} -p0 -i #{$patch_file}") if $patch_file
+ open("#{v}/revision.h", "wb") {|f| f.puts "#define RUBY_REVISION #{revision}"}
+ version ||= (versionhdr = IO.read("#{v}/version.h"))[RUBY_VERSION_PATTERN, 1]
version or return
if patchlevel
- versionhdr ||= IO.read("ruby/version.h")
+ versionhdr ||= IO.read("#{v}/version.h")
patchlevel = versionhdr[/^\#define\s+RUBY_PATCHLEVEL\s+(\d+)/, 1]
tag = (patchlevel ? "p#{patchlevel}" : "r#{revision}")
else
tag = "r#{revision}"
end
- v = "ruby-#{version}-#{tag}"
- File.rename "ruby", v
Dir.chdir(v) do
- print "creating configure..."
- unless system("autoconf")
- puts " failed"
- return
+ File.open("cross.rb", "w") {|f| f.puts "CROSS_COMPILING=true"}
+ unless File.exist?("configure")
+ print "creating configure..."
+ unless system("autoconf")
+ puts " failed"
+ return
+ end
+ puts " done"
end
- puts " done"
FileUtils.rm_rf("autom4te.cache")
print "creating prerequisites..."
if File.file?("common.mk") && /^prereq/ =~ commonmk = IO.read("common.mk")
- IO.popen("make -f - prereq srcdir=. IFCHANGE=tool/ifchange", "w") do |f|
+ puts
+ File.open("config.status", "w") {|f|
+ f.puts "s,@configure_args@,|#_!!_#|,g"
+ f.puts "s,@EXTOUT@,|#_!!_#|..,g"
+ f.puts "s,@bindir@,|#_!!_#|,g"
+ f.puts "s,@ruby_install_name@,|#_!!_#|,g"
+ f.puts "s,@ARCH_FLAG@,|#_!!_#|,g"
+ f.puts "s,@CFLAGS@,|#_!!_#|,g"
+ f.puts "s,@CPPFLAGS@,|#_!!_#|,g"
+ f.puts "s,@LDFLAGS@,|#_!!_#|,g"
+ f.puts "s,@DLDFLAGS@,|#_!!_#|,g"
+ f.puts "s,@LIBEXT@,|#_!!_#|a,g"
+ f.puts "s,@OBJEXT@,|#_!!_#|o,g"
+ f.puts "s,@LIBRUBY@,|#_!!_#|liburyb.a,g"
+ f.puts "s,@LIBRUBY_A@,|#_!!_#|liburyb.a,g"
+ }
+ FileUtils.mkpath("../include/ruby")
+ File.open("../include/ruby/config.h", "w") {}
+ miniruby = ENV['MINIRUBY'] + " -rcross"
+ IO.popen("make -f - prereq srcdir=. IFCHANGE=tool/ifchange 'MINIRUBY=#{miniruby}'", "w") do |f|
f.puts(IO.read("Makefile.in")[/^lex\.c.*?^$/m])
f.puts(commonmk.gsub(/\{[^{}]*\}/, ""))
end
+ FileUtils.rm_rf("config.status", "../include")
+ print "prerequisites"
else
system("#{YACC} -o parse.c parse.y")
end
+ File.unlink("cross.rb")
unless $?.success?
puts " failed"
return
@@ -129,10 +161,11 @@ def package(rev, destdir)
end
end.compact
ensure
- FileUtils.rm_rf(v) if v
+ FileUtils.rm_rf(v) if v and !$exported and !$keep_temp
end
revisions.collect {|rev| package(rev, destdir)}.flatten.each do |name|
+ name or next
str = open(name, "rb") {|f| f.read}
md5 = Digest::MD5.hexdigest str
sha = Digest::SHA256.hexdigest str