rustbuild: allow configuring bindir

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
This commit is contained in:
Marc-Antoine Perennou 2017-04-28 11:01:15 +02:00
parent ae33d99bcd
commit b310a259f8
2 changed files with 14 additions and 5 deletions

View file

@ -100,6 +100,7 @@ pub struct Config {
pub musl_root: Option<PathBuf>, pub musl_root: Option<PathBuf>,
pub prefix: Option<PathBuf>, pub prefix: Option<PathBuf>,
pub docdir: Option<PathBuf>, pub docdir: Option<PathBuf>,
pub bindir: Option<PathBuf>,
pub libdir: Option<PathBuf>, pub libdir: Option<PathBuf>,
pub libdir_relative: Option<PathBuf>, pub libdir_relative: Option<PathBuf>,
pub mandir: Option<PathBuf>, pub mandir: Option<PathBuf>,
@ -165,9 +166,10 @@ struct Build {
#[derive(RustcDecodable, Default, Clone)] #[derive(RustcDecodable, Default, Clone)]
struct Install { struct Install {
prefix: Option<String>, prefix: Option<String>,
mandir: Option<String>,
docdir: Option<String>, docdir: Option<String>,
bindir: Option<String>,
libdir: Option<String>, libdir: Option<String>,
mandir: Option<String>,
} }
/// TOML representation of how the LLVM build is configured. /// TOML representation of how the LLVM build is configured.
@ -315,9 +317,10 @@ pub fn parse(build: &str, file: Option<PathBuf>) -> Config {
if let Some(ref install) = toml.install { if let Some(ref install) = toml.install {
config.prefix = install.prefix.clone().map(PathBuf::from); config.prefix = install.prefix.clone().map(PathBuf::from);
config.mandir = install.mandir.clone().map(PathBuf::from);
config.docdir = install.docdir.clone().map(PathBuf::from); config.docdir = install.docdir.clone().map(PathBuf::from);
config.bindir = install.bindir.clone().map(PathBuf::from);
config.libdir = install.libdir.clone().map(PathBuf::from); config.libdir = install.libdir.clone().map(PathBuf::from);
config.mandir = install.mandir.clone().map(PathBuf::from);
} }
if let Some(ref llvm) = toml.llvm { if let Some(ref llvm) = toml.llvm {
@ -526,6 +529,9 @@ macro_rules! check {
"CFG_DOCDIR" => { "CFG_DOCDIR" => {
self.docdir = Some(PathBuf::from(value)); self.docdir = Some(PathBuf::from(value));
} }
"CFG_BINDIR" => {
self.bindir = Some(PathBuf::from(value));
}
"CFG_LIBDIR" => { "CFG_LIBDIR" => {
self.libdir = Some(PathBuf::from(value)); self.libdir = Some(PathBuf::from(value));
} }

View file

@ -160,15 +160,18 @@
# Instead of installing to /usr/local, install to this path instead. # Instead of installing to /usr/local, install to this path instead.
#prefix = "/usr/local" #prefix = "/usr/local"
# Where to install documentation in `prefix` above
#docdir = "share/doc/rust"
# Where to install binaries in `prefix` above
#bindir = "bin"
# Where to install libraries in `prefix` above # Where to install libraries in `prefix` above
#libdir = "lib" #libdir = "lib"
# Where to install man pages in `prefix` above # Where to install man pages in `prefix` above
#mandir = "share/man" #mandir = "share/man"
# Where to install documentation in `prefix` above
#docdir = "share/doc/rust"
# ============================================================================= # =============================================================================
# Options for compiling Rust code itself # Options for compiling Rust code itself
# ============================================================================= # =============================================================================