mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
mjit_build_dir: separate MJIT_BUILD_DIR
* Makefile.in (mjit_build_dir.so): separate MJIT_BUILD_DIR to eliminate the feature for test-all after installation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
92e9f61579
commit
f837601cdb
3 changed files with 29 additions and 4 deletions
12
Makefile.in
12
Makefile.in
|
@ -445,6 +445,7 @@ clean-local::
|
||||||
$(Q)$(RM) $(MJIT_MIN_HEADER) $(MJIT_MIN_HEADER:.h=)$(MJIT_HEADER_SUFFIX:%=*).h
|
$(Q)$(RM) $(MJIT_MIN_HEADER) $(MJIT_MIN_HEADER:.h=)$(MJIT_HEADER_SUFFIX:%=*).h
|
||||||
$(Q)$(RM) $(MJIT_HEADER_INSTALL_DIR)/rb_mjit_min_header-*.h
|
$(Q)$(RM) $(MJIT_HEADER_INSTALL_DIR)/rb_mjit_min_header-*.h
|
||||||
$(Q)$(RM) $(TIMESTAMPDIR)/$(MJIT_HEADER:.h=)$(MJIT_HEADER_SUFFIX).time mjit_config.h
|
$(Q)$(RM) $(TIMESTAMPDIR)/$(MJIT_HEADER:.h=)$(MJIT_HEADER_SUFFIX).time mjit_config.h
|
||||||
|
$(Q)$(RM) mjit_build_dir.*
|
||||||
-$(Q) $(RMDIRS) $(MJIT_HEADER_INSTALL_DIR) 2> $(NULL) || exit 0
|
-$(Q) $(RMDIRS) $(MJIT_HEADER_INSTALL_DIR) 2> $(NULL) || exit 0
|
||||||
|
|
||||||
# DTrace static library hacks described here:
|
# DTrace static library hacks described here:
|
||||||
|
@ -607,7 +608,6 @@ mjit_config.h:
|
||||||
echo '#define RUBY_MJIT_CONFIG_H 1'; \
|
echo '#define RUBY_MJIT_CONFIG_H 1'; \
|
||||||
echo; \
|
echo; \
|
||||||
sep=; \
|
sep=; \
|
||||||
quote MJIT_BUILD_DIR "`$(CHDIR) . && pwd`"; \
|
|
||||||
quote MJIT_MIN_HEADER_NAME "/$(MJIT_HEADER_INSTALL_DIR)/$(MJIT_MIN_HEADER_NAME)"; \
|
quote MJIT_MIN_HEADER_NAME "/$(MJIT_HEADER_INSTALL_DIR)/$(MJIT_MIN_HEADER_NAME)"; \
|
||||||
sep=,; \
|
sep=,; \
|
||||||
quote "MJIT_CC_COMMON " $(MJIT_CC); \
|
quote "MJIT_CC_COMMON " $(MJIT_CC); \
|
||||||
|
@ -617,6 +617,7 @@ mjit_config.h:
|
||||||
quote "MJIT_LDSHARED " $(MJIT_LDSHARED); \
|
quote "MJIT_LDSHARED " $(MJIT_LDSHARED); \
|
||||||
quote "MJIT_DLDFLAGS $${need_mjit_archflag:+ MJIT_ARCHFLAG}" $(MJIT_DLDFLAGS); \
|
quote "MJIT_DLDFLAGS $${need_mjit_archflag:+ MJIT_ARCHFLAG}" $(MJIT_DLDFLAGS); \
|
||||||
quote "MJIT_LIBS " $(LIBRUBYARG_SHARED); \
|
quote "MJIT_LIBS " $(LIBRUBYARG_SHARED); \
|
||||||
|
quote 'PRELOADENV "@PRELOADENV@"'; \
|
||||||
$${archs:+echo} $${archs:+'#if 0'}; \
|
$${archs:+echo} $${archs:+'#if 0'}; \
|
||||||
for arch in $$archs; do \
|
for arch in $$archs; do \
|
||||||
echo "#elif defined __$${arch%=*}__"; \
|
echo "#elif defined __$${arch%=*}__"; \
|
||||||
|
@ -630,3 +631,12 @@ mjit_config.h:
|
||||||
echo; \
|
echo; \
|
||||||
echo '#endif /* RUBY_MJIT_CONFIG_H */'; \
|
echo '#endif /* RUBY_MJIT_CONFIG_H */'; \
|
||||||
} > $@
|
} > $@
|
||||||
|
|
||||||
|
yes-test-all: mjit_build_dir.$(SOEXT)
|
||||||
|
mjit_build_dir.$(SOEXT): $(MJIT_MIN_HEADER)
|
||||||
|
$(ECHO) making $@
|
||||||
|
$(Q) { \
|
||||||
|
echo 'const char MJIT_BUILD_DIR[] = "'"`$(CHDIR) . && pwd`"'";'; \
|
||||||
|
} > $(@:.$(SOEXT)=.c)
|
||||||
|
$(Q) cat $(@:.$(SOEXT)=.c)
|
||||||
|
$(Q) $(DLDSHARED) $(MJIT_DLDFLAGS) $(ARCH_FLAG) $(CFLAGS) $(CPPFLAGS) $(@:.$(SOEXT)=.c) $(OUTFLAG)$@
|
||||||
|
|
17
mjit.c
17
mjit.c
|
@ -388,7 +388,7 @@ init_header_filename(void)
|
||||||
const size_t libpathflag_len = sizeof(libpathflag) - 1;
|
const size_t libpathflag_len = sizeof(libpathflag) - 1;
|
||||||
#endif
|
#endif
|
||||||
#ifndef LOAD_RELATIVE
|
#ifndef LOAD_RELATIVE
|
||||||
static const char build_dir[] = MJIT_BUILD_DIR;
|
const char *build_dir = 0;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -401,7 +401,12 @@ init_header_filename(void)
|
||||||
/* This path is not intended to be used on production, but using build directory's
|
/* This path is not intended to be used on production, but using build directory's
|
||||||
header file here because people want to run `make test-all` without running
|
header file here because people want to run `make test-all` without running
|
||||||
`make install`. Don't use $MJIT_SEARCH_BUILD_DIR except for test-all. */
|
`make install`. Don't use $MJIT_SEARCH_BUILD_DIR except for test-all. */
|
||||||
if (build_dir[0] != '/') {
|
|
||||||
|
build_dir = dlsym(RTLD_DEFAULT, "MJIT_BUILD_DIR");
|
||||||
|
if (!build_dir) {
|
||||||
|
verbose(1, "No mjit_build_directory");
|
||||||
|
}
|
||||||
|
else if (build_dir[0] != '/') {
|
||||||
verbose(1, "Non-absolute path MJIT_BUILD_DIR: %s", build_dir);
|
verbose(1, "Non-absolute path MJIT_BUILD_DIR: %s", build_dir);
|
||||||
}
|
}
|
||||||
else if (stat(build_dir, &st) || !S_ISDIR(st.st_mode)) {
|
else if (stat(build_dir, &st) || !S_ISDIR(st.st_mode)) {
|
||||||
|
@ -412,8 +417,14 @@ init_header_filename(void)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
/* Do not pass PRELOADENV to child processes, on
|
||||||
|
* multi-arch environment */
|
||||||
|
verbose(3, "PRELOADENV("PRELOADENV")=%s", getenv(PRELOADENV));
|
||||||
|
/* assume no other PRELOADENV in test-all */
|
||||||
|
unsetenv(PRELOADENV);
|
||||||
|
verbose(3, "MJIT_BUILD_DIR: %s", build_dir);
|
||||||
basedir = build_dir;
|
basedir = build_dir;
|
||||||
baselen = sizeof(build_dir) - 1;
|
baselen = strlen(build_dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,6 +30,10 @@ module JITSupport
|
||||||
args << '--jit-save-temps' if save_temps
|
args << '--jit-save-temps' if save_temps
|
||||||
args << '-e' << script
|
args << '-e' << script
|
||||||
base_env = { 'MJIT_SEARCH_BUILD_DIR' => 'true' } # workaround to skip requiring `make install` for `make test-all`
|
base_env = { 'MJIT_SEARCH_BUILD_DIR' => 'true' } # workaround to skip requiring `make install` for `make test-all`
|
||||||
|
if preloadenv = RbConfig::CONFIG['PRELOADENV'] and !preloadenv.empty?
|
||||||
|
so = "mjit_build_dir.#{RbConfig::CONFIG['SOEXT']}"
|
||||||
|
base_env[preloadenv] = File.realpath(so) rescue nil
|
||||||
|
end
|
||||||
args.unshift(env ? base_env.merge!(env) : base_env)
|
args.unshift(env ? base_env.merge!(env) : base_env)
|
||||||
EnvUtil.invoke_ruby(args,
|
EnvUtil.invoke_ruby(args,
|
||||||
'', true, true, timeout: timeout,
|
'', true, true, timeout: timeout,
|
||||||
|
|
Loading…
Add table
Reference in a new issue