mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8b6e42a92c
commit
a4fd2a791e
4 changed files with 46 additions and 2 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
||||||
|
Sun Oct 4 00:09:45 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* 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@it.aoyama.ac.jp>
|
Fri Oct 2 09:20:20 2015 Martin Duerst <duerst@it.aoyama.ac.jp>
|
||||||
|
|
||||||
* common.mk, lib/unicode_normalize/tables.rb: Change Unicode
|
* common.mk, lib/unicode_normalize/tables.rb: Change Unicode
|
||||||
|
|
|
@ -147,7 +147,7 @@ DTRACE_DEPENDENT_OBJS = array.$(OBJEXT) \
|
||||||
|
|
||||||
THREAD_MODEL = @THREAD_MODEL@
|
THREAD_MODEL = @THREAD_MODEL@
|
||||||
|
|
||||||
PREP = @PREP@
|
PREP = @PREP@ ruby-runner
|
||||||
ARCHFILE = @ARCHFILE@
|
ARCHFILE = @ARCHFILE@
|
||||||
SETUP =
|
SETUP =
|
||||||
EXTSTATIC = @EXTSTATIC@
|
EXTSTATIC = @EXTSTATIC@
|
||||||
|
@ -252,6 +252,12 @@ ruby_pc = @ruby_pc@
|
||||||
$(ruby_pc):
|
$(ruby_pc):
|
||||||
@./config.status --file=$@:$(srcdir)/template/ruby.pc.in
|
@./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): $($(CROSS_COMPILING:no=)PREP)
|
||||||
|
|
||||||
rbconfig.rb: $(RBCONFIG)
|
rbconfig.rb: $(RBCONFIG)
|
||||||
|
|
27
template/ruby-runner.c.in
Normal file
27
template/ruby-runner.c.in
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
#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;
|
||||||
|
}
|
|
@ -66,7 +66,7 @@ config["bindir"] = abs_archdir
|
||||||
|
|
||||||
env = {}
|
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)
|
env["PATH"] = [abs_archdir, ENV["PATH"]].compact.join(File::PATH_SEPARATOR)
|
||||||
|
|
||||||
if e = ENV["RUBYLIB"]
|
if e = ENV["RUBYLIB"]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue