[前][次][番号順一覧][スレッド一覧]

ruby-changes:39927

From: nobu <ko1@a...>
Date: Sun, 4 Oct 2015 00:10:20 +0900 (JST)
Subject: [ruby-changes:39927] nobu:r52008 (trunk): ruby-runner

nobu	2015-10-04 00:09:47 +0900 (Sun, 04 Oct 2015)

  New Revision: 52008

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52008

  Log:
    ruby-runner
    
    * template/ruby-runner.c.in: wrapper to set dynamic loading path
      environment variable.  /bin/sh on Mac OS X 10.11 (El Capitan)
      clears DYLD_LIBRARY_PATH.
      it must:
      - do nothing even if current directory is not present
      - do not set other environment variables, e.g. PWD, SHLVL, etc
      - do not open other FDs, e.g. pipes for timer thread

  Added files:
    trunk/template/ruby-runner.c.in
  Modified files:
    trunk/ChangeLog
    trunk/Makefile.in
    trunk/tool/runruby.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 52007)
+++ ChangeLog	(revision 52008)
@@ -1,3 +1,14 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Oct  4 00:09:45 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* template/ruby-runner.c.in: wrapper to set dynamic loading path
+	  environment variable.  /bin/sh on Mac OS X 10.11 (El Capitan)
+	  clears DYLD_LIBRARY_PATH.
+
+	  it must:
+	  - do nothing even if current directory is not present
+	  - do not set other environment variables, e.g. PWD, SHLVL, etc
+	  - do not open other FDs, e.g. pipes for timer thread
+
 Fri Oct  2 09:20:20 2015  Martin Duerst  <duerst@i...>
 
 	* common.mk, lib/unicode_normalize/tables.rb: Change Unicode
Index: Makefile.in
===================================================================
--- Makefile.in	(revision 52007)
+++ Makefile.in	(revision 52008)
@@ -147,7 +147,7 @@ DTRACE_DEPENDENT_OBJS = array.$(OBJEXT) https://github.com/ruby/ruby/blob/trunk/Makefile.in#L147
 
 THREAD_MODEL  = @THREAD_MODEL@
 
-PREP          = @PREP@
+PREP          = @PREP@ ruby-runner
 ARCHFILE      = @ARCHFILE@
 SETUP         =
 EXTSTATIC     = @EXTSTATIC@
@@ -252,6 +252,12 @@ ruby_pc = @ruby_pc@ https://github.com/ruby/ruby/blob/trunk/Makefile.in#L252
 $(ruby_pc):
 		@./config.status --file=$@:$(srcdir)/template/ruby.pc.in
 
+ruby-runner.c: template/ruby-runner.c.in
+		@./config.status --file=$@:$(srcdir)/template/$(@F).in
+
+ruby-runner$(EXEEXT): ruby-runner.c
+	$(Q) $(PURIFY) $(CC) $(LDFLAGS) $(LIBS) $(OUTFLAG)$@ ruby-runner.c
+
 $(RBCONFIG): $($(CROSS_COMPILING:no=)PREP)
 
 rbconfig.rb: $(RBCONFIG)
Index: tool/runruby.rb
===================================================================
--- tool/runruby.rb	(revision 52007)
+++ tool/runruby.rb	(revision 52008)
@@ -66,7 +66,7 @@ config["bindir"] = abs_archdir https://github.com/ruby/ruby/blob/trunk/tool/runruby.rb#L66
 
 env = {}
 
-env["RUBY"] = File.expand_path(ruby)
+env["RUBY"] = File.join(abs_archdir, "ruby-runner#{config['EXEEXT']}")
 env["PATH"] = [abs_archdir, ENV["PATH"]].compact.join(File::PATH_SEPARATOR)
 
 if e = ENV["RUBYLIB"]
Index: template/ruby-runner.c.in
===================================================================
--- template/ruby-runner.c.in	(revision 0)
+++ template/ruby-runner.c.in	(revision 52008)
@@ -0,0 +1,27 @@ https://github.com/ruby/ruby/blob/trunk/template/ruby-runner.c.in#L1
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#define BUILDDIR "@abs_top_builddir@"
+#define LIBPATHENV "@LIBPATHENV@"
+
+int
+main(int argc, char **argv)
+{
+    static const char builddir[] = BUILDDIR;
+    const char *libpath = getenv(LIBPATHENV);
+    if (libpath) {
+	size_t n = strlen(libpath);
+	char *e = malloc(sizeof(builddir)+n+1);
+	memcpy(e, builddir, sizeof(builddir)-1);
+	e[sizeof(builddir)-1] = '@PATH_SEPARATOR@';
+	memcpy(e+sizeof(builddir), libpath, n+1);
+	libpath = e;
+    }
+    else {
+	libpath = builddir;
+    }
+    setenv(LIBPATHENV, libpath, 1);
+    execv(BUILDDIR"/@RUBY_BASE_NAME@", argv);
+    return -1;
+}

Property changes on: template/ruby-runner.c.in
___________________________________________________________________
Added: svn:eol-style
   + LF


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]