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

tool/mkrunnable.rb: support mswin build on remote file system

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2013-01-11 07:59:07 +00:00
parent fc81730154
commit 86bd692035

View file

@ -1,7 +1,7 @@
#!./miniruby
# -*- coding: us-ascii -*-
require 'mkmf'
require 'fileutils'
case ARGV[0]
when "-n"
@ -14,6 +14,15 @@ else
include FileUtils
end
def relative_from(path, base)
dir = File.join(path, "")
if File.expand_path(dir) == File.expand_path(dir, base)
path
else
File.join(base, path)
end
end
module Mswin
def ln_safe(src, dest, *opt)
cmd = ["mklink", dest.tr("/", "\\"), src.tr("/", "\\")]
@ -35,11 +44,13 @@ end
alias ln_dir_safe ln_safe
if /mingw|mswin/ =~ RbConfig::CONFIG["build_os"]
if /mingw|mswin/ =~ CROSS_COMPILING
extend Mswin
end
config = RbConfig::CONFIG
srcdir = config["srcdir"] ||= File.dirname(__FILE__)
top_srcdir = config["top_srcdir"] ||= File.dirname(srcdir)
extout = ARGV[0] || config["EXTOUT"]
version = config["ruby_version"]
arch = config["arch"]
@ -82,4 +93,4 @@ else
end
ln_dir_safe("common", File.join(extout, version))
ln_dir_safe(File.join("..", arch), File.join(extout, "common", arch))
ln_dir_safe(relative_from(File.join(File.dirname(config["srcdir"]), "lib"), ".."), File.join(extout, "vendor_ruby"))
ln_dir_safe(relative_from(File.join(top_srcdir, "lib"), ".."), File.join(extout, "vendor_ruby"))