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

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

check() {
# Checking for configuration
# Downloading sources lists
INSTALLED="`ls -1 $PACKAGES/packages/|grep $PACKAGE-|cut -d "-" -f 1,2|head -1`"
$WGET -q ftp://ftp.gnu.org/pub/gnu/bc/
NEW=`grep $PACKAGE- index.html|grep .tar|cut -d / -f 7|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 http://ftp.gnu.org/pub/gnu/bc/$SRC.tar.gz
}

build() {
# Creating new
tar zxvf $DOWNL/$SRC.tar.gz
cd $SRC
zcat $CWD/bc-1.06.readline.diff.gz | patch -p1 --verbose --backup --suffix=.orig
./configure \
    --prefix=/usr \
    --with-readline \
    $TARGET || exit
make || exit
make install DESTDIR=$PKG || exit
rm $PKG/usr/info/dir
    postbuild
}

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

