Building without autotools
Since autotools are such a pain, I've looked at making it a pure Rust build.
The sys crates need to expose location of their headers:
https://github.com/gtk-rs/gir/pull/678
Once this is released, the directory with remaining C files can be changed into a Rust crate by dropping Cargo.toml
and build.rs
like this:
use std::env;
extern crate cc;
fn main() {
let mut cc = cc::Build::new();
cc.include("..");
// Expose internals
cc.define("RSVG_COMPILATION", Some("1"));
for var_name in ["DEP_GLIB_INCLUDE", "DEP_CAIRO_INCLUDE", "DEP_PANGO_INCLUDE", "DEP_GDK_PIXBUF_INCLUDE"].iter() {
let var = env::var_os(var_name).expect(var_name);
for inc in env::split_paths(&var) {
cc.include(inc);
}
}
cc.file("librsvg-enum-types.c");
cc.file("librsvg-features.c");
cc.file("rsvg-base.c");
cc.file("rsvg-handle.c");
cc.file("rsvg-pixbuf.c");
cc.compile("rsvg_legacy");
}