diff --git a/Cargo.toml b/Cargo.toml index 68cc838..da47eff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,5 @@ build = "build.rs" libc = ">=0.2" [build-dependencies] -# bindgen 0.26.x results in "already been defined in this module" errors (bug #687) -bindgen = "0.25.5" +bindgen = "0.29" pkg-config = "0.3.9" diff --git a/build.rs b/build.rs index c0efb2b..ed9b436 100644 --- a/build.rs +++ b/build.rs @@ -22,10 +22,10 @@ use std::io::prelude::*; use std::path::{Path, PathBuf}; use std::process::Command; -const MIN_VERSION: &'static str = "6.9"; -const MAX_VERSION: &'static str = "6.10"; +const MIN_VERSION: &'static str = "7.0"; +const MAX_VERSION: &'static str = "7.1"; -static HEADER: &'static str = "#include \n"; +static HEADER: &'static str = "#include \n"; fn main() { // Assert that the appropriate version of MagickWand is installed, @@ -42,7 +42,7 @@ fn main() { .arg(format!("--max-version={}", MAX_VERSION)) .arg("MagickWand") .status().unwrap().success() { - panic!("MagickWand version must be no higher than 6.9"); + panic!(format!("MagickWand version must be no higher than {}", MAX_VERSION)); } // We have to split the version check and the cflags/libs check because // you can't do both at the same time on RHEL (apparently). @@ -60,20 +60,26 @@ fn main() { // Geneate the bindings. let mut builder = bindgen::Builder::default() - .no_unstable_rust() .emit_builtins() .ctypes_prefix("libc") .raw_line("extern crate libc;") - .header(gen_h_path.to_str().unwrap()); + .header(gen_h_path.to_str().unwrap()) + /* https://github.com/rust-lang-nursery/rust-bindgen/issues/687 */ + .hide_type("FP_NAN") + .hide_type("FP_INFINITE") + .hide_type("FP_ZERO") + .hide_type("FP_SUBNORMAL") + .hide_type("FP_NORMAL"); + for include_path in library.include_paths { builder = builder.clang_arg(format!("-I{}", include_path.to_string_lossy())); } if cfg!(target_os = "freebsd") { // pkg_config does not seem to work properly on FreeBSD, so // hard-code the builder settings for the time being. - builder = builder.clang_arg("-I/usr/local/include/ImageMagick-6"); + builder = builder.clang_arg("-I/usr/local/include/ImageMagick-7"); // Need to hack the linker flags as well. - println!("cargo:rustc-link-lib=dylib=MagickWand-6"); + println!("cargo:rustc-link-lib=dylib=MagickWand-7"); println!("cargo:rustc-link-search=native=/usr/local/lib"); } let bindings = builder.generate().unwrap();