From 86bd6920353185975dc623cbefc211a17783fa90 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 11 Jan 2013 07:59:07 +0000 Subject: 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 --- tool/mkrunnable.rb | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'tool/mkrunnable.rb') 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")) -- cgit v1.2.3