diff options
Diffstat (limited to 'tool')
-rwxr-xr-x | tool/make-snapshot | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/tool/make-snapshot b/tool/make-snapshot index e0f80c3bad..65f5bd024d 100755 --- a/tool/make-snapshot +++ b/tool/make-snapshot @@ -84,7 +84,7 @@ def package(rev, destdir) end end - if !File.directory(v = "ruby") + if !File.directory?(v = "ruby") v = Dir.glob("ruby-*").select(&File.method(:directory?)) v.size == 1 or abort "not exported" v = v[0] @@ -102,8 +102,9 @@ def package(rev, destdir) v = "ruby-#{version}-#{tag}" File.directory?(v) or File.rename "ruby", v system("patch -d #{v} -p0 -i #{$patch_file}") if $patch_file + def (clean = []).add(n) push(n); n end Dir.chdir(v) do - File.open("cross.rb", "w") {|f| f.puts "CROSS_COMPILING=true"} + File.open(clean.add("cross.rb"), "w") {|f| f.puts "CROSS_COMPILING=true"} unless File.exist?("configure") print "creating configure..." unless system("autoconf") @@ -112,13 +113,14 @@ def package(rev, destdir) end puts " done" end - FileUtils.rm_rf("autom4te.cache") + clean.add("autom4te.cache") print "creating prerequisites..." if File.file?("common.mk") && /^prereq/ =~ commonmk = IO.read("common.mk") puts - File.open("config.status", "w") {|f| + extout = clean.add('tmp') + File.open(clean.add("config.status"), "w") {|f| f.puts "s,@configure_args@,|#_!!_#|,g" - f.puts "s,@EXTOUT@,|#_!!_#|..,g" + f.puts "s,@EXTOUT@,|#_!!_#|#{extout},g" f.puts "s,@bindir@,|#_!!_#|,g" f.puts "s,@ruby_install_name@,|#_!!_#|,g" f.puts "s,@ARCH_FLAG@,|#_!!_#|,g" @@ -131,19 +133,19 @@ def package(rev, destdir) 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") {} + FileUtils.mkpath(hdrdir = "#{extout}/include/ruby") + File.open("#{hdrdir}/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") + clean.push("rbconfig.rb", ".rbconfig.time") print "prerequisites" else system("#{YACC} -o parse.c parse.y") end - File.unlink("cross.rb") + FileUtils.rm_rf(clean) unless $?.success? puts " failed" return |