mk: Get "make check" passing with --disable-rpath

This involves passing through LD_LIBRARY_PATH through more places, specifically
in the compiletest, run-make, and doctest runners.
This commit is contained in:
Alex Crichton 2014-02-21 16:32:49 -08:00
parent 78d4bf851c
commit e26ba3605a
8 changed files with 35 additions and 14 deletions

View File

@ -341,10 +341,10 @@ endif
ifdef CFG_DISABLE_RPATH
ifeq ($$(OSTYPE_$(3)),apple-darwin)
RPATH_VAR$(1)_T_$(2)_H_$(3) := \
DYLD_LIBRARY_PATH="$$$$DYLD_LIBRARY_PATH:$$(HLIB$(1)_H_$(3))"
DYLD_LIBRARY_PATH="$$$$DYLD_LIBRARY_PATH:$$(CURDIR)/$$(HLIB$(1)_H_$(3))"
else
RPATH_VAR$(1)_T_$(2)_H_$(3) := \
LD_LIBRARY_PATH="$$$$LD_LIBRARY_PATH:$$(HLIB$(1)_H_$(3))"
LD_LIBRARY_PATH="$$$$LD_LIBRARY_PATH:$$(CURDIR)/$$(HLIB$(1)_H_$(3))"
endif
else
RPATH_VAR$(1)_T_$(2)_H_$(3) :=

View File

@ -706,8 +706,9 @@ check-stage$(1)-T-$(2)-H-$(3)-doc-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3)
ifeq ($(2),$$(CFG_BUILD))
$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)): $$(DOCTESTDEP_$(1)_$(2)_$(3)_$(4))
@$$(call E, run doc-$(4) [$(2)])
$$(Q)$$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) --test \
$$(CRATEFILE_$(4)) --test-args "$$(TESTARGS)" && touch $$@
$$(Q)$$(RPATH_VAR$(1)_T_$(2)_H_$(3)) \
$$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) --test \
$$(CRATEFILE_$(4)) --test-args "$$(TESTARGS)" && touch $$@
else
$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)):
touch $$@
@ -934,7 +935,8 @@ $(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
$(3)/test/run-make/$$* \
"$$(CC_$(3)) $$(CFG_GCCISH_CFLAGS_$(3))" \
$$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
"$$(TESTNAME)"
"$$(TESTNAME)" \
"$$(RPATH_VAR$(1)_T_$(2)_H_$(3))"
@touch $$@
else
# FIXME #11094 - The above rule doesn't work right for multiple targets

View File

@ -36,8 +36,26 @@ fn target_env(lib_path: &str, prog: &str) -> ~[(~str,~str)] {
#[cfg(target_os = "linux")]
#[cfg(target_os = "macos")]
#[cfg(target_os = "freebsd")]
fn target_env(_lib_path: &str, _prog: &str) -> ~[(~str,~str)] {
os::env()
fn target_env(lib_path: &str, prog: &str) -> ~[(~str,~str)] {
// Make sure we include the aux directory in the path
let aux_path = prog + ".libaux";
let mut env = os::env();
let var = if cfg!(target_os = "macos") {
"DYLD_LIBRARY_PATH"
} else {
"LD_LIBRARY_PATH"
};
let prev = match env.iter().position(|&(ref k, _)| k.as_slice() == var) {
Some(i) => env.remove(i).unwrap().val1(),
None => ~"",
};
env.push((var.to_owned(), if prev.is_empty() {
lib_path + ":" + aux_path
} else {
lib_path + ":" + aux_path + ":" + prev
}));
return env;
}
pub struct Result {status: ProcessExit, out: ~str, err: ~str}

View File

@ -17,6 +17,9 @@ os.putenv('TMPDIR', os.path.abspath(sys.argv[3]))
os.putenv('CC', sys.argv[4])
os.putenv('RUSTDOC', os.path.abspath(sys.argv[5]))
filt = sys.argv[6]
ldpath = sys.argv[7]
if ldpath != '':
os.putenv(ldpath.split('=')[0], ldpath.split('=')[1])
if not filt in sys.argv[1]:
sys.exit(0)

View File

@ -3,7 +3,7 @@
all:
$(RUSTC) lib.rs -C gen-crate-map
ln -nsf $(call DYLIB,boot-*) $(call DYLIB,boot)
$(CC) main.c -o $(call RUN,main) -lboot -Wl,-rpath,$(TMPDIR)
$(CC) main.c -o $(call RUN,main) -lboot
$(call RUN,main)
rm $(call DYLIB,boot)
$(call FAIL,main)

View File

@ -3,7 +3,7 @@
all:
$(RUSTC) lib.rs -C gen-crate-map
ln -nsf $(call DYLIB,boot-*) $(call DYLIB,boot)
$(CC) main.c -o $(call RUN,main) -lboot -Wl,-rpath,$(TMPDIR)
$(CC) main.c -o $(call RUN,main) -lboot
$(call RUN,main)
rm $(call DYLIB,boot)
$(call FAIL,main)

View File

@ -1,10 +1,5 @@
-include ../tools.mk
# needed so that libfoo can find libcfoo
ifeq ($(shell uname),Linux)
export LD_LIBRARY_PATH := $(TMPDIR)
endif
# This hits an assertion in the linker on older versions of osx apparently
ifeq ($(shell uname),Darwin)
all:

View File

@ -1,3 +1,6 @@
export LD_LIBRARY_PATH:=$(TMPDIR):$(LD_LIBRARY_PATH)
export DYLD_LIBRARY_PATH:=$(TMPDIR):$(DYLD_LIBRARY_PATH)
RUSTC := $(RUSTC) --out-dir $(TMPDIR) -L $(TMPDIR)
CC := $(CC) -L $(TMPDIR)