Remove old cruft, document testing with Docker

This commit is contained in:
Nathan Fiedler 2017-08-19 20:10:23 -07:00
parent b748139e10
commit a1d50c2f01
5 changed files with 35 additions and 129 deletions

View file

@ -2,14 +2,25 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
This file follows the convention described at
[Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
## [Unreleased]
### Changed
- Upgrade bindgen to 0.29
- Change to MagickWand 7.0
- `get_quantum` and `set_quantum` now take `Quantum` instead of `u16`
- `resize_image` no longer takes a `blur_factor` argument
- `InterpolatePixelMethod` was renamed `PixelInterpolateMethod`
## [0.6.6] - 2017-07-08
### Changed
- Downgrade to version 0.25.5 of `bindgen` library to avoid errors on Linux.
## [0.6.5] - 2017-07-07
### Changed
### Added
- Add `compare_images()` method to `MagickWand` type.
### Changed
- Update to latest release of `bindgen` library.
## [0.6.4] - 2017-04-08
@ -48,11 +59,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- hjr3: Changed `read_image_blob()` to borrow data rather than take ownership.
## [0.5.0] - 2016-05-18
### Changed
### Added
- marjakm: Added numerous functions and enabled cross-compile support.
## [0.4.0] - 2016-03-29
### Changed
### Added
- Add functions for detecting and correcting image orientation.
## [0.3.3] - 2016-03-17
@ -68,7 +79,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Fix bug `get_image_property()` to ensure C string is copied.
## [0.3.0] - 2016-01-02
### Changed
### Added
- Add `get_image_property()` function to retrieve, for example, EXIF data.
## [0.2.3] - 2015-12-26
@ -84,7 +95,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Fix the cargo package name (replace dash with underscore).
## [0.2.0] - 2015-06-10
### Changed
### Added
- Add a `fit()` function for fitting an image to a given bounds.
## [0.1.0] - 2015-06-09

View file

@ -2,22 +2,19 @@
A somewhat safe Rust interface to the [ImageMagick](http://www.imagemagick.org/) system, in particular, the MagickWand library. Many of the functions in the MagickWand API are still missing, and those that are needed will be gradually added.
## Dependenices
## Dependencies
* Rust (~latest release)
* Cargo (~latest release)
* ImageMagick (version 6.9)
* ImageMagick (version 7.0)
- [FreeBSD](https://www.freebsd.org) provides this version
- [Homebrew](http://brew.sh) requires special steps:
+ `brew install imagemagick@6`
+ `brew link --force imagemagick@6`
+ `brew install imagemagick`
- Linux may require building ImageMagick from source
* Clang (version 3.5 or higher)
- Or whatever version is dictated by [rust-bindgen](https://github.com/servo/rust-bindgen)
* Must have `pkg-config` in order to link with MagickWand.
See the `docs/Development_Setup.md` file for details particular to each platform.
## Build and Test
Pretty simple for now.
@ -51,3 +48,19 @@ fn resize() -> Result<Vec<u8>, &'static str> {
```
Writing the image to a file rather than an in-memory blob is done by replacing the call to `write_image_blob()` with `write_image()`, which takes a string for the path to the file.
## Docker
[Docker](https://www.docker.com) can be used to build and test the code without
affecting your development environment, which may have a different version of
ImageMagick installed. The use of `docker-compose`, as shown in the example
below, is optional, but it makes the process very simple.
```
$ cd docker
$ docker-compose build
$ docker-compose start
$ docker-compose run magick-rust
$ cargo build
$ cargo test
```

View file

@ -1,42 +0,0 @@
# Development Setup
## Mac OS X
[Homebrew](http://brew.sh) is the easiest way to install everything on Mac.
1. Install Xcode
1. Install Homebrew
1. Install Rust and Cargo
1. Install ImageMagick
```
$ xcode-select --install
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew install rust
$ brew install imagemagick@6
$ brew link --force imagemagick@6
$ brew install pkg-config
```
Then build in the usual manner, as shown in the `README.md` file (i.e. `cargo build` and `cargo test`).
## FreeBSD
1. Install Rust
1. Install Cargo
1. Install ImageMagick
1. Install the Clang libraries
See the FreeBSD `fabfile.py` for an example of how to install everything. In particular, note that it may be necessary to set `LIBCLANG_PATH` to the path containing the `libclang.so` library.
Then build in the usual manner, as shown in the `README.md` file (i.e. `cargo build` and `cargo test`).
## Ubuntu Linux
1. Install Rust and Cargo
1. Install ImageMagick
1. Install the Clang libraries
See the Ubuntu `fabfile.py` for an example of how to install everything. In particular, note that it may be necessary to set `LIBCLANG_PATH` to the path containing the `libclang.so` library.
Then build in the usual manner, as shown in the `README.md` file (i.e. `cargo build` and `cargo test`). If running the tests fails because the MagickWand library cannot be found, try rebuilding the ldconfig cache (`sudo ldconfig`).

View file

@ -1,20 +0,0 @@
#
# Vagrantfile for Ubuntu Linux 16.04 test environment.
#
Vagrant.configure(2) do |config|
config.vm.box = 'ubuntu/xenial64'
# need enough memory to build syntex_syntax crate
config.vm.provider 'virtualbox' do |vb|
vb.memory = 2048
end
# bring the system up to date
config.vm.provision 'shell', inline: <<-SHELL
sudo apt-get -y autoremove
sudo apt-get -y update
sudo apt-get -y upgrade
SHELL
end

View file

@ -1,56 +0,0 @@
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------
#
# Copyright (c) 2016-2017 Nathan Fiedler
#
# This file is provided to you under the Apache License,
# Version 2.0 (the "License"); you may not use this file
# except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# -------------------------------------------------------------------
"""Fabric file for installing requirements on Ubuntu Linux."""
import os
from fabric.api import cd, env, run, sudo, task
env.hosts = ["default"]
env.use_ssh_config = True
if os.path.exists("user_ssh_config"):
env.ssh_config_path = "user_ssh_config"
else:
env.ssh_config_path = "ssh_config"
@task
def all():
"""Install everything needed to build magick-rust."""
sudo('apt-get -q -y install git')
sudo('apt-get -q -y install pkg-config')
# need the latest possible release of rust for bindgen to work
run('wget -O rustup-init https://sh.rustup.rs')
run('chmod +x rustup-init')
run('./rustup-init -y')
run('rm -f rustup-init')
sudo('apt-get -q -y build-dep imagemagick')
run('wget -q https://www.imagemagick.org/download/ImageMagick-6.9.8-10.tar.gz')
run('tar zxf ImageMagick-6.9.8-10.tar.gz')
with cd('ImageMagick-*'):
run('./configure')
run('make')
sudo('make install')
run('rm -rf ImageMagick*')
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")