Skip to content

Instantly share code, notes, and snippets.

@Ghoughpteighbteau
Last active September 20, 2016 21:56
Show Gist options
  • Save Ghoughpteighbteau/d9d3e43090259ae73f07c0d0962bec19 to your computer and use it in GitHub Desktop.
Save Ghoughpteighbteau/d9d3e43090259ae73f07c0d0962bec19 to your computer and use it in GitHub Desktop.
VagrantFile for compilation environment for Mapnik
#!/bin/bash -x
set -e
# YOU NEED LOTS OF MEM
if [[ ! -e /swapfile ]]; then
echo "Swap file doesn't exist"
fallocate -l 2048M /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
if ! grep "/swapfile" /etc/fstab; then
echo "/swapfile none swap defaults 0 0" >> /etc/fstab
fi
fi
# DEPENDENCIES
apt-get update
apt-get -yy install git
## MAPNIK
apt-get -yy install \
build-essential \
g++ \
libboost-all-dev \
libboost1.58-dev \
libcairo2 \
libcairo2-dev \
libcairomm-1.0-1v5 \
libcairomm-1.0-dev \
libfreetype6 \
libfreetype6-dev \
libgdal1-dev \
libicu-dev \
libjpeg-dev \
libpng-dev \
libpq-dev \
libproj-dev \
libtiff-dev \
libtiff5 \
libtiff5-dev \
libxml2 \
libxml2-dev \
python-cairo \
python-cairo-dev \
python-dev \
python-gdal \
python-nose \
ttf-dejavu \
ttf-dejavu-core \
ttf-dejavu-extra \
ttf-unifont \
## HARFBUZZ
apt-get -yy install \
autoconf \
automake \
g++ \
gcc \
gtk-doc-tools \
libcairo2-dev \
libfreetype6-dev \
libglib2.0-dev \
libgraphite2-dev \
libtool \
pkg-config \
ragel \
## PYTHON-MAPNIK
apt-get -yy install \
python-setuptools \
easy_install pip
cd ~
# GET AND INITIALIZE REPOS
## MAPNIK
(
git clone "https://github.com/mapnik/mapnik.git"
cd mapnik/
git submodule update --init
)&
## HARFBUZZ
(
wget https://www.freedesktop.org/software/harfbuzz/release/harfbuzz-0.9.42.tar.bz2
tar xaf harfbuzz-0.9.42.tar.bz2
)&
## PYTHON-MAPNIK
(
git clone "https://github.com/mapnik/python-mapnik.git"
)&
wait
# COMPILE
## HARFBUZZ
( cd harfbuzz-0.9.42
#-prefix=/opt/harfbuzz
./configure && \
make && \
make install
) || exit 1
## MAPNIK
( cd ~/mapnik
#PREFIX=/opt/mapnik
python scons/scons.py configure XMLPARSER=libxml2 && \
python scons/scons.py && \
python scons/scons.py install
) || exit 1
## PYTHON-MAPNIK
( cd ~/python-mapnik
python setup.py install
easy_install ./dist/*.egg
) || exit 1
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/wily64"
config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
config.vm.provider :virtualbox do |vb|
vb.customize [
"modifyvm", :id,
"--memory", "2048",
"--cpus", "2"
]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment