2016-07-03 00:01:04 +03:00
|
|
|
# Used by Makefile and configure for building Ruby.
|
|
|
|
# See common.mk and Makefile.in for details.
|
|
|
|
|
2014-07-06 09: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 18:27:02 +03:00
|
|
|
static = !!(defined?($static) && $static)
|
2014-07-06 09:20:10 +04:00
|
|
|
$:.unshift(builddir)
|
|
|
|
posthook = proc do
|
2018-11-14 07:42:14 +03: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 13:06:49 +03: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 09:20:10 +04:00
|
|
|
untrace_var(:$ruby, posthook)
|
|
|
|
end
|
|
|
|
prehook = proc do |extmk|
|
2021-10-04 11:56:37 +03:00
|
|
|
=begin
|
2015-09-04 13:06:49 +03: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-04 04:32:54 +03:00
|
|
|
builddir = File.join((pwd.empty? ? ["."] : [".."]*pwd.size) + dir)
|
2015-09-05 05:00:34 +03:00
|
|
|
builddir = "." if builddir.empty?
|
2014-07-06 09:20:10 +04:00
|
|
|
end
|
2021-10-04 11:56:37 +03:00
|
|
|
=end
|
2015-09-05 15:29:29 +03:00
|
|
|
join = proc {|*args| File.join(*args).sub!(/\A(?:\.\/)*/, '')}
|
2015-09-04 13:06:49 +03:00
|
|
|
$topdir ||= builddir
|
2015-12-05 11:48:28 +03:00
|
|
|
$top_srcdir ||= (File.identical?(top_srcdir, dir = join[$topdir, srcdir]) ?
|
|
|
|
dir : top_srcdir)
|
2015-09-04 13:06:49 +03:00
|
|
|
$extout = '$(topdir)/.ext'
|
|
|
|
$extout_prefix = '$(extout)$(target_prefix)/'
|
|
|
|
config = RbConfig::CONFIG
|
|
|
|
mkconfig = RbConfig::MAKEFILE_CONFIG
|
2022-07-29 20:54:27 +03:00
|
|
|
$builtruby ||= File.join(builddir, config['RUBY_INSTALL_NAME'] + config['EXEEXT'])
|
2018-11-14 07:42:14 +03:00
|
|
|
RbConfig.fire_update!("builddir", builddir)
|
|
|
|
RbConfig.fire_update!("buildlibdir", builddir)
|
|
|
|
RbConfig.fire_update!("libdir", builddir)
|
2022-02-27 14:09:58 +03:00
|
|
|
RbConfig.fire_update!("prefix", $topdir)
|
2018-11-14 07:42:14 +03:00
|
|
|
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 13:06:49 +03:00
|
|
|
trace_var(:$ruby, posthook)
|
2014-07-06 09:20:10 +04:00
|
|
|
untrace_var(:$extmk, prehook)
|
|
|
|
end
|
|
|
|
trace_var(:$extmk, prehook)
|