mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* tool/make-snapshot: fix for enc.mk.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f65719e5c6
commit
12096f588f
2 changed files with 65 additions and 28 deletions
|
@ -1,3 +1,7 @@
|
|||
Tue Aug 12 19:11:05 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* tool/make-snapshot: fix for enc.mk.
|
||||
|
||||
Tue Aug 12 19:08:42 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* string.c (rb_str_drop_bytes): new function to drop first bytes.
|
||||
|
|
|
@ -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}
|
||||
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
|
||||
unless $?.success?
|
||||
warn("Export failed")
|
||||
return
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue