#!/bin/sh
#
# Copyright 2004 Dagmar d'Surreal <rivyqntzne@tznvy.pbz>
# Available under the terms of the GNU GPL.
#

NAME="krb5"
VERSION="1.4.3"
REVISION="1"
#PKG_SOURCEURL='http://web.mit.edu/kerberos/dist/krb5/1.4/krb5-1.4.2-signed.tar'
PKG_PATCH[0]='man2htmlfix.diff'
#PKG_PATCH[1]='2005-002-patch_1.4.1.patch'
#PKG_PATCH[2]='2005-003-patch_1.4.1.patch'

PKG_BUILDDIR="src"

. $DLG_ROOT/config
. $DLG_ROOT/SCRIPTS/dropline-functions.sh

cflags
prepare
applypatch 0 1
#applypatch 1 1
#applypatch 2 1
analyzesource
configure --enable-shared --enable-dns --mandir=$PKG_PREFIX/man
make
makeinstall install-strip

# We really want to avoid collisions with existing named binaries.
( spewdo "cd $PKG_STAGEROOT"
  for tmp in ftpd telnetd; do
    spewdo "mv usr/sbin/$tmp usr/sbin/k$tmp"
    spewdo "mv usr/man/man8/$tmp.8 usr/man/man8/k$tmp.8"    
  done

  for tmp in rsh rcp rlogin ftp telnet; do
    spewdo "mv usr/bin/$tmp usr/bin/k$tmp"
    spewdo "mv usr/man/man1/$tmp.1 usr/man/man1/k$tmp.1"
  done
)
# Bring the shared libraries in line with the way all the others are.
spewdo "find $PKG_STAGEROOT -type f -name "*.so*" ! -perm 755 -exec chmod 755 \{\} \\;"

spewdo "mkdir -p $PKG_STAGEROOT$PKG_SYSCONFDIR/krb5kdc"
spewdo "cp $PKG_SRCROOT/config-files/krb.conf $PKG_STAGEROOT$PKG_SYSCONFDIR/krb.conf-sample"
spewdo "cp $PKG_SRCROOT/config-files/kdc.conf $PKG_STAGEROOT$PKG_SYSCONFDIR/krb5kdc/kdc.conf-sample"

tidydocumentation

# There's a whole mess of documentation that comes with this baby.
spewdo "cp -adR $PKG_SRCROOT/doc/* $PKG_STAGEROOT$PKG_DOCDIR/"

analyzebinaries
includescript
finalizepackage
packagize
cleanup
