[前][次][番号順一覧][スレッド一覧]

ruby-changes:7024

From: nobu <ko1@a...>
Date: Tue, 12 Aug 2008 19:11:29 +0900 (JST)
Subject: [ruby-changes:7024] Ruby:r18542 (trunk): * tool/make-snapshot: fix for enc.mk.

nobu	2008-08-12 19:11:11 +0900 (Tue, 12 Aug 2008)

  New Revision: 18542

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=18542

  Log:
    * tool/make-snapshot: fix for enc.mk.

  Modified files:
    trunk/ChangeLog
    trunk/tool/make-snapshot

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 18541)
+++ ChangeLog	(revision 18542)
@@ -1,3 +1,7 @@
+Tue Aug 12 19:11:05 2008  Nobuyoshi Nakada  <nobu@r...>
+
+	* tool/make-snapshot: fix for enc.mk.
+
 Tue Aug 12 19:08:42 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* string.c (rb_str_drop_bytes): new function to drop first bytes.
Index: tool/make-snapshot
===================================================================
--- tool/make-snapshot	(revision 18541)
+++ tool/make-snapshot	(revision 18542)
@@ -1,4 +1,4 @@
-#!/usr/bin/ruby
+#!/usr/bin/ruby -s
 require 'uri'
 require 'digest/md5'
 require 'digest/sha2'
@@ -17,6 +17,7 @@
 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 @@
 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 @@
     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 @@
     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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]