slackbuilds_ponce/system/watchdog/watchdog.SlackBuild
2010-05-11 15:18:47 +02:00

76 lines
2 KiB
Bash

#!/bin/sh
# Slackware build script for watchdog
# Written by Menno E. Duursma <druiloor@zonnet.nl>
# Exit on most errors
set -e
PRGNAM=watchdog
VERSION=5.3.1
ARCH=${ARCH:-i486}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
fi
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar -xzvf $CWD/${PRGNAM}_${VERSION}.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
chmod -R u+w,go+r-w,a-s .
# Apply the Slackware support scripts patch
cat $CWD/$PRGNAM-$VERSION-slackware.diff | patch -p1 --verbose
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--mandir=/usr/man
# Compile the application and install it into the $PKG directory
make
make install-strip DESTDIR=$PKG
# Compress man pages
( cd $PKG/usr/man
find . -type f -exec gzip -9 {} \;
for i in $(find . -type l) ; do ln -s $(readlink $i).gz $i.gz ; rm $i ; done
)
# Copy program documentation into the package
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a [A-Z][A-Z]* ChangeLog examples $PKG/usr/doc/$PRGNAM-$VERSION
# Add the Debian doc for additional reference
cp -a debian/README.debian $PKG/usr/doc/$PRGNAM-$VERSION
# Also, include the SlackBuild script in the documentation directory
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
cat $CWD/README > $PKG/usr/doc/$PRGNAM-$VERSION/README$TAG
# Move config to .new; let doinst.sh handle it further
mv $PKG/etc/$PRGNAM.conf $PKG/etc/$PRGNAM.conf.new
# Add init script too
mkdir -p $PKG/etc/rc.d
cat rc.$PRGNAM.slackware > $PKG/etc/rc.d/rc.$PRGNAM.new
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz