#!/bin/sh
# Set initial variables:
CWD=`pwd`
TMP=/tmp
PKG=$TMP/package-uucp
VERSION=1.07
ARCH=alpha
BUILD=2

mkdir -p $PKG
cd $PKG
explodepkg $CWD/_uucp.tar.gz
( cd $TMP
tar xzf $CWD/uucp-$VERSION.tar.gz
cd uucp-$VERSION
zcat $CWD/policy.h.diff.gz | patch -p1 --verbose
./configure --prefix=/usr --with-oldconfigdir=/etc/uucp/oldconfig --with-newconfigdir=/etc/uucp
make
make install DESTDIR=$PKG
chgrp bin $PKG/usr/bin/* $PKG/usr/sbin/*
strip --strip-unneeded $PKG/usr/bin/* $PKG/usr/sbin/*
gzip -9 $PKG/usr/man/man?/*
gzip -9 $PKG/usr/info/*
rm -f $PKG/usr/info/dir.gz
# Setuid uucp binaries may only be run by members of the uucp group:
( cd $PKG/usr/bin
  chgrp uucp cu uucp uuname uustat uux
  chmod 4554 cu uucp uuname uustat uux
  cd ../sbin
  chgrp uucp uucico uuxqt
  chmod 4554 uucico uuxqt
)
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
makepkg -l y -c n $TMP/uucp-$VERSION-$ARCH-$BUILD.tgz
) 2>&1 | tee $TMP/uucp.build.log
