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

rm -rf $PKG
mkdir -p $PKG/usr
( cd $TMP
rm -rf pkg-config-$VERSION
tar xjf $CWD/pkg-config-$VERSION.tar.bz2
cd pkg-config-$VERSION
chown -R root:root .
find . -perm 666 -exec chmod 644 {} \;
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 {} \;
./configure --prefix=/usr $TARGET || exit
make || exit
make install DESTDIR=$PKG || exit
strip --strip-unneeded $PKG/usr/bin/*
chown -R root:bin $PKG/usr/bin
gzip -9 $PKG/usr/man/man1/*
mkdir -p $PKG/usr/doc/pkgconfig-$VERSION
cp -a AUTHORS COPYING ChangeLog NEWS README $PKG/usr/doc/pkgconfig-$VERSION
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
makepkg -l y -c n $TMP/pkgconfig-$VERSION-$ARCH-$BUILD.tgz
) 2>&1 | tee $TMP/pkgconfig.build.log
