Skip to content

Commit 0a577f3

Browse files
committedNov 17, 2013
auto merge of #10454 : z0w0/rust/issue-9944, r=cmr
Allows you to provide explicit `--cfg` flags when building certain packages through the rustpkg API.
2 parents b0e1318 + 5748699 commit 0a577f3

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed
 

‎src/librustpkg/api.rs

+12-2
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ pub fn new_workcache_context(p: &Path) -> workcache::Context {
8181

8282
pub fn build_lib(sysroot: Path, root: Path, name: ~str, version: Version,
8383
lib: Path) {
84+
build_lib_with_cfgs(sysroot, root, name, version, lib, ~[])
85+
}
86+
87+
pub fn build_lib_with_cfgs(sysroot: Path, root: Path, name: ~str,
88+
version: Version, lib: Path, cfgs: ~[~str]) {
8489
let cx = default_context(sysroot, root.clone());
8590
let pkg_src = PkgSrc {
8691
source_workspace: root.clone(),
@@ -94,11 +99,16 @@ pub fn build_lib(sysroot: Path, root: Path, name: ~str, version: Version,
9499
tests: ~[],
95100
benchs: ~[]
96101
};
97-
pkg_src.build(&cx, ~[], []);
102+
pkg_src.build(&cx, cfgs, []);
98103
}
99104

100105
pub fn build_exe(sysroot: Path, root: Path, name: ~str, version: Version,
101106
main: Path) {
107+
build_exe_with_cfgs(sysroot, root, name, version, main, ~[])
108+
}
109+
110+
pub fn build_exe_with_cfgs(sysroot: Path, root: Path, name: ~str,
111+
version: Version, main: Path, cfgs: ~[~str]) {
102112
let cx = default_context(sysroot, root.clone());
103113
let pkg_src = PkgSrc {
104114
source_workspace: root.clone(),
@@ -113,7 +123,7 @@ pub fn build_exe(sysroot: Path, root: Path, name: ~str, version: Version,
113123
benchs: ~[]
114124
};
115125

116-
pkg_src.build(&cx, ~[], []);
126+
pkg_src.build(&cx, cfgs, []);
117127
}
118128

119129
pub fn install_pkg(cx: &BuildContext,

0 commit comments

Comments
 (0)
Please sign in to comment.