diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-03 02:16:08 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-03 02:16:08 +0000 |
commit | 3fceaf10ab6c85032e381d8345dbf4e4b5e34f2d (patch) | |
tree | 32b358906e693f1429eb7bf99f1688e712d6050d | |
parent | 66d0ad360719e9e0aa4b65b32849dbd9c24998a3 (diff) | |
download | ruby-3fceaf10ab6c85032e381d8345dbf4e4b5e34f2d.tar.gz |
make runnable
* common.mk (runnable): make symbolic links to run in build directory.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | Makefile.in | 1 | ||||
-rw-r--r-- | common.mk | 5 | ||||
-rw-r--r-- | configure.in | 3 | ||||
-rwxr-xr-x | tool/mkrunnable.rb | 62 | ||||
-rw-r--r-- | win32/Makefile.sub | 2 |
6 files changed, 77 insertions, 0 deletions
@@ -1,3 +1,7 @@ +Tue Jul 3 11:16:06 2012 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * common.mk (runnable): make symbolic links to run in build directory. + Tue Jul 3 10:46:06 2012 NARUSE, Yui <naruse@ruby-lang.org> * ruby.c (proc_options): warn if -K option is specified. [Feature #5206] diff --git a/Makefile.in b/Makefile.in index b9cec567d3..70bea392ac 100644 --- a/Makefile.in +++ b/Makefile.in @@ -116,6 +116,7 @@ LIBRUBY = @LIBRUBY@ LIBRUBYARG = @LIBRUBYARG@ LIBRUBYARG_STATIC = @LIBRUBYARG_STATIC@ LIBRUBYARG_SHARED = @LIBRUBYARG_SHARED@ +LIBRUBY_RELATIVE = @LIBRUBY_RELATIVE@ THREAD_MODEL = @THREAD_MODEL@ @@ -521,6 +521,11 @@ test-rubyspec-precheck: test-rubyspec: test-rubyspec-precheck $(RUNRUBY) $(srcdir)/spec/mspec/bin/mspec run -B $(srcdir)/spec/default.mspec $(MSPECOPT) +RUNNABLE = $(LIBRUBY_RELATIVE:no=un)-runnable +runnable: $(RUNNABLE) prog $(srcdir)/tool/mkrunnable.rb PHONY + $(Q) $(MINIRUBY) $(srcdir)/tool/mkrunnable.rb -v $(EXTOUT) +yes-runnable: PHONY + encs: enc trans libencs: libenc libtrans encs enc trans libencs libenc libtrans: showflags $(ENC_MK) $(LIBRUBY) $(PREP) diff --git a/configure.in b/configure.in index f6d49616a6..32aa05364a 100644 --- a/configure.in +++ b/configure.in @@ -2655,6 +2655,9 @@ AS_CASE("$enable_shared", [yes], [ ], [interix*], [ LIBRUBYARG_SHARED='-L. -L${libdir} -l$(RUBY_SO_NAME)' + ], + [mingw*|cygwin*|mswin*], [ + LIBRUBY_RELATIVE=yes ]) ], [ LIBRUBYARG_SHARED= diff --git a/tool/mkrunnable.rb b/tool/mkrunnable.rb new file mode 100755 index 0000000000..e12c751b98 --- /dev/null +++ b/tool/mkrunnable.rb @@ -0,0 +1,62 @@ +#!./miniruby + +require 'mkmf' + +case ARGV[0] +when "-n" + ARGV.shift + include FileUtils::DryRun +when "-v" + ARGV.shift + include FileUtils::Verbose +else + include FileUtils +end + +def ln_safe(src, dest) + link = File.readlink(dest) rescue nil + return if link == src + ln_sf(src, dest) +end + +config = RbConfig::CONFIG +extout = ARGV[0] || config["EXTOUT"] +version = config["ruby_version"] +arch = config["arch"] +["bin", "lib"].each do |dir| + File.directory?(dir) or mkdir_p(dir) +end + +exeext = config["EXEEXT"] +ruby_install_name = config["ruby_install_name"] +rubyw_install_name = config["rubyw_install_name"] +goruby_install_name = "go" + ruby_install_name +[ruby_install_name, rubyw_install_name, goruby_install_name].map do |ruby| + ruby += exeext + if ruby and !ruby.empty? + ln_safe("../#{ruby}", "bin/#{ruby}") + end +end +libruby = config.values_at("LIBRUBY_A", "LIBRUBY_SO") +libruby.concat(config["LIBRUBY_ALIASES"].split) +libruby.each {|lib|ln_safe("../#{lib}", "lib/#{lib}")} +if File.expand_path(extout) == extout + ln_safe(extout, "lib/ruby") +else + ln_safe(File.join("..", extout), "lib/ruby") + cur = "#{extout}/".gsub(/(\A|\/)(?:\.\/)+/, '\1').tr_s('/', '/') + nil while cur.sub!(/[^\/]+\/\.\.\//, '') + if /(\A|\/)\.\.\// =~ cur + cur = nil + else + cur.gsub!(/[^\/]+/, '..') + end +end +if cur + ln_safe(File.join("..", cur, "rbconfig.rb"), File.join(extout, arch, "rbconfig.rb")) +else + ln_safe(File.expand_path("rbconfig.rb"), File.join(extout, arch, "rbconfig.rb")) +end +ln_safe("common", File.join(extout, version)) +ln_safe(File.join("..", arch), File.join(extout, "common", arch)) +ln_safe(relative_from(File.join(File.dirname(config["srcdir"]), "lib"), ".."), File.join(extout, "vendor_ruby")) diff --git a/win32/Makefile.sub b/win32/Makefile.sub index acc2efff89..6e229bb880 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -312,6 +312,8 @@ LIBRUBY_A = $(RUBY_SO_NAME)-static.lib LIBRUBY_SO = $(RUBY_SO_NAME).dll LIBRUBY = $(RUBY_SO_NAME).lib LIBRUBYARG = $(LIBRUBY) +LIBRUBY_RELATIVE = yes + THREAD_MODEL = win32 !if $(CROSS_COMPILING) |