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

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

check() {
# Checking for configuration
# Downloading sources lists
INSTALLED="`ls -1 $PACKAGES/packages/|grep $PACKAGE|cut -d "-" -f 1,2`"
$WGET -q ftp://ftp.bit.nl/mirror/rrdtool/
NEW=`grep $PACKAGE- index.html |grep rdtool|grep tar.gz|cut -d '/' -f 6|cut -d '"' -f 1|grep -v cvs|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.bit.nl/mirror/rrdtool/$SRC.tar.gz
}

build() {
# Creating new
tar zxvf $DOWNL/$SRC.tar.gz
cd $SRC
./configure \
    --prefix=/usr \
    --enable-latin2 \
    --build=$TARGET \
    --host=$TARGET || exit
make || exit
make install DESTDIR=$PKG || exit
make site-perl-install DESTDIR=$PKG || exit
#mkdir -p $PKG/usr/lib/perl5/5.8.3/$ARCH-linux
#mv $PKG/usr/lib/perl/ $PKG/usr/lib/perl5/5.8.3/$ARCH-linux
#mv $PKG/usr/lib/perl/*.pm $PKG/usr/lib/perl5/site_perl/5.8.3/$ARCH-linux/
    postbuild
}

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

