rpm-ostree/rust/libdnf-sys/build.rs
Colin Walters 47c60eb6ce libdnf: Various buildsys fixes
WITH_SWDB: Removed in 99309fbe04
WITH_GIR Removed in e2f2862bed

Also, most importantly: don't always reconfigure libdnf

This is a questionable default for the cargo `cmake` crate.
Building in Koji is failing I think due to timestamp issues
causing cmake to run twice.
2021-02-04 17:57:33 -05:00

39 lines
1.4 KiB
Rust

use anyhow::Result;
fn main() -> Result<()> {
system_deps::Config::new().probe()?;
use cmake::Config;
let libdnf = Config::new("../../libdnf")
// Needed for hardened builds
.cxxflag("-fPIC")
// I picked /usr/libexec/rpm-ostree just because we need an
// arbitrary path - we don't actually install there.
.define("CMAKE_INSTALL_PREFIX:PATH", "/usr/libexec/rpm-ostree")
.define(
"INCLUDE_INSTALL_DIR:PATH",
"/usr/libexec/rpm-ostree/include",
)
.define("LIB_INSTALL_DIR:PATH", "/usr/libexec/rpm-ostree")
.define("SYSCONF_INSTALL_DIR:PATH", "/usr/libexec/rpm-ostree/etc")
.define("SHARE_INSTALL_PREFIX:PATH", "/usr/libexec/rpm-ostree/share")
.define("ENABLE_STATIC:BOOL", "1")
.define("CMAKE_POSITION_INDEPENDENT_CODE", "ON")
// We don't need docs
.define("WITH_HTML:BOOL", "0")
.define("WITH_MAN:BOOL", "0")
// Don't need bindings
.define("WITH_BINDINGS:BOOL", "0")
// Needed in Koji at least because timestamps(?)
// cause cmake to rerun without our -D flags which
// breaks the build.
.always_configure(false)
.build_target("all")
.build();
println!(
"cargo:rustc-link-search=native={}/build/libdnf",
libdnf.display()
);
println!("cargo:rustc-link-lib=static=dnf");
Ok(())
}