2012-07-03 06:16:08 +04:00
|
|
|
#!./miniruby
|
2012-11-23 17:49:14 +04:00
|
|
|
# -*- coding: us-ascii -*-
|
2012-07-03 06:16:08 +04:00
|
|
|
|
2016-07-03 00:01:04 +03:00
|
|
|
# Used by "make runnable" target, to make symbolic links from a build
|
|
|
|
# directory.
|
|
|
|
|
2013-02-19 07:49:35 +04:00
|
|
|
require './rbconfig'
|
2013-01-11 11:59:07 +04:00
|
|
|
require 'fileutils'
|
2024-02-17 18:18:19 +03:00
|
|
|
require_relative 'lib/path'
|
2012-07-03 06:16:08 +04:00
|
|
|
|
|
|
|
case ARGV[0]
|
|
|
|
when "-n"
|
|
|
|
ARGV.shift
|
|
|
|
include FileUtils::DryRun
|
|
|
|
when "-v"
|
|
|
|
ARGV.shift
|
|
|
|
include FileUtils::Verbose
|
|
|
|
else
|
|
|
|
include FileUtils
|
|
|
|
end
|
|
|
|
|
2024-02-17 18:18:19 +03:00
|
|
|
include Path
|
2013-02-22 06:37:51 +04:00
|
|
|
|
|
|
|
config = RbConfig::MAKEFILE_CONFIG.merge("prefix" => ".", "exec_prefix" => ".")
|
|
|
|
config.each_value {|s| RbConfig.expand(s, config)}
|
2013-01-11 11:59:07 +04:00
|
|
|
srcdir = config["srcdir"] ||= File.dirname(__FILE__)
|
|
|
|
top_srcdir = config["top_srcdir"] ||= File.dirname(srcdir)
|
2012-07-03 06:16:08 +04:00
|
|
|
extout = ARGV[0] || config["EXTOUT"]
|
|
|
|
arch = config["arch"]
|
2013-02-22 06:37:51 +04:00
|
|
|
bindir = config["bindir"]
|
|
|
|
libdirname = config["libdirname"]
|
|
|
|
libdir = config[libdirname || "libdir"]
|
|
|
|
vendordir = config["vendordir"]
|
|
|
|
rubylibdir = config["rubylibdir"]
|
|
|
|
rubyarchdir = config["rubyarchdir"]
|
|
|
|
archdir = "#{extout}/#{arch}"
|
2024-02-18 09:07:42 +03:00
|
|
|
exedir = libdirname == "archlibdir" ? "#{config["libexecdir"]}/#{arch}/bin" : bindir
|
|
|
|
[exedir, libdir, archdir].uniq.each do |dir|
|
2012-07-03 06:16:08 +04:00
|
|
|
File.directory?(dir) or mkdir_p(dir)
|
|
|
|
end
|
2024-02-18 09:07:42 +03:00
|
|
|
unless exedir == bindir
|
|
|
|
ln_dir_relative(exedir, bindir)
|
|
|
|
end
|
2012-07-03 06:16:08 +04:00
|
|
|
|
|
|
|
exeext = config["EXEEXT"]
|
|
|
|
ruby_install_name = config["ruby_install_name"]
|
|
|
|
rubyw_install_name = config["rubyw_install_name"]
|
|
|
|
goruby_install_name = "go" + ruby_install_name
|
2024-02-18 09:07:42 +03:00
|
|
|
[ruby_install_name, rubyw_install_name, goruby_install_name].each do |ruby|
|
2021-08-19 10:10:14 +03:00
|
|
|
if ruby and !ruby.empty?
|
|
|
|
ruby += exeext
|
2024-02-18 09:07:42 +03:00
|
|
|
ln_relative(ruby, "#{exedir}/#{ruby}", true)
|
2012-07-03 06:16:08 +04:00
|
|
|
end
|
|
|
|
end
|
2014-01-02 06:41:06 +04:00
|
|
|
so = config["LIBRUBY_SO"]
|
|
|
|
libruby = [config["LIBRUBY_A"]]
|
|
|
|
if /\.dll\z/i =~ so
|
|
|
|
ln_relative(so, "#{bindir}/#{so}")
|
|
|
|
else
|
|
|
|
libruby << so
|
|
|
|
end
|
2012-07-03 06:16:08 +04:00
|
|
|
libruby.concat(config["LIBRUBY_ALIASES"].split)
|
2013-02-22 06:37:51 +04:00
|
|
|
libruby.each {|lib|ln_relative(lib, "#{libdir}/#{lib}")}
|
|
|
|
ln_dir_relative("#{extout}/common", rubylibdir)
|
|
|
|
rubyarchdir.sub!(rubylibdir, "#{extout}/common")
|
|
|
|
vendordir.sub!(rubylibdir, "#{extout}/common")
|
|
|
|
ln_dir_relative(archdir, rubyarchdir)
|
|
|
|
vendordir.sub!(rubyarchdir, archdir)
|
|
|
|
ln_dir_relative("#{top_srcdir}/lib", vendordir)
|
|
|
|
ln_relative("rbconfig.rb", "#{archdir}/rbconfig.rb")
|