Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 25, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions mk/main.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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) :=
Expand Down
8 changes: 5 additions & 3 deletions mk/tests.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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 $$@
Expand Down Expand Up @@ -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
Expand Down
22 changes: 20 additions & 2 deletions src/compiletest/procsrv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
3 changes: 3 additions & 0 deletions src/etc/maketest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
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)
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-make/bootstrap-from-c-with-green/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion src/test/run-make/bootstrap-from-c-with-native/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
5 changes: 0 additions & 5 deletions src/test/run-make/c-dynamic-dylib/Makefile
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
3 changes: 3 additions & 0 deletions src/test/run-make/tools.mk
Original file line number Diff line number Diff line change
@@ -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)

Expand Down