summaryrefslogtreecommitdiff
path: root/tool/fake.rb
blob: 7d3a471402b357f3a25b12598be9eff5dc5b7e29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
class File
  sep = ("\\" if RUBY_PLATFORM =~ /mswin|bccwin|mingw/)
  if sep != ALT_SEPARATOR
    remove_const :ALT_SEPARATOR
    ALT_SEPARATOR = sep
  end
end

$:.unshift(builddir)
posthook = proc do
  mkconfig = RbConfig::MAKEFILE_CONFIG
  extout = File.expand_path(mkconfig["EXTOUT"], builddir)
  $arch_hdrdir = "#{extout}/include/$(arch)"
  $ruby = baseruby
  untrace_var(:$ruby, posthook)
end
prehook = proc do |extmk|
  unless extmk
    config = RbConfig::CONFIG
    mkconfig = RbConfig::MAKEFILE_CONFIG
    mkconfig["top_srcdir"] = $top_srcdir = top_srcdir
    mkconfig["rubyhdrdir"] = "$(top_srcdir)/include"
    mkconfig["builddir"] = config["builddir"] = builddir
    config["rubyhdrdir"] = File.join(mkconfig["top_srcdir"], "include")
    mkconfig["libdir"] = config["libdir"] = mkconfig["topdir"]
    trace_var(:$ruby, posthook)
  end
  untrace_var(:$extmk, prehook)
end
trace_var(:$extmk, prehook)