Struct autotools::Config [−][src]
pub struct Config { /* fields omitted */ }
Builder style configuration for a pending autotools build.
Note
Note that host
and target
have different meanings for Rust
than for Gnu autotools. For Rust, the “host” machine is the one where the
compiler is running, and the “target” machine is the one where the
compiled artifact (library or binary) will be executed.
For Gnu autotools, the machine where the compiler is running is called
the “build” machine; the one where the compiled artifact will be
executed is called the “host” machine; and if the compiled artifact
happens to be a cross-compiler, it will generate code for a “target”
machine; otherwise “target” will coincide with “host”.
Hence Rust’s host
corresponds to Gnu autotools’ “build” and Rust’s
target
corresponds to their “host” (though the relevant names will sometimes
differ slightly).
The host
and target
methods on this package’s autotools::Config
structure (as well as
the $HOST
and $TARGET
variables set by cargo) are understood with their
Rust meaning.
When cross-compiling, we try to calculate automatically what Gnu autotools will expect for its
“host” value, and supply that to the configure
script using a --host="..."
argument. If the
auto-calculation is incorrect, you can override it with the config_option
method, like this:
use autotools; // Builds the project in the directory located in `libfoo`, installing it // into $OUT_DIR let mut cfg = autotools::Config::new("libfoo_source_directory"); cfg.config_option("host", Some("i686-pc-windows-gnu")); let dst = cfg.build(); println!("cargo:rustc-link-search=native={}", dst.display()); println!("cargo:rustc-link-lib=static=foo");
Implementations
impl Config
[src]
impl Config
[src]pub fn new<P: AsRef<Path>>(path: P) -> Config
[src]
pub fn new<P: AsRef<Path>>(path: P) -> Config
[src]Creates a new blank set of configuration to build the project specified
at the path path
.
pub fn enable_shared(&mut self) -> &mut Config
[src]
pub fn enable_shared(&mut self) -> &mut Config
[src]Enables building as a shared library (--enable-shared
).
pub fn disable_shared(&mut self) -> &mut Config
[src]
pub fn disable_shared(&mut self) -> &mut Config
[src]Disables building as a shared library (--disable-shared
).
pub fn enable_static(&mut self) -> &mut Config
[src]
pub fn enable_static(&mut self) -> &mut Config
[src]Enables building as a static library (--enable-static
).
pub fn disable_static(&mut self) -> &mut Config
[src]
pub fn disable_static(&mut self) -> &mut Config
[src]Disables building as a static library (--disable-static
).
pub fn make_args(&mut self, flags: Vec<String>) -> &mut Config
[src]
pub fn make_args(&mut self, flags: Vec<String>) -> &mut Config
[src]Additional arguments to pass through to make
.
pub fn config_option<P: AsRef<OsStr>>(
&mut self,
opt: P,
optarg: Option<P>
) -> &mut Config
[src]
pub fn config_option<P: AsRef<OsStr>>(
&mut self,
opt: P,
optarg: Option<P>
) -> &mut Config
[src]Passes --<opt><=optarg>
to configure.
pub fn enable<P: AsRef<OsStr>>(
&mut self,
opt: P,
optarg: Option<P>
) -> &mut Config
[src]
pub fn enable<P: AsRef<OsStr>>(
&mut self,
opt: P,
optarg: Option<P>
) -> &mut Config
[src]Passes --enable-<opt><=optarg>
to configure.
pub fn disable<P: AsRef<OsStr>>(
&mut self,
opt: P,
optarg: Option<P>
) -> &mut Config
[src]
pub fn disable<P: AsRef<OsStr>>(
&mut self,
opt: P,
optarg: Option<P>
) -> &mut Config
[src]Passes --disable-<opt><=optarg>
to configure.
pub fn with<P: AsRef<OsStr>>(
&mut self,
opt: P,
optarg: Option<P>
) -> &mut Config
[src]
pub fn with<P: AsRef<OsStr>>(
&mut self,
opt: P,
optarg: Option<P>
) -> &mut Config
[src]Passes --with-<opt><=optarg>
to configure.
pub fn without<P: AsRef<OsStr>>(
&mut self,
opt: P,
optarg: Option<P>
) -> &mut Config
[src]
pub fn without<P: AsRef<OsStr>>(
&mut self,
opt: P,
optarg: Option<P>
) -> &mut Config
[src]Passes --without-<opt><=optarg>
to configure.
pub fn cflag<P: AsRef<OsStr>>(&mut self, flag: P) -> &mut Config
[src]
pub fn cflag<P: AsRef<OsStr>>(&mut self, flag: P) -> &mut Config
[src]Adds a custom flag to pass down to the C compiler, supplementing those that this library already passes.
Default flags for the chosen compiler have lowest priority, then any
flags from the environment variable $CFLAGS
, then any flags specified
with this method.
pub fn cxxflag<P: AsRef<OsStr>>(&mut self, flag: P) -> &mut Config
[src]
pub fn cxxflag<P: AsRef<OsStr>>(&mut self, flag: P) -> &mut Config
[src]Adds a custom flag to pass down to the C++ compiler, supplementing those that this library already passes.
Default flags for the chosen compiler have lowest priority, then any
flags from the environment variable $CXXFLAGS
, then any flags specified
with this method.
pub fn ldflag<P: AsRef<OsStr>>(&mut self, flag: P) -> &mut Config
[src]
pub fn ldflag<P: AsRef<OsStr>>(&mut self, flag: P) -> &mut Config
[src]Adds a custom flag to pass down to the linker, supplementing those that this library already passes.
Flags from the environment variable $LDFLAGS
have lowest priority,
then any flags specified with this method.
pub fn target(&mut self, target: &str) -> &mut Config
[src]
pub fn target(&mut self, target: &str) -> &mut Config
[src]Sets the target triple for this compilation.
This is automatically scraped from $TARGET
which is set for Cargo
build scripts so it’s not necessary to call this from a build script.
See Note on the differences between Rust’s and autotools’ interpretation of “target” (this method assumes the former).
pub fn host(&mut self, host: &str) -> &mut Config
[src]
pub fn host(&mut self, host: &str) -> &mut Config
[src]Sets the host triple for this compilation.
This is automatically scraped from $HOST
which is set for Cargo
build scripts so it’s not necessary to call this from a build script.
See Note on the differences between Rust’s and autotools’ interpretation of “host” (this method assumes the former).
pub fn out_dir<P: AsRef<Path>>(&mut self, out: P) -> &mut Config
[src]
pub fn out_dir<P: AsRef<Path>>(&mut self, out: P) -> &mut Config
[src]Sets the output directory for this compilation.
This is automatically scraped from $OUT_DIR
which is set for Cargo
build scripts so it’s not necessary to call this from a build script.
pub fn env<K, V>(&mut self, key: K, value: V) -> &mut Config where
K: AsRef<OsStr>,
V: AsRef<OsStr>,
[src]
pub fn env<K, V>(&mut self, key: K, value: V) -> &mut Config where
K: AsRef<OsStr>,
V: AsRef<OsStr>,
[src]Configure an environment variable for the configure && make
processes
spawned by this crate in the build
step.
If you want to set $CFLAGS
, $CXXFLAGS
, or $LDFLAGS
, consider using the
cflag,
cxxflag, or
ldflag
methods instead, which will append to any external
values. Setting those environment variables here will overwrite the
external values, and will also discard any flags determined by the chosen
compiler.
autotools::Config
will automatically pass $CC
and $CXX
values to
the configure
script based on the chosen compiler. Setting those
variables here will override, and interferes with other parts of this
library, so is not recommended.
pub fn reconf<P: AsRef<OsStr>>(&mut self, flags: P) -> &mut Config
[src]
pub fn reconf<P: AsRef<OsStr>>(&mut self, flags: P) -> &mut Config
[src]Options to pass through to autoreconf
prior to configuring the build.
pub fn make_target(&mut self, make_target: &str) -> &mut Config
[src]
pub fn make_target(&mut self, make_target: &str) -> &mut Config
[src]Build the given make target.
If this function is not called, the build will default to make install
.
pub fn insource(&mut self, build_insource: bool) -> &mut Config
[src]
pub fn insource(&mut self, build_insource: bool) -> &mut Config
[src]Build the library in-source.
This is generally not recommended, but can be required for libraries that make extensive use of nested Makefiles, which cannot be included in out-of-source builds.