##
##  obmtool.conf -- OpenPKG poor man's Boot, Build & Management Tool Configuration
##
##  Package listing for Kolab
##
##  based on Ralf S. Engelschall's "obmtool.conf -- Development Tool Configuration"
##  Copyright (c) 2004-2006 Steffen Hansen <steffen@klaralvdalens-datakonsult.se>
##  Copyright (c) 2003 Thomas Lotterer <thomas@lotterer.net>
##

%common
    @hasfeature TAGFMT || exit              # require obmtool to support TAGFMT
    TMPDIR=/var/tmp                            # large tmp with 300MB space
    URL="" # used for non-ftp://ftp.openpkg.org/ packages
    USERNAME=""
    for opt in $cmdargs ; do
        arg=`echo "${opt}" | sed -e 's;^[^=]*=*;;'`
        opt=`echo "${opt}" | sed -e 's;=.*$;;'`
        case $opt in
        -u|--user) USERNAME="$arg";;
        --url) URL="";;
        esac
    done

%kolab
    echo "---- boot/build ${NODE} %${CMD} ----"
    kolab_version="2.1beta4";
    PREFIX=/${CMD};
    loc='./' # '' (empty) for ftp.openpkg.org, '=' for URL, './' for CWD or absolute path
    plusloc='./'
    altloc='./'
    with_genuine=no

    # Check for presence of libgcrypt in the host system
    libgcrypt_pfx=`eval libgcrypt-config --prefix 2>/dev/null`;
    if test -n "$libgcrypt_pfx" ; then
	echo "libgcrypt installation in $libgcrypt_pfx detected";
	echo "Please deinstall it or move libgcrypt-config away";
	echo "while building Kolab"
	exit -1;
    fi

    # start from scratch or upgrade within 2.0.x
    @install ${loc}openpkg-2.5.4-2.5.4 \
        --tag="kolab" \
        --prefix="${PREFIX}" \
        --user="${CMD}" --group="${CMD}" \
        --muid="19414" --ruid="19415" --nuid="19416" \
        --mgid="19414" --rgid="19415" --ngid="19416"

    if test -n "$USERNAME" ; then
      $PREFIX/bin/openpkg register --mode=post --user=$USERNAME
      $PREFIX/bin/openpkg register --printstatus && echo "Please associate the instance now. Then RETURN to continue." && read DUMMY
    fi
    @install ${loc}make-3.80-2.5.0
    @install ${loc}binutils-2.16.1-2.5.1
    @install ${loc}gcc-4.0.2-2.5.0
    @install ${loc}fsl-1.6.1-2.5.0
    @install ${loc}mm-1.4.0-2.5.0
    @install ${loc}perl-5.8.7-2.5.1
    @install ${loc}perl-openpkg-5.8.7-2.5.0
    @install ${loc}perl-conv-5.8.7-2.5.0
    @install ${loc}lzo-2.01-2.5.0 # PENDING(steffen) Check if we need lzop-1.0
    @install ${loc}readline-5.0.5-2.5.0
    @install ${loc}sharutils-4.5.1-2.5.0
    @install ${loc}ncurses-5.5.20051015-2.5.0
    @install ${loc}bzip2-1.0.3-2.5.0
    @install ${loc}pcre-6.4-2.5.0
    @install ${loc}grep-2.5.1a-2.5.0
    @install ${loc}texinfo-4.8-2.5.1
    @install ${loc}diffutils-2.8.7-2.5.0
    @install ${loc}gzip-1.3.5-2.5.1
    @install ${loc}zlib-1.2.3-2.5.0
    @install ${loc}expat-1.95.8-2.5.0
    @install ${loc}perl-term-5.8.7-2.5.0
    @install ${loc}perl-ds-5.8.7-2.5.0
    @install ${loc}perl-stats-5.8.7-2.5.0
    @install ${loc}perl-time-5.8.7-2.5.0
    @install ${loc}perl-util-5.8.7-2.5.0
    @install ${loc}perl-parse-5.8.7-2.5.0
    @install ${loc}perl-sys-5.8.7-2.5.0
    @install ${loc}openssl-0.9.8a-2.5.4
    @install ${loc}perl-mail-5.8.7-2.5.0
    @install ${loc}perl-crypto-5.8.7-2.5.0
    @install ${loc}perl-xml-5.8.7-2.5.0
    @install ${loc}perl-net-5.8.7-2.5.0
    @install ${loc}perl-comp-5.8.7-2.5.0
    @trigger ${loc}perl-ssl-5.8.7-2.5.0
    @install ${loc}perl-www-5.8.7-2.5.1
    @install ${loc}perl-dns-5.8.7-2.5.0
    @trigger ${altloc}imap-2004g-2.5.0_kolab --with=annotate
    @install ${loc}procmail-3.22-2.5.0
    @install ${loc}db-4.3.29.0-2.5.0
    @install ${altloc}openldap-2.3.29-2.20061110_kolab
    @install ${loc}m4-1.4.3-2.5.0
    @install ${loc}bison-2.1-2.5.0
    @install ${loc}flex-2.5.31-2.5.0
    @install ${loc}groff-1.19.2-2.5.0
    @trigger ${loc}sasl-2.1.21-2.5.0 --with=ldap --with=login
    @install ${loc}getopt-20051005-2.5.0
    @trigger ${loc}proftpd-1.3.0rc2-2.5.0 --with=ldap
    @install ${loc}gdbm-1.8.3-2.5.0
    @install ${plusloc}dbtool-1.6-2.5.0
    @trigger ${altloc}postfix-2.2.5-2.5.0_kolab --with=ldap --with=sasl --with=ssl
    @install ${loc}perl-ldap-5.8.7-2.5.0
    @install ${loc}perl-db-5.8.7-2.5.1
    @install ${loc}config-20051002-2.5.0
    @trigger ${altloc}imapd-2.2.12-2.5.0_kolab2 --with=group --with=ldap --with=annotate --with=atvdom --with=skiplist --with=goodchars --with=folderchar --with=morelogging # Drop morelogging if you dont want/need it
    @install ${loc}libiconv-1.10-2.5.0
    @install ${loc}autoconf-2.59-2.5.0
    @install ${loc}automake-1.9.6-2.5.0
    @install ${loc}gettext-0.14.5-2.5.0
    @install ${altloc}file-4.15-2.5.0_kolab
    @install ${loc}openpkg-tools-0.8.47-2.5.0
    @install ${loc}patch-2.5.9-2.5.0
    @install ${loc}sed-4.1.4-2.5.0
    @install ${loc}libxml-2.6.22-2.5.0
    @install ${loc}libxslt-1.1.15-2.5.1 # WARNING: Remove libgcrypt before building!
    @trigger ${altloc}apache-1.3.33-2.5.6_kolab \
	--with=mod_auth_ldap \
	--with=mod_dav \
	--with=mod_php \
	--with=mod_php_zlib \
	--with=mod_php_gdbm \
	--with=mod_php_gettext \
	--with=mod_php_imap \
	--with=mod_php_openldap \
	--with=mod_php_xml \
	--with=mod_php_dom \
	--with=mod_ssl \
	--with=mod_php_mbstring
    @trigger ${altloc}php-4.4.0-2.5.2_kolab \
	--with=zlib \
	--with=gdbm \
	--with=gettext \
	--with=imap \
	--with=openldap \
	--with=pear \
	--with=xml \
	--with=dom \
	--with=ssl \
	--with=mbstring
    @install ${altloc}php-smarty-2.6.10-20051003
    @install ${loc}gmp-4.1.4-2.5.0
    @install ${loc}spamassassin-3.1.0-2.5.0
    @install ${plusloc}amavisd-2.3.3-2.5.0
    @trigger ${loc}curl-7.15.0-2.5.2
    @install ${altloc}clamav-0.88.7-20061211
