l.map(|p| p.clone())
}).collect::<Vec<_>>();
- let rpaths = get_rpaths(config, libs.as_slice());
- flags.push_all(rpaths_to_flags(rpaths.as_slice()).as_slice());
+ let rpaths = get_rpaths(config, libs[]);
+ flags.push_all(rpaths_to_flags(rpaths[])[]);
flags
}
fn rpaths_to_flags(rpaths: &[String]) -> Vec<String> {
let mut ret = Vec::new();
for rpath in rpaths.iter() {
- ret.push(format!("-Wl,-rpath,{}", (*rpath).as_slice()));
+ ret.push(format!("-Wl,-rpath,{}", (*rpath)[]));
}
return ret;
}
}
}
- log_rpaths("relative", rel_rpaths.as_slice());
- log_rpaths("fallback", fallback_rpaths.as_slice());
+ log_rpaths("relative", rel_rpaths[]);
+ log_rpaths("fallback", fallback_rpaths[]);
let mut rpaths = rel_rpaths;
- rpaths.push_all(fallback_rpaths.as_slice());
+ rpaths.push_all(fallback_rpaths[]);
// Remove duplicates
- let rpaths = minimize_rpaths(rpaths.as_slice());
+ let rpaths = minimize_rpaths(rpaths[]);
return rpaths;
}
let mut set = HashSet::new();
let mut minimized = Vec::new();
for rpath in rpaths.iter() {
- if set.insert(rpath.as_slice()) {
+ if set.insert(rpath[]) {
minimized.push(rpath.clone());
}
}
}
#[test]
- #[cfg(target_os = "freebsd")]
- fn test_rpath_relative() {
- let config = &mut RPathConfig {
- used_crates: Vec::new(),
- has_rpath: true,
- is_like_osx: false,
- out_filename: Path::new("bin/rustc"),
- get_install_prefix_lib_path: || panic!(),
- realpath: |p| Ok(p.clone())
- };
- let res = get_rpath_relative_to_output(config, &Path::new("lib/libstd.so"));
- assert_eq!(res, "$ORIGIN/../lib");
- }
-
- #[test]
- #[cfg(target_os = "dragonfly")]
+ #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
fn test_rpath_relative() {
let config = &mut RPathConfig {
used_crates: Vec::new(),
use fmt;
use io::{IoError, IoResult};
use libc::{mod, c_int, c_char, c_void};
-use path::{Path, GenericPath, BytesContainer};
-use ptr::{mod, RawPtr};
+use path::BytesContainer;
+use ptr;
use sync::atomic::{AtomicInt, INIT_ATOMIC_INT, SeqCst};
use sys::fs::FileDesc;
use os;
Ok(joined)
}
- #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
+ #[cfg(target_os = "freebsd")]
pub fn load_self() -> Option<Vec<u8>> {
unsafe {
use libc::funcs::bsd44::*;
if sz == 0 { return None; }
let mut v: Vec<u8> = Vec::with_capacity(sz as uint);
let err = sysctl(mib.as_mut_ptr(), mib.len() as ::libc::c_uint,
- v.as_mut_ptr() as *mut c_void, &mut sz,
+ v.as_mut_ptr() as *mut libc::c_void, &mut sz,
ptr::null_mut(), 0u as libc::size_t);
if err != 0 { return None; }
if sz == 0 { return None; }
}
}
+ #[cfg(target_os = "dragonfly")]
+ pub fn load_self() -> Option<Vec<u8>> {
+ use std::io;
+
+ match io::fs::readlink(&Path::new("/proc/curproc/file")) {
+ Ok(path) => Some(path.into_vec()),
+ Err(..) => None
+ }
+ }
+
#[cfg(any(target_os = "linux", target_os = "android"))]
pub fn load_self() -> Option<Vec<u8>> {
use std::io;