mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
ruby-runner.c: enable MJIT_SEARCH_BUILD_DIR
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65588 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f837601cdb
commit
c818b2fcf4
2 changed files with 10 additions and 0 deletions
|
@ -3,6 +3,8 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include "ruby-runner.h"
|
#include "ruby-runner.h"
|
||||||
|
|
||||||
|
@ -57,13 +59,19 @@ main(int argc, char **argv)
|
||||||
PATH_SEPARATOR
|
PATH_SEPARATOR
|
||||||
EXTOUT_DIR"/"ARCH
|
EXTOUT_DIR"/"ARCH
|
||||||
;
|
;
|
||||||
|
static const char mjit_build_dir[] = BUILDDIR"/mjit_build_dir."SOEXT;
|
||||||
const size_t dirsize = sizeof(builddir);
|
const size_t dirsize = sizeof(builddir);
|
||||||
const size_t namesize = sizeof(rubypath) - dirsize;
|
const size_t namesize = sizeof(rubypath) - dirsize;
|
||||||
const char *rubyname = rubypath + dirsize;
|
const char *rubyname = rubypath + dirsize;
|
||||||
char *arg0 = argv[0], *p;
|
char *arg0 = argv[0], *p;
|
||||||
|
struct stat stbuf;
|
||||||
|
|
||||||
insert_env_path(LIBPATHENV, builddir, dirsize, 1);
|
insert_env_path(LIBPATHENV, builddir, dirsize, 1);
|
||||||
insert_env_path("RUBYLIB", rubylib, sizeof(rubylib), 0);
|
insert_env_path("RUBYLIB", rubylib, sizeof(rubylib), 0);
|
||||||
|
if (PRELOADENV[0] && stat(mjit_build_dir, &stbuf) == 0) {
|
||||||
|
insert_env_path(PRELOADENV, mjit_build_dir, sizeof(mjit_build_dir), 1);
|
||||||
|
setenv("MJIT_SEARCH_BUILD_DIR", "true", 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (!(p = strrchr(arg0, '/'))) p = arg0; else p++;
|
if (!(p = strrchr(arg0, '/'))) p = arg0; else p++;
|
||||||
if (strlen(p) < namesize - 1) {
|
if (strlen(p) < namesize - 1) {
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
#define ABS_SRCDIR "@abs_srcdir@"
|
#define ABS_SRCDIR "@abs_srcdir@"
|
||||||
#define BUILDDIR "@abs_top_builddir@"
|
#define BUILDDIR "@abs_top_builddir@"
|
||||||
#define LIBPATHENV "@LIBPATHENV@"
|
#define LIBPATHENV "@LIBPATHENV@"
|
||||||
|
#define PRELOADENV "@PRELOADENV@"
|
||||||
#define PATH_SEPARATOR "@PATH_SEPARATOR@"
|
#define PATH_SEPARATOR "@PATH_SEPARATOR@"
|
||||||
#define PATH_SEP '@PATH_SEPARATOR@'
|
#define PATH_SEP '@PATH_SEPARATOR@'
|
||||||
#define EXTOUT "@EXTOUT@"
|
#define EXTOUT "@EXTOUT@"
|
||||||
#define ARCH "@arch@"
|
#define ARCH "@arch@"
|
||||||
|
#define SOEXT "@SOEXT@"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue