2016-07-02 17:01:04 -04:00
|
|
|
# Used by Makefile and configure for building Ruby.
|
|
|
|
# See common.mk and Makefile.in for details.
|
|
|
|
|
2014-07-06 01:20:10 -04:00
|
|
|
class File
|
|
|
|
sep = ("\\" if RUBY_PLATFORM =~ /mswin|bccwin|mingw/)
|
|
|
|
if sep != ALT_SEPARATOR
|
|
|
|
remove_const :ALT_SEPARATOR
|
|
|
|
ALT_SEPARATOR = sep
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-09-04 11:27:02 -04:00
|
|
|
static = !!(defined?($static) && $static)
|
2014-07-06 01:20:10 -04:00
|
|
|
$:.unshift(builddir)
|
|
|
|
posthook = proc do
|
2018-11-13 23:42:14 -05:00
|
|
|
RbConfig.fire_update!("top_srcdir", $top_srcdir)
|
|
|
|
RbConfig.fire_update!("topdir", $topdir)
|
|
|
|
$hdrdir.sub!(/\A#{Regexp.quote($top_srcdir)}(?=\/)/, "$(top_srcdir)")
|
2015-09-04 06:06:49 -04:00
|
|
|
if $extmk
|
|
|
|
$ruby = "$(topdir)/miniruby -I'$(topdir)' -I'$(top_srcdir)/lib' -I'$(extout)/$(arch)' -I'$(extout)/common'"
|
|
|
|
else
|
|
|
|
$ruby = baseruby
|
|
|
|
end
|
|
|
|
$static = static
|
2014-07-06 01:20:10 -04:00
|
|
|
untrace_var(:$ruby, posthook)
|
|
|
|
end
|
|
|
|
prehook = proc do |extmk|
|
2021-10-04 04:56:37 -04:00
|
|
|
=begin
|
2015-09-04 06:06:49 -04:00
|
|
|
pat = %r[(?:\A(?:\w:|//[^/]+)|\G)/[^/]*]
|
|
|
|
dir = builddir.scan(pat)
|
|
|
|
pwd = Dir.pwd.scan(pat)
|
|
|
|
if dir[0] == pwd[0]
|
|
|
|
while dir[0] and dir[0] == pwd[0]
|
|
|
|
dir.shift
|
|
|
|
pwd.shift
|
|
|
|
end
|
2015-11-03 20:32:54 -05:00
|
|
|
builddir = File.join((pwd.empty? ? ["."] : [".."]*pwd.size) + dir)
|
2015-09-04 22:00:34 -04:00
|
|
|
builddir = "." if builddir.empty?
|
2014-07-06 01:20:10 -04:00
|
|
|
end
|
2021-10-04 04:56:37 -04:00
|
|
|
=end
|
2015-09-05 08:29:29 -04:00
|
|
|
join = proc {|*args| File.join(*args).sub!(/\A(?:\.\/)*/, '')}
|
2015-09-04 06:06:49 -04:00
|
|
|
$topdir ||= builddir
|
2015-12-05 03:48:28 -05:00
|
|
|
$top_srcdir ||= (File.identical?(top_srcdir, dir = join[$topdir, srcdir]) ?
|
|
|
|
dir : top_srcdir)
|
2015-09-04 06:06:49 -04:00
|
|
|
$extout = '$(topdir)/.ext'
|
|
|
|
$extout_prefix = '$(extout)$(target_prefix)/'
|
|
|
|
config = RbConfig::CONFIG
|
|
|
|
mkconfig = RbConfig::MAKEFILE_CONFIG
|
2018-11-13 23:42:14 -05:00
|
|
|
RbConfig.fire_update!("builddir", builddir)
|
|
|
|
RbConfig.fire_update!("buildlibdir", builddir)
|
|
|
|
RbConfig.fire_update!("libdir", builddir)
|
|
|
|
RbConfig.fire_update!("top_srcdir", $top_srcdir ||= top_srcdir)
|
|
|
|
RbConfig.fire_update!("extout", $extout)
|
|
|
|
RbConfig.fire_update!("rubyhdrdir", "$(top_srcdir)/include")
|
|
|
|
RbConfig.fire_update!("rubyarchhdrdir", "$(extout)/include/$(arch)")
|
|
|
|
RbConfig.fire_update!("libdirname", "buildlibdir")
|
2015-09-04 06:06:49 -04:00
|
|
|
trace_var(:$ruby, posthook)
|
2014-07-06 01:20:10 -04:00
|
|
|
untrace_var(:$extmk, prehook)
|
|
|
|
end
|
|
|
|
trace_var(:$extmk, prehook)
|