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

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

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

build() {
# Creating new
tar zxvf $DOWNL/$SRC.tar.gz
cd $SRC
./configure \
    --prefix=/usr \
    --with-sys-screenrc=/etc/screenrc \
    --with-pty-mode=0620 \
    --with-pty-group=5 \
    --enable-telnet \
    --disable-socket-dir \
    --enable-locale \
    --enable-colors256 \
    --enable-rxvt_osc \
    $TARGET || exit
make || exit
make install DESTDIR=$PKG || exit
rm -f $PKG/usr/info/dir
mkdir -p $PKG/etc/skel
cat etc/etcscreenrc > $PKG/etc/screenrc
cat etc/screenrc > $PKG/etc/skel/.screenrc
    postbuild
}

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

