1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Revert "Prefer exe/ruby to execute from it"

This reverts commit c7b71af9e2, as
an example in bundler expects untouch PATH.
This commit is contained in:
Nobuyoshi Nakada 2020-02-23 13:31:56 +09:00
parent f85ca4c840
commit 0ed3384fd4
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60
2 changed files with 5 additions and 10 deletions

View file

@ -878,7 +878,7 @@ $(PLATFORM_D):
@$(NULLCMD) > $@ @$(NULLCMD) > $@
exe/$(PROGRAM): ruby-runner.c ruby-runner.h exe/.time miniruby$(EXEEXT) {$(VPATH)}config.h exe/$(PROGRAM): ruby-runner.c ruby-runner.h exe/.time miniruby$(EXEEXT) {$(VPATH)}config.h
$(Q) $(CC) $(CFLAGS) $(INCFLAGS) $(CPPFLAGS) -DRUBY_RUNNER_PATH=$(@D) -DRUBY_INSTALL_NAME=$(@F) $(COUTFLAG)ruby-runner.$(OBJEXT) -c $(CSRCFLAG)$(srcdir)/ruby-runner.c $(Q) $(CC) $(CFLAGS) $(INCFLAGS) $(CPPFLAGS) -DRUBY_INSTALL_NAME=$(@F) $(COUTFLAG)ruby-runner.$(OBJEXT) -c $(CSRCFLAG)$(srcdir)/ruby-runner.c
$(Q) $(PURIFY) $(CC) $(CFLAGS) $(LDFLAGS) $(OUTFLAG)$@ ruby-runner.$(OBJEXT) $(LIBS) $(Q) $(PURIFY) $(CC) $(CFLAGS) $(LDFLAGS) $(OUTFLAG)$@ ruby-runner.$(OBJEXT) $(LIBS)
$(Q) $(POSTLINK) $(Q) $(POSTLINK)
$(Q) ./miniruby$(EXEEXT) \ $(Q) ./miniruby$(EXEEXT) \

View file

@ -17,7 +17,7 @@ const char MJIT_HEADER[] = BUILDDIR "/" MJIT_MIN_HEADER;
#define STRINGIZE0(expr) #expr #define STRINGIZE0(expr) #expr
static void static void
insert_env_path(const char *envname, const char *paths, size_t size, int prepend, int add) insert_env_path(const char *envname, const char *paths, size_t size, int prepend)
{ {
const char *env = getenv(envname); const char *env = getenv(envname);
char c = 0; char c = 0;
@ -28,9 +28,6 @@ insert_env_path(const char *envname, const char *paths, size_t size, int prepend
n = strlen(env); n = strlen(env);
while (n > 0 && env[n-1] == PATH_SEP) --n; while (n > 0 && env[n-1] == PATH_SEP) --n;
} }
else if (!add) {
return;
}
if (c) { if (c) {
char *e = malloc(size+n+1); char *e = malloc(size+n+1);
size_t pos = 0; size_t pos = 0;
@ -59,7 +56,6 @@ int
main(int argc, char **argv) main(int argc, char **argv)
{ {
static const char builddir[] = BUILDDIR; static const char builddir[] = BUILDDIR;
static const char exedir[] = BUILDDIR"/"STRINGIZE(RUBY_RUNNER_PATH);
static const char rubypath[] = BUILDDIR"/"STRINGIZE(RUBY_INSTALL_NAME); static const char rubypath[] = BUILDDIR"/"STRINGIZE(RUBY_INSTALL_NAME);
static const char rubylib[] = static const char rubylib[] =
ABS_SRCDIR"/lib" ABS_SRCDIR"/lib"
@ -77,12 +73,11 @@ main(int argc, char **argv)
const char *rubyname = rubypath + dirsize; const char *rubyname = rubypath + dirsize;
char *arg0 = argv[0], *p; char *arg0 = argv[0], *p;
insert_env_path(LIBPATHENV, builddir, dirsize, 1, 1); insert_env_path(LIBPATHENV, builddir, dirsize, 1);
insert_env_path("RUBYLIB", rubylib, sizeof(rubylib), 0, 1); insert_env_path("RUBYLIB", rubylib, sizeof(rubylib), 0);
insert_env_path("PATH", exedir, sizeof(exedir), 1, 0);
#ifndef LOAD_RELATIVE #ifndef LOAD_RELATIVE
if (PRELOADENV[0] && stat(mjit_build_dir, &stbuf) == 0) { if (PRELOADENV[0] && stat(mjit_build_dir, &stbuf) == 0) {
insert_env_path(PRELOADENV, mjit_build_dir, sizeof(mjit_build_dir), 1, 1); insert_env_path(PRELOADENV, mjit_build_dir, sizeof(mjit_build_dir), 1);
setenv("MJIT_SEARCH_BUILD_DIR", "true", 0); setenv("MJIT_SEARCH_BUILD_DIR", "true", 0);
} }
#endif #endif