Revert "Revert "Stop using (DY)LD_LIBRARY_PATH on Unix""

This reverts commit 941d5e737c.
This commit is contained in:
Brian Anderson 2011-10-09 15:23:41 -07:00
parent ecfa37d336
commit 96f6a1861c
3 changed files with 24 additions and 5 deletions

View File

@ -105,10 +105,9 @@ ifdef CFG_UNIXY
CFG_PATH_MUNGE := true
CFG_EXE_SUFFIX :=
CFG_LDPATH :=
CFG_RUN=$(CFG_LDENV)=$(1) $(2)
CFG_RUN_TARG=$(call CFG_RUN,$(CFG_BUILD_DIR)/$(HOST_LIB$(1)),$(2))
CFG_RUN_TEST=$(call CFG_RUN,$(call CFG_TESTLIB,$(1)),\
$(CFG_VALGRIND) $(1))
CFG_RUN=$(2)
CFG_RUN_TARG=$(call CFG_RUN,,$(2))
CFG_RUN_TEST=$(call CFG_RUN,,$(CFG_VALGRIND) $(1))
CFG_LIBUV_LINK_FLAGS=-lpthread
ifdef CFG_ENABLE_MINGW_CROSS

View File

@ -131,7 +131,7 @@ fn worker(p: port<request>) {
let spawnproc =
bind run::spawn_process(execparms.prog, execparms.args,
pipe_in.in, pipe_out.out, pipe_err.out);
let pid = with_lib_path(execparms.lib_path, spawnproc);
let pid = maybe_with_lib_path(execparms.lib_path, spawnproc);
os::libc::close(pipe_in.in);
os::libc::close(pipe_out.out);
@ -151,6 +151,18 @@ fn worker(p: port<request>) {
}
}
// Only windows needs to set the library path
#[cfg(target_os = "win32")]
fn maybe_with_lib_path<@T>(path: str, f: fn() -> T) -> T {
with_lib_path(path, f)
}
#[cfg(target_os = "linux")]
#[cfg(target_os = "macos")]
fn maybe_with_lib_path<@T>(_path: str, f: fn() -> T) -> T {
f()
}
fn with_lib_path<@T>(path: str, f: fn() -> T) -> T {
let maybe_oldpath = getenv(util::lib_path_env_var());
append_lib_path(path);

View File

@ -310,6 +310,14 @@ fn program_output(cx: cx, testfile: str, lib_path: str, prog: str,
cmdline: cmdline};
}
// Linux and mac don't require adjusting the library search path
#[cfg(target_os = "linux")]
#[cfg(target_os = "macos")]
fn make_cmdline(_libpath: str, prog: str, args: [str]) -> str {
#fmt["%s %s", prog, str::connect(args, " ")]
}
#[cfg(target_os = "win32")]
fn make_cmdline(libpath: str, prog: str, args: [str]) -> str {
#fmt["%s %s %s", lib_path_cmd_prefix(libpath), prog,
str::connect(args, " ")]