Crates.io | autotools |
lib.rs | autotools |
version | 0.2.7 |
source | src |
created_at | 2018-03-11 22:11:23.803754 |
updated_at | 2024-04-08 16:00:02.234593 |
description | A build dependency to build native libraries that use configure&make-style build systems |
homepage | https://github.com/lu-zero/autotools-rs |
repository | https://github.com/lu-zero/autotools-rs |
max_upload_size | |
id | 55071 |
size | 35,543 |
A build dependency to compile a native library that uses autotools or
a compatible configure
script + make
.
It is based on cmake-rs and the API tries to be as similar as possible to it.
The generated configure
script that is often bundled in release tarballs tends to be fairly big, convoluted and at least once has been a vector for
delivering malicious code (CVE-2024-3094.
It is advised to review configure.ac
and always regenerate configure
using reconf
.
For Emscripten targets like "wasm32-unknown-emscripten", configure
and
make
invocations are passed as arguments to emconfigure
and emmake
respectively as described in the Emscripten docs.
Make sure to set the env to CC=clang-{version}
and that the compiler is in the PATH
. If you are using install-llvm-action,
make sure to set env: true
.
Keep in mind that we rely on cc-rs
heuristics to select the C and C++ compilers. Some may be missing on your system, please make sure to set
the enviroment variables to select the correct compiler if
the heuristics fail (e.g. musl-gcc
might not exist while x86_64-linux-musl-gcc
does).
# Cargo.toml
[build-dependencies]
autotools = "0.2"
// build.rs
use autotools;
// Build the project in the path `foo` and installs it in `$OUT_DIR`
let dst = autotools::build("foo");
// Simply link the library without using pkg-config
println!("cargo:rustc-link-search=native={}", dst.display());
println!("cargo:rustc-link-lib=static=foo");
// build.rs
use autotools::Config;
let dst = Config::new("foo")
.reconf("-ivf")
.enable("feature", None)
.with("dep", None)
.disable("otherfeature", None)
.without("otherdep", None)
.cflag("-Wall")
.build();