2012-12-03 18:48:01 -06:00
|
|
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
2013-01-08 21:37:25 -06:00
|
|
|
use core::prelude::*;
|
|
|
|
|
2012-12-28 10:50:27 -06:00
|
|
|
use io;
|
|
|
|
use os;
|
2012-09-07 20:08:21 -05:00
|
|
|
use os::getenv;
|
2011-07-30 23:11:14 -05:00
|
|
|
|
2012-12-28 10:50:27 -06:00
|
|
|
use common;
|
2012-09-07 20:08:21 -05:00
|
|
|
use common::config;
|
2011-07-30 23:11:14 -05:00
|
|
|
|
2012-07-14 00:57:48 -05:00
|
|
|
fn make_new_path(path: ~str) -> ~str {
|
2011-07-30 23:11:14 -05:00
|
|
|
|
|
|
|
// Windows just uses PATH as the library search path, so we have to
|
|
|
|
// maintain the current value while adding our own
|
2012-08-06 14:34:08 -05:00
|
|
|
match getenv(lib_path_env_var()) {
|
2012-12-28 10:28:36 -06:00
|
|
|
Some(curr) => {
|
2012-08-22 19:24:52 -05:00
|
|
|
fmt!("%s%s%s", path, path_div(), curr)
|
2011-09-29 20:30:00 -05:00
|
|
|
}
|
2012-12-28 10:28:36 -06:00
|
|
|
None => path
|
2011-07-30 23:11:14 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(target_os = "linux")]
|
2011-12-30 02:18:55 -06:00
|
|
|
#[cfg(target_os = "freebsd")]
|
2012-07-14 00:57:48 -05:00
|
|
|
fn lib_path_env_var() -> ~str { ~"LD_LIBRARY_PATH" }
|
2011-07-30 23:11:14 -05:00
|
|
|
|
|
|
|
#[cfg(target_os = "macos")]
|
2012-07-14 13:05:10 -05:00
|
|
|
fn lib_path_env_var() -> ~str { ~"DYLD_LIBRARY_PATH" }
|
2011-07-30 23:11:14 -05:00
|
|
|
|
|
|
|
#[cfg(target_os = "win32")]
|
2012-07-14 13:05:10 -05:00
|
|
|
fn lib_path_env_var() -> ~str { ~"PATH" }
|
2011-07-30 23:11:14 -05:00
|
|
|
|
2011-09-29 20:30:00 -05:00
|
|
|
#[cfg(target_os = "linux")]
|
|
|
|
#[cfg(target_os = "macos")]
|
2011-12-30 02:18:55 -06:00
|
|
|
#[cfg(target_os = "freebsd")]
|
2012-07-14 00:57:48 -05:00
|
|
|
fn path_div() -> ~str { ~":" }
|
2011-09-29 20:30:00 -05:00
|
|
|
|
|
|
|
#[cfg(target_os = "win32")]
|
2012-07-14 20:28:20 -05:00
|
|
|
fn path_div() -> ~str { ~";" }
|
2011-09-29 20:30:00 -05:00
|
|
|
|
2012-07-14 00:57:48 -05:00
|
|
|
fn logv(config: config, s: ~str) {
|
2011-12-22 19:53:53 -06:00
|
|
|
log(debug, s);
|
2012-01-11 08:15:54 -06:00
|
|
|
if config.verbose { io::println(s); }
|
2011-07-30 23:11:14 -05:00
|
|
|
}
|