#!/bin/bash
#===============================================================================
# Auteur : djibril
# Date   : 03/06/2013 15:32:19
# But    : Installation des libraires libpng, libjpeg... et des modules Perl GD
#===============================================================================

echo "===========================";
echo "Creation d'un repertoire temporaire pour les installations";
echo "===========================";
mkdir -p /tmp/GD

echo "===========================";
echo "Installation de zlib";
echo "===========================";
cd /tmp/GD
curl -O  http://djibril.developpez.com/tutoriels/perl/comment-installer-bibliotheque-gd/fichiers/zlib-1.2.8.tar.gz 
tar -xzvf ./zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure
make
make install

echo "===========================";
echo "Installation de libpng";
echo "===========================";
cd /tmp/GD
curl -O http://djibril.developpez.com/tutoriels/perl/comment-installer-bibliotheque-gd/fichiers/libpng-1.6.2.tar.gz
tar -xzvf ./libpng-1.6.2.tar.gz
cd libpng-1.6.2
./configure
make
make install

echo "===========================";
echo "Installation de libjpeg";
echo "===========================";
cd /tmp/GD
curl -O http://djibril.developpez.com/tutoriels/perl/comment-installer-bibliotheque-gd/fichiers/jpegsrc.v9.tar.gz
tar -xzvf ./jpegsrc.v9.tar.gz
cd jpeg-9
ln -s `which glibtool` ./libtool
./configure
make
make install

echo "===========================";
echo "Installation de freetype2";
echo "===========================";
cd /tmp/GD
curl -O http://djibril.developpez.com/tutoriels/perl/comment-installer-bibliotheque-gd/fichiers/freetype-2.4.12.tar.gz
tar -xzvf freetype-2.4.12.tar.gz
cd freetype-2.4.12
./configure
make
make install

echo "===========================";
echo "Installation de libgd";
echo "===========================";
cd /tmp/GD
curl -O http://djibril.developpez.com/tutoriels/perl/comment-installer-bibliotheque-gd/fichiers/libgd-2.1.0-rc1.tar.gz
tar -xvzf libgd-2.1.0-rc1.tar.gz
cd libgd-2.1.0-rc1
ln -s /usr/X11R6/include/fontconfig /usr/local/include
./configure
make
make install

echo "Installation du module Perl GD et GD::Text";
perl -MCPAN -e "install GD"
perl -MCPAN -e "install GD::Text"

echo "===========================";
echo "VERSION Module Perl GD";
echo "===========================";
perl -MGD -e "print $GD:VERSION"
