buildgm


#!/bin/bash
if [ -d /usr/local/include/GraphicsMagick ]; then
    echo GraphicsMagick already installed in /usr/local
else
    SAVE=`pwd`
    GMVER=1.3.23
    GMTARFILE=GraphicsMagick-${GMVER}.tar.bz2
    GMFOLDER=GraphicsMagick-${GMVER}
    GMDOWNLOAD="https://sourceforge.net/projects/graphicsmagick/files/graphicsmagick/${GMVER}/${GMTARFILE}/download"
    mkdir -p ~/GraphicsMagick
    cd ~/GraphicsMagick
    if [ -e ${GMTARFILE} ]; then
        echo ${GMTARFILE} already exists
    else
        echo Downloading ${GMTARFILE}
        sudo apt-get update
        wget -c "$GMDOWNLOAD" -O ${GMTARFILE}
    fi

    if [ -d ${GMFOLDER} ]; then
        echo folder ${GMFOLDER} already exists
    else
        echo uncompressing tarball 
        tar --bzip2 -xf ${GMTARFILE}
    fi

    cd ${GMFOLDER}
    ./configure CXXFLAGS=-std=c++11
    echo "Building GraphicsMagick ${GMVER} writing output to out.txt and err.txt.  Have patience this takes a long time..."
    sudo make install 1>out.txt 2>err.txt

    cd $SAVE 
fi