#build-system #build-dependencies #configure #native #script #makefile #projects

build autotools

A build dependency to build native libraries that use configure&make-style build systems

13 releases

Uses old Rust 2015

0.2.7 Apr 8, 2024
0.2.6 Feb 20, 2023
0.2.5 Feb 27, 2022
0.2.4 Dec 13, 2021
0.1.2 Mar 11, 2018

#23 in Build Utils

Download history 38933/week @ 2024-07-30 36465/week @ 2024-08-06 35013/week @ 2024-08-13 31299/week @ 2024-08-20 29395/week @ 2024-08-27 33119/week @ 2024-09-03 27337/week @ 2024-09-10 18931/week @ 2024-09-17 29994/week @ 2024-09-24 28925/week @ 2024-10-01 27939/week @ 2024-10-08 35727/week @ 2024-10-15 38647/week @ 2024-10-22 44501/week @ 2024-10-29 41314/week @ 2024-11-05 34756/week @ 2024-11-12

164,821 downloads per month
Used in 228 crates (38 directly)

MIT license

33KB
484 lines

autotools/configure&make support for build.rs

LICENSE dependency status crates.io docs.rs Actions Status

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.

Autotools concern

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.

Cross compiling

Emscripten

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.

Custom LLVM on macOS

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.

Other compilers

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();

Dependencies

~215–305KB