blob: 0e73e78ff97381fa7ee9e72e51e17d5e8c95a447 (
plain)
#!/bin/sh
# Slackware build script for barnyard2
# Snort binary log processor
# Written by Niels Horn <niels.horn@gmail.com>
# Revision date 2010/12/31
PRGNAM=barnyard2
VERSION=${VERSION:-1.9}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i486 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--sysconfdir=/etc \
--docdir=/usr/doc/$PRGNAM-$VERSION \
--mandir=/usr/man \
--localstatedir=/var \
--with-mysql-libraries=/usr/lib${LIBDIRSUFFIX}/mysql \
--with-mysql-includes=/usr/include/mysql \
--build=$ARCH-slackware-linux
make
make install DESTDIR=$PKG
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
mv $PKG/etc/$PRGNAM.conf $PKG/etc/$PRGNAM.conf.new
# Include rc.barnyard2 file
mkdir -p $PKG/etc/rc.d
cat $CWD/rc.barnyard2 > $PKG/etc/rc.d/rc.barnyard2.new
chmod 0755 $PKG/etc/rc.d/rc.barnyard2.new
# Create directory for log
mkdir -p $PKG/var/log/$PRGNAM
# Copy database schemas and docs
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/schemas
for sc in schemas/create_*; do
cat $sc > $PKG/usr/doc/$PRGNAM-$VERSION/$sc
done
cp -a \
COPYING LICENSE RELEASE.NOTES doc/* \
$PKG/usr/doc/$PRGNAM-$VERSION
find $PKG/usr/doc/$PRGNAM-$VERSION -name "Makefile*" -exec rm -f {} \;
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
cat $CWD/README.SLACKWARE > $PKG/usr/doc/$PRGNAM-$VERSION/README.SLACKWARE
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.${PKGTYPE:-tgz}
|