#!/bin/sh
PKGNAM=normalize
VERSION=0.7.6
BUILD=2

. /etc/pkghelpers
pkghelpers_env

rm -rf $PKG
mkdir -p $PKG
cd /tmp
rm -rf normalize-$VERSION
tar xjvf $CWD/normalize-$VERSION.tar.bz2
cd normalize-$VERSION
chown -R root.root .
find . -perm 664 -exec chmod 644 {} \;
find . -perm 600 -exec chmod 644 {} \;
find . -perm 444 -exec chmod 644 {} \;
find . -perm 400 -exec chmod 644 {} \;
find . -perm 440 -exec chmod 644 {} \;
find . -perm 777 -exec chmod 755 {} \;
find . -perm 775 -exec chmod 755 {} \;
find . -perm 511 -exec chmod 755 {} \;
find . -perm 711 -exec chmod 755 {} \;
find . -perm 555 -exec chmod 755 {} \;
CFLAGS="$SLKCFLAGS" \
./configure \
  --prefix=/usr \
  --with-mad \
  --without-audiofile
make -j12 || exit 1
make install DESTDIR=$PKG
mkdir -p $PKG/usr/doc/normalize-$VERSION
cp -a \
  COPYING INSTALL NEWS README THANKS TODO \
  $PKG/usr/doc/normalize-$VERSION
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

cd $PKG
pkghelpers_fixup
pkghelpers_makepkg