#    @install ${loc}vim-6.3.78-2.4.0
#    @install ${plusloc}dcron-2.9-2.4.0
    @install ${altloc}perl-kolab-5.8.7-20070117
    @install ${altloc}kolabd-2.0.99-20070117 --define kolab_version=$kolab_version
    @install ${altloc}kolab-webadmin-2.0.99-20070117 --define kolab_version=$kolab_version
    @install ${altloc}kolab-horde-framework-2.0.99-20051220 --define kolab_version=$kolab_version
    @install ${altloc}kolab-resource-handlers-2.0.99-20070117 --define kolab_version=$kolab_version
    @install ${altloc}kolab-horde-fbview-2.0.99-20070112 --define kolab_version=$kolab_version
    @check

    if test ! -e "/usr/bin/kolab" ; then
	echo
	echo "Adding symbolic link to $PREFIX/bin/kolab as /usr/bin/kolab"
	ln -s $PREFIX/bin/kolab /usr/bin/kolab
    fi





%dump
    echo "PRG = \"$PRG\""
    echo "CMD = \"$CMD\""
    echo "URL = \"$URL\""
    echo "MIRROR = \"$MIRROR\""
    echo "USERNAME = \"$USERNAME\""
    echo "TRACK = \"$TRACK\""
    echo "EGREP = \"$EGREP\""
    echo "CHECKONLY = \"$CHECKONLY\""
    echo "ERASESURPLUS = \"$ERASESURPLUS\""
    echo "HASX11 = \"$HASX11\""
    echo "PREFIX = \"${PREFIX}\""
    echo "ARCH = \"${ARCH}\""
    echo "OS = \"${OS}\""
    echo "TAG = \"${TAG}\""
    echo "TMPDIR=\"${TMPDIR}\""
