Ensure pkg-config present when generating bindings

Not all systems have pkg-config installed by default.

cargo test passes
This commit is contained in:
Nathan Fiedler
2016-10-20 08:49:24 -07:00
parent b63f25c550
commit 2eccf1e91b
7 changed files with 24 additions and 11 deletions

View File

@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## [0.6.2] - 2016-10-20
### Changed
- Presence of `pkg-config` checked in `build.rs` script at build time.
## [0.6.1] - 2016-10-16
### Changed
- MagickWand version enforced in `build.rs` script at build time.

View File

@ -1,6 +1,6 @@
[package]
name = "magick_rust"
version = "0.6.1"
version = "0.6.2"
authors = ["Nathan Fiedler <nathanfiedler@fastmail.fm>"]
description = "Selection of Rust bindings for the ImageMagick library."
homepage = "https://github.com/nlfiedler/magick-rust"

View File

@ -13,6 +13,7 @@ A somewhat safe Rust interface to the [ImageMagick](http://www.imagemagick.org/)
- Or whatever version is dictated by rust-bindgen
* [rust-bindgen](https://github.com/Yamakaky/rust-bindgen) (version 0.19 or higher)
- This will be installed automatically if it is missing.
* Must have `pkg-config` in order to link with MagickWand.
See the `docs/Development_Setup.md` file for details particular to each platform.

View File

@ -40,14 +40,6 @@ fn run_bindgen(out_dir: String, bindings_path_str: &str) {
.status().expect("cargo install bindgen");
}
// Check that MagickWand is installed before proceeding.
if !Command::new("pkg-config")
.arg("--exists")
.arg("MagickWand")
.status().unwrap().success() {
panic!("MagickWand library must be installed");
}
// Get the compiler flags for the MagickWand library.
let mw_cflags_output = Command::new("pkg-config")
.arg("--cflags")
@ -117,6 +109,19 @@ fn run_bindgen(out_dir: String, bindings_path_str: &str) {
}
fn assert_mw_version() {
// This build script depeneds heavily on the pkg-config utility.
if !Command::new("which")
.arg("pkg-config")
.status().unwrap().success() {
panic!("Cannot find pkg-config, see the README");
}
// Check that MagickWand is installed before proceeding.
if !Command::new("pkg-config")
.arg("--exists")
.arg("MagickWand")
.status().unwrap().success() {
panic!("MagickWand library must be installed");
}
//
// So far there is only 6.9 and then 7.x, so comparing to 6.10 should
// work for now. Such a release may very well work, but we will have to

View File

@ -14,6 +14,7 @@ $ xcode-select --install
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew install rust
$ brew install imagemagick
$ brew install pkg-config
```
Then build in the usual manner, as shown in the `README.md` file (i.e. `cargo build` and `cargo test`).

View File

@ -40,6 +40,7 @@ def all():
sudo("pkg install -q -y rust")
sudo("pkg install -q -y cargo")
sudo("pkg install -q -y ImageMagick-nox11")
sudo("pkg install pkgconf")
sudo("pkg install -q -y clang-devel")
# set LIBCLANG_PATH so rustc can find libclang.so in its hidden place
# (using the append operation results in 'Unmatched ".' error)

View File

@ -35,7 +35,8 @@ else:
@task
def all():
"""Install everything needed to build magick-rust."""
run('sudo apt-get -q -y install git')
sudo('apt-get -q -y install git')
sudo('apt-get install pkg-config')
# the rustc and cargo packages are fairly old, so build from source
run('wget -q https://static.rust-lang.org/rustup.sh')
run('chmod +x rustup.sh')
@ -49,7 +50,7 @@ def all():
run('make')
sudo('make install')
run('rm -rf ImageMagick*')
run('sudo apt-get -q -y install clang libclang-dev')
sudo('apt-get -q -y install clang libclang-dev')
# set LIBCLANG_PATH so rustc can find libclang.so in its hidden place
# (using the append operation results in 'Unmatched ".' error)
run("echo 'export LIBCLANG_PATH=/usr/lib/llvm-3.8/lib' >> .bashrc")