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

# local config:
BUILD="1"
PACKAGE="alsa-driver"

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

build() {
# Creating new
KVERSION=`/bin/uname -r`
tar jxvf $DOWNL/$SRC.tar.bz2
cd $SRC
./configure \
    --prefix=/usr \
    --with-cards=ens1371 \
    --with-oss=yes \
    --with-redhat=no \
    --sysconfdir=/etc \
    --with-sequencer=yes \
    $TARGET || exit
make || exit
make install DESTDIR=$PKG || exit
rm $PKG/lib/modules/$KVERSION/*
( cd $PKG/lib/modules
    find . -type f -name "*.o" -exec gzip -9 {} \;
)
    postbuild
}

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

