diff --git a/.gitignore b/.gitignore index 815b982..4d47cc9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ -target +*.pyc Cargo.lock rust-bindgen +target diff --git a/docs/Development_Setup.md b/docs/Development_Setup.md index 110653a..5eebc80 100644 --- a/docs/Development_Setup.md +++ b/docs/Development_Setup.md @@ -2,16 +2,16 @@ ## Mac OS X +[Homebrew](http://brew.sh) is the easiest way to install everything on Mac. + 1. Install Xcode 1. Install Homebrew -1. Install Git 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 git $ brew install rust $ brew install imagemagick ``` @@ -20,51 +20,21 @@ Then build in the usual manner, as shown in the `README.md` file (i.e. `cargo bu ## FreeBSD -1. Install Git 1. Install Rust 1. Install Cargo 1. Install ImageMagick 1. Install the Clang libraries -``` -$ sudo pkg install -y git -$ sudo pkg install -y rust -$ sudo pkg install -y cargo -$ sudo pkg install -y ImageMagick-nox11 -$ sudo pkg install -y clang-devel -``` +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. -### Building - -The rust-bindgen tool (or one of its dependencies) needs a little help finding the Clang library during the build process, so set `LIBCLANG_PATH` to the path of `libclang.so`. The steps below work for FreeBSD 10.2. - -``` -$ setenv LIBCLANG_PATH /usr/local/llvm-devel/lib -$ cargo build -$ cargo test -``` +Then build in the usual manner, as shown in the `README.md` file (i.e. `cargo build` and `cargo test`). ## Ubuntu Linux -1. Install Git 1. Install Rust and Cargo 1. Install ImageMagick 1. Install the Clang libraries -These steps are known to work for Ubuntu Linux 14.04 LTS. +See the Ubuntu `fabfile.py` for an example of how to install everything. -``` -$ sudo apt-get install git -$ curl -sSf https://static.rust-lang.org/rustup.sh | sh -$ sudo apt-get build-dep imagemagick -$ wget http://www.imagemagick.org/download/ImageMagick.tar.gz -$ tar zxf ImageMagick.tar.gz -$ cd ImageMagick-* -$ ./configure -$ make -$ sudo make install -$ cd .. -$ sudo apt-get install libclang-dev -``` - -Then build in the usual manner, as shown in the `README.md` file (i.e. `cargo build` and `cargo test`). +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`). diff --git a/vagrant/freebsd10/.gitignore b/vagrant/freebsd10/.gitignore new file mode 100644 index 0000000..5db15d3 --- /dev/null +++ b/vagrant/freebsd10/.gitignore @@ -0,0 +1 @@ +ssh_config diff --git a/vagrant/freebsd10/Vagrantfile b/vagrant/freebsd10/Vagrantfile index 6af64f9..621a818 100644 --- a/vagrant/freebsd10/Vagrantfile +++ b/vagrant/freebsd10/Vagrantfile @@ -3,7 +3,9 @@ # Vagrant.configure(2) do |config| - config.vm.box = "freebsd/FreeBSD-10.2-RELEASE" + config.ssh.shell = 'sh' + + config.vm.box = 'freebsd/FreeBSD-10.2-RELEASE' # this box needs a MAC address config.vm.base_mac = '0800273E2877' @@ -13,11 +15,14 @@ Vagrant.configure(2) do |config| vb.memory = 2048 end + config.vm.synced_folder '.', '/vagrant', disabled: true + config.vbguest.auto_update = false + # bring the system up to date - config.vm.provision "shell", inline: <<-SHELL + config.vm.provision 'shell', privileged: false, inline: <<-SHELL sudo freebsd-update fetch install - sudo pkg update - sudo pkg upgrade -y + sudo pkg update -q + sudo pkg upgrade -q -y sudo pkg autoremove -y sudo pkg clean -y SHELL diff --git a/vagrant/freebsd10/fabfile.py b/vagrant/freebsd10/fabfile.py new file mode 100644 index 0000000..abae061 --- /dev/null +++ b/vagrant/freebsd10/fabfile.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# ------------------------------------------------------------------- +# +# Copyright (c) 2016 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 FreeBSD.""" + +import os + +from fabric.api import env, run, sudo, task + +env.shell = "/bin/sh -c" +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("pkg install -q -y git") + sudo("pkg install -q -y rust") + sudo("pkg install -q -y cargo") + sudo("pkg install -q -y ImageMagick-nox11") + 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) + run("echo 'setenv LIBCLANG_PATH /usr/local/llvm-devel/lib' >> .cshrc") diff --git a/vagrant/ubuntu14/.gitignore b/vagrant/ubuntu14/.gitignore new file mode 100644 index 0000000..5db15d3 --- /dev/null +++ b/vagrant/ubuntu14/.gitignore @@ -0,0 +1 @@ +ssh_config diff --git a/vagrant/ubuntu14/Vagrantfile b/vagrant/ubuntu14/Vagrantfile index 75b2f70..cb45709 100644 --- a/vagrant/ubuntu14/Vagrantfile +++ b/vagrant/ubuntu14/Vagrantfile @@ -3,7 +3,7 @@ # Vagrant.configure(2) do |config| - config.vm.box = "ubuntu/trusty64" + config.vm.box = 'ubuntu/trusty64' # need enough memory to build syntex_syntax crate config.vm.provider 'virtualbox' do |vb| @@ -11,10 +11,10 @@ Vagrant.configure(2) do |config| end # bring the system up to date - config.vm.provision "shell", inline: <<-SHELL - sudo apt-get autoremove - sudo apt-get update - sudo apt-get upgrade + config.vm.provision 'shell', inline: <<-SHELL + sudo apt-get -y autoremove + sudo apt-get -y update + sudo apt-get -y upgrade SHELL end diff --git a/vagrant/ubuntu14/fabfile.py b/vagrant/ubuntu14/fabfile.py new file mode 100644 index 0000000..ce2ce32 --- /dev/null +++ b/vagrant/ubuntu14/fabfile.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# ------------------------------------------------------------------- +# +# Copyright (c) 2014-2016 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.""" + run('sudo apt-get -q -y install git') + run('wget -q https://static.rust-lang.org/rustup.sh') + run('chmod +x rustup.sh') + run('./rustup.sh --yes') + run('rm -f rustup.sh') + sudo('apt-get -q -y build-dep imagemagick') + run('wget -q http://www.imagemagick.org/download/ImageMagick.tar.gz') + run('tar zxf ImageMagick.tar.gz') + with cd('ImageMagick-*'): + run('./configure') + run('make') + sudo('make install') + run('rm -rf ImageMagick*') + run('sudo apt-get -q -y install libclang-dev')