#!/bin/sh
#
# kTm port by Juzer
#
#       regards to hns & psych
#

# local config:
BUILD="1"
PACKAGE="gimp"

check() {
# Checking for configuration
# Downloading sources lists
INSTALLED="`ls -1 $PACKAGES/packages/|grep $PACKAGE-|cut -d "-" -f 1,2`"
$WGET -q ftp://ftp.planetmirror.com/pub/gimp/gimp/stable/
NEW=`grep $PACKAGE index.html|grep .tar.bz2|cut -d / -f 8|cut -d '"' -f 1|sed -e s/.tar.*//|tail -1`
#Checking for new version
    checkpkg
# clean
rm index.html
}

download() {
# Downloading version from "${VERFILE}"
$WGET -P $DOWNL ftp://ftp.planetmirror.com/pub/gimp/gimp/stable/$SRC.tar.bz2
}

build() {
# Creating new
tar jxvf $DOWNL/$SRC.tar.bz2
cd $SRC
PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig ./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --localstatedir=/var/lib \
    --disable-static \
    --without-libtiff \
    --disable-print \
    $TARGET || exit
make || exit
make install DESTDIR=$PKG || exit
( cd $PKG/usr/man/man1
    ln -sf gimptool-2.0.1.gz gimptool.1.gz
    ln -sf gimp-remote-2.0.1.gz gimp-remote.1.gz
    ln -sf gimp-2.0.1.gz gimp.1.gz
    cd $PKG/usr/man/man5
    ln -sf gimprc-2.0.5.gz gimprc.5.gz
)
    postbuild
}

source "${DATA:-/usr/lib/ktm}/ktm.ports.sh"

