#!/bin/sh
CWD=`pwd`
TMP=/tmp
PKG=$TMP/package-wireshark
VERSION=1.0.3
ARCH=alpha
BUILD=1
TARGET=$ARCH-alphaslack-linux

rm -rf $PKG
mkdir -p $PKG
( cd $TMP
rm -rf wireshark-$VERSION
tar xjf $CWD/wireshark-$VERSION.tar.bz2
cd wireshark-$VERSION
./configure \
 --prefix=/usr \
 --program-suffix="" \
 --program-prefix="" \
 --mandir=/usr/man \
 --with-ssl \
 --with-libpcap \
 --enable-threads \
 --build=$TARGET || exit 1
make || exit 1
make DESTDIR=$PKG install
( cd $PKG
 find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
 find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
 find . | xargs file | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
)
gzip -9 $PKG/usr/man/man?/*.?
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
makepkg -l y -c n $TMP/wireshark-$VERSION-$ARCH-$BUILD.tgz
) 2>&1 | tee $TMP/wireshark.build.log
