CWD=`pwd`
PKG=/tmp/package-xine-lib
rm -rf $PKG
mkdir -p $PKG/usr

# Yeah, I know... alpha.  Still, XINE has never reached 1.0, and it makes no sense to
# finally include it (and link to it) using the very-soon-to-be-obsolete library version.
VERSION=1rc0a
# I would use "-march=i486 -mcpu=i686" here as usual, but with XINE it's all or nothing.
# I'd rather have it work well for the i686/Athlon crowd than suck for everyone.
ARCH=i686
BUILD=2

cd /tmp
#tar xjvf $CWD/xine-lib-$VERSION.tar.bz2
tar xjvf $CWD/xine-lib-1-rc0a.tar.bz2
#cd xine-lib-$VERSION
cd xine-lib-1-rc0a
chown -R root.root .
find . -perm 664 -exec chmod 644 {} \;
find . -perm 777 -exec chmod 755 {} \;
XINE_BUILD=i686-pc-linux-gnu \
./configure --prefix=/usr
make
make install DESTDIR=$PKG
chown -R root.bin $PKG/usr/bin
( cd $PKG
  find . | xargs file | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded
)
( cd $PKG/usr/man
  find . -name "*.?" | xargs gzip -9
)
mkdir -p $PKG/usr/doc/xine-lib-$VERSION
cp -a \
  ABOUT-NLS AUTHORS COPYING CREDITS NEWS README TODO \
  doc \
  $PKG/usr/doc/xine-lib-$VERSION
# redundant
rm -rf $PKG/usr/share/doc
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

cd /tmp/package-xine-lib
makepkg -l y -c n ../xine-lib-$VERSION-$ARCH-$BUILD.tgz

