cd zlib-1.2.3
env CFLAGS="-O3 -fPIC" ./configure --prefix=$LIB_DIR
make
make install
# Building libpng
cd $BUILD_DIR
tar zxvf libpng-1.2.10.tar.gz
cd libpng-1.2.10
env CPPFLAGS="-I$LIB_DIR/include" LDFLAGS="-L$LIB_DIR/lib" CFLAGS="-O3 -fPIC" ./configure --disable-shared --prefix=$LIB_DIR
make
make install
# Building freetype
cd $BUILD_DIR
tar zxvf freetype-2.3.5.tar.gz
cd freetype-2.3.5
env CPPFLAGS="-I$LIB_DIR/include" LDFLAGS="-L$LIB_DIR/lib" CFLAGS="-O3 -fPIC" ./configure --disable-shared --prefix=$LIB_DIR
make
make install
# Building libart_lgpl
cd $BUILD_DIR
tar zxvf libart_lgpl-2.3.17.tar.gz
cd libart_lgpl-2.3.17
env CFLAGS="-O3 -fPIC" ./configure --disable-shared --prefix=$LIB_DIR
make
make install
# Setting environment variables
IR=-I$LIB_DIR/include
CPPFLAGS="$IR $IR/libart-2.0 $IR/freetype2 $IR/libpng"
LDFLAGS="-L$LIB_DIR/lib"
CFLAGS=-O3
export CPPFLAGS LDFLAGS CFLAGS
# Building RRDTool
cd $BUILD_DIR
tar zxvf rrdtool-1.2.27.tar.gz
cd rrdtool-1.2.27
./configure --prefix=$INSTALL_DIR --disable-python --disable-tcl
make
make install
ln -s /usr/local/rrdtool/bin/* /usr/local/bin/