Commit graph

16 commits

Author SHA1 Message Date
Nathan Fiedler
e7054d3e35 Use the rust-bindgen crate properly
Using the changes from @gadomski along with some additional work, to get the
generated bindings working again. Works on macOS and FreeBSD 11. A couple of
hacks are needed for FreeBSD, but nothing too serious.

Changed to use the libc prefix, and changed to use the generated enums.

Fixes #22, #15, and #14

cargo test passes
2017-04-08 16:03:58 -07:00
Pete Gadomski
4507d07c9c Update to the bingen crate 2017-04-07 06:24:00 -06:00
Nathan Fiedler
b22e97c908 Hack the MagickWand bindings
Using rust-bindgen to generate the bindings for the MagickWand library is
extremely difficult with the new versions of rust-bindgen. The old versions
of the generated bindings will be used for now, and nothing will be
generated at build time.

cargo test passes
2017-04-06 19:58:58 -07:00
Nathan Fiedler
2eccf1e91b Ensure pkg-config present when generating bindings
Not all systems have pkg-config installed by default.

cargo test passes
2016-10-20 08:51:25 -07:00
Nathan Fiedler
b63f25c550 Enforce MagickWand version in build.rs
It is very easy to overlook the version of MagickWand mentioned in the
README, so make sure the build system enforces it.

Fixes #19

cargo test passes
2016-10-16 11:00:06 -07:00
Nathan Fiedler
dd4becddd7 Hack to get build working on FreeBSD again
Due to a bug in rust-bindgen, use the bindings as generated on the Mac
for the same version of MagickWand as found on FreeBSD. That is, when
build.rs is invoked on a FreeBSD system, it will use the Mac-generated
bindings.rs rather than pulling down rust-bindgen and invoking it to
generate the bindings on the fly. See issue #385 in the rust-bindgen
project for details.

cargo test passes
2016-09-20 20:03:28 -07:00
Pete Gadomski
7563231707 Remove /usr/local/lib from rustc link search
If /usr/local/lib is in the search path, a Homebrew installed libJPEG
can end up conflicting with the system libJPEG as such:

```
$ otool -L /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
/System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO:
... snip ...
    /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libJPEG.dylib (compatibility version 1.0.0, current version 1.0.0)
... snip ...
```

```
$ cargo clean && cargo test
... snip ...
Doc-tests magick_rust
dyld: Symbol not found: __cg_jpeg_resync_to_restart
  Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /usr/local/lib/libJPEG.dylib
 in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
```

Removing the /usr/local/lib link search path allows successful
compilation and testing on my OSX 10.11.6, with jpeg 8d installed into
/usr/local/lib via Homebrew. I realize this might be a problem with my
setup and not a universal issue, but as Homebrew is so common I thought
I'd submit this patch anyways.
2016-08-25 07:54:49 -06:00
Nathan Fiedler
eec7998d25 Use new rust-bindgen crate for faster builds
Rather than cloning the bindgen repository and building from source, use
the packaged crate. The result is the rebuilds are much, much faster.
Also, had to make numerous changes for the new version of bindgen.

cargo test passes
2016-08-14 21:23:05 -07:00
Nathan Fiedler
96071ca377 Use Result.expect() in the suitable cases 2016-07-14 19:12:27 -07:00
Mattis Marjak
df6f812cf9 fix ldflags in build.rs 2016-05-17 22:18:17 +03:00
Mattis Marjak
c08a093dc3 cross-compile support for build.rs 2016-05-16 18:57:06 +03:00
Mattis Marjak
85a4b97b70 place generated files in OUT_DIR 2016-05-11 16:52:15 +03:00
Nathan Fiedler
3732fd5747 Report missing MagickWand-config in build.rs
Since build.rs requires MagickWand-config, make an effort to determine
if the executable is available or not, and panic with a clear course of
action. Otherwise the error is rather cryptic.

Fixes #3

cargo test passes
2016-03-23 18:00:52 -07:00
Nathan Fiedler
856a9e7c78 Handle building on macos a little better
First, only add the special environment variable when building on Mac OS
X. Second, look for the path to ensure the Xcode command line tools are
installed, and panic if that is not the case.

cargo test passes
2016-03-22 20:56:09 -07:00
Nathan Fiedler
04e1052266 Automatically build ImageMagick bindings
Leave the generated bindings out of the source repository and instead
have Cargo automatically build them if they are missing. This allows the
version of MagickWand to be incorporated into the bindings
automatically. For instance, in Homebrew the version is 6.Q16, while on
FreeBSD 10.2 it is 6.9, and only be generating the bindings for each
system can we ensure a smooth compilation process.
2016-01-25 19:58:43 -08:00
Nathan Fiedler
0474886c14 Include path to MagickWand for easier building 2015-12-23 11:34:51 -08:00