summaryrefslogtreecommitdiff
path: root/tool/mkrunnable.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-01-11 07:59:07 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-01-11 07:59:07 +0000
commit86bd6920353185975dc623cbefc211a17783fa90 (patch)
treec0b3db22ac7c3bb4ac939e19f9414f66656441f1 /tool/mkrunnable.rb
parentfc81730154a90b6460368194139eca05ecee757c (diff)
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
Diffstat (limited to 'tool/mkrunnable.rb')
-rwxr-xr-xtool/mkrunnable.rb17
1 files changed, 14 insertions, 3 deletions
diff --git a/tool/mkrunnable.rb b/tool/mkrunnable.rb
index 847cbef789..73b846026e 100755
--- a/tool/mkrunnable.rb
+++ b/tool/mkrunnable.rb
@@ -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"))