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

extract prereq.status

* tool/make-snapshot (package): extract static config values for
  prereq and override dynamic values at runtime.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2017-05-07 13:06:34 +00:00
parent a319225b4a
commit 987508ce56
2 changed files with 55 additions and 32 deletions

View file

@ -210,6 +210,7 @@ def package(vcs, rev, destdir, tmp = nil)
end
end
status = IO.read(File.dirname(__FILE__) + "/prereq.status")
Dir.chdir(tmp) if tmp
if !File.directory?(v)
@ -283,27 +284,13 @@ def package(vcs, rev, destdir, tmp = nil)
if File.file?("common.mk") && /^prereq/ =~ commonmk = IO.read("common.mk")
puts
extout = clean.add('tmp')
begin
status = IO.read("tool/prereq.status")
rescue Errno::ENOENT
# use fallback file
end
File.open(clean.add("config.status"), "w") {|f|
f.puts "s,@configure_args@,|#_!!_#|,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"
f.puts "s,@CFLAGS@,|#_!!_#|,g"
f.puts "s,@CPPFLAGS@,|#_!!_#|,g"
f.puts "s,@CXXFLAGS@,|#_!!_#|,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,@EXEEXT@,|#_!!_#|,g"
f.puts "s,@LIBRUBY@,|#_!!_#|libruby.a,g"
f.puts "s,@LIBRUBY_A@,|#_!!_#|libruby.a,g"
f.puts "s,@RM@,|#_!!_#|rm -f,g"
f.puts "s,@CP@,|#_!!_#|cp,g"
f.puts "s,@rubyarchdir@,|#_!!_#|,g"
f.puts "s,@rubylibprefix@,|#_!!_#|,g"
f.puts "s,@ruby_version@,|#_!!_#|#{version},g"
f.print status
}
FileUtils.mkpath(hdrdir = "#{extout}/include/ruby")
File.open("#{hdrdir}/config.h", "w") {}
@ -314,24 +301,17 @@ def package(vcs, rev, destdir, tmp = nil)
baseruby = ENV["BASERUBY"]
mk = IO.read("Makefile.in").gsub(/^@.*\n/, '')
vars = {
"srcdir"=>".",
"CHDIR"=>"cd",
"NULLCMD"=>":",
"EXTOUT"=>extout,
"PATH_SEPARATOR"=>File::PATH_SEPARATOR,
"IFCHANGE"=>"tool/ifchange",
"MKDIR_P"=>"mkdir -p",
"RMALL"=>"rm -fr",
"MINIRUBY"=>miniruby,
"RUNRUBY"=>miniruby,
"RUBY"=>ENV["RUBY"],
"HAVE_BASERUBY"=>"yes",
"BASERUBY"=>baseruby,
"BOOTSTRAPRUBY"=>baseruby,
"PWD"=>Dir.pwd,
"CONFIGURE"=>"configure",
"arch"=>"noarch",
"UNICODE_FILES"=>"",
"ruby_version"=>version,
}
status.scan(/^s([%,])@([A-Za-z_][A-Za-z_0-9]*)@\1(.*?)\1g$/) do
vars[$2] = $3
end
vars["UNICODE_VERSION"] = $unicode_version if $unicode_version
args = vars.dup
mk.gsub!(/@([A-Za-z_]\w*)@/) {args.delete($1); vars[$1] || ENV[$1]}

43
tool/prereq.status Normal file
View file

@ -0,0 +1,43 @@
s,@EXTOUT@,tmp,g
s,@ruby_version@,0.0.0,g
s,@NULLCMD@,:,g
s,@ARCH_FLAG@,,g
s,@BASERUBY@,ruby,g
s,@BOOTSTRAPRUBY@,$(BASERUBY),g
s,@CC@,false,g
s,@CFLAGS@,,g
s,@CHDIR@,cd,g
s,@CONFIGURE@,configure,g
s,@CP@,cp,g
s,@CPPFLAGS@,,g
s,@CXXFLAGS@,,g
s,@DLDFLAGS@,,g
s,@EXEEXT@,,g
s,@HAVE_BASERUBY@,yes,g
s,@IFCHANGE@,tool/ifchange,g
s,@LDFLAGS@,,g
s,@LIBEXT@,a,g
s,@LIBRUBY@,libruby.a,g
s,@LIBRUBY_A@,libruby.a,g
s,@MINIRUBY@,$(BASERUBY),g
s,@MKDIR_P@,mkdir -p,g
s,@OBJEXT@,o,g
s,@PATH_SEPARATOR@,:,g
s,@PWD@,.,g
s,@RM@,rm -f,g
s,@RMALL@,rm -fr,g
s,@RMDIR@,rmdir,g
s,@RMDIRS@,$(RMDIR) -p,g
s,@RUBY@,$(BASERUBY),g
s,@RUNRUBY@,$(MINIRUBY),g
s,@UNICODE_FILES@,,g
s,@arch@,noarch,g
s,@bindir@,,g
s,@configure_args@,,g
s,@ruby_install_name@,,g
s,@rubyarchdir@,,g
s,@rubylibprefix@,,g
s,@srcdir@,.,g
s/@[A-Za-z][A-Za-z0-9_]*@//g
s/{\$([A-Za-z]*)}//g