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

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

check() {
# Checking for configuration
# Downloading sources lists
INSTALLED="`ls -1 $PACKAGES/packages/|grep $PACKAGE|cut -d "-" -f 1,2`"
$WGET -q ftp://ftp.icm.edu.pl/pub/www/apache/dist/httpd/
NEW=`grep $PACKAGE index.html|grep .tar.gz|cut -d / -f 9|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.icm.edu.pl/pub/www/apache/dist/httpd/$SRC.tar.gz
}

build() {
# Creating new
tar zxvf $DOWNL/$SRC.tar.gz
cd $SRC
./configure \
    --enable-cgi \
    --enable-so \
    --enable-vhost-alias \
    --enable-http \
    --enable-module=all \
    --enable-layout=RedHat \
    --sysconfdir=/etc/httpd \
    --enable-expires \
    --enable-ssl \
    --with-ssl \
    $TARGET || exit
make || exit
make install DESTDIR=$PKG || exit
if [ -d /etc/httpd ]; then
mv $PKG/etc/httpd $PKG/etc/httpd.new
fi
mkdir $PKG/etc/rc.d/
cp $CWD/rc.httpd $PKG/etc/rc.d/
if [ -r /etc/rc.d/rc.httpd ];then
mv $PKG/etc/rc.d/rc.httpd $PKG/etc/rc.d/rc.httpd.new
fi
    postbuild
}

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