4a62e1ecbb55f075b3e3a5e8d3d7bc0ca7239a6e
[discourse_docker.git] / image / base / install-imagemagick
1 #!/bin/bash
2 set -o errexit
3
4 # Install build deps
5 apt-get -y -q remove imagemagick
6 apt-get -y -q install ghostscript gsfonts pkg-config autoconf libbz2-dev libjpeg-dev libtiff-dev libfreetype6-dev
7
8 PREFIX=/usr/local
9 WDIR=/tmp/imagemagick
10 mkdir -p $WDIR
11
12 # Build and install libpng
13 git clone -b v1.6.21 git://git.code.sf.net/p/libpng/code $WDIR/libpng
14 cd $WDIR/libpng
15 ./autogen.sh
16 ./configure --prefix=$PREFIX
17 make all && make install
18
19
20
21 # Build and install ImageMagick
22 wget -O $WDIR/ImageMagick.tar.gz "http://www.imagemagick.org/download/ImageMagick-6.9.4-7.tar.gz"
23 IMDIR=$WDIR/$(tar tzf $WDIR/ImageMagick.tar.gz --wildcards "ImageMagick-*/configure" |cut -d/ -f1)
24 tar zxf $WDIR/ImageMagick.tar.gz -C $WDIR
25 cd $IMDIR
26 PKG_CONF_LIBDIR=$PREFIX/lib LDFLAGS=-L$PREFIX/lib CFLAGS=-I$PREFIX/include ./configure \
27 --prefix=$PREFIX \
28 --enable-static \
29 --enable-bounds-checking \
30 --enable-hdri \
31 --enable-hugepages \
32 --with-threads \
33 --with-modules \
34 --with-quantum-depth=16 \
35 --without-magick-plus-plus \
36 --with-bzlib \
37 --with-zlib \
38 --without-autotrace \
39 --with-freetype \
40 --with-jpeg \
41 --without-lcms \
42 --with-lzma \
43 --with-png \
44 --with-tiff
45 make all && make install
46
47
48 cd $HOME
49 rm -rf $WDIR
50 ldconfig