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

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

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

download() {
# Downloading version from "${VERFILE}"
$WGET -P $DOWNL ftp://ftp.mrunix.net/pub/webalizer/$SRC-src.tar.bz2
}

build() {
# Creating new
mkdir -p $PKG
mkdir -p $PKG/etc
mkdir -p $PKG/usr/bin
mkdir -p $PKG/usr/man/man1

tar jxvf $DOWNL/$SRC-src.tar.bz2
cd $SRC
#patch -p1 < $CWD/db1.patch
zcat $CWD/patches/db1.patch.gz | patch -p0 --verbose || exit
./configure \
 --prefix=/usr \
 --enable-dns --with-language=polish \
 --host=i686-ktm-linux --target=i686-ktm-linux --build=i686-ktm-linux || exit
make || exit
make install prefix=$PKG/usr ETCDIR=$PKG/etc || exit
    postbuild
}

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

