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

mkdir -p $PKG
( cd $TMP
tar xjf $CWD/gettext-$VERSION.tar.bz2
cd gettext-$VERSION
chown -R root.root .
./configure --prefix=/usr $TARGET
make
make install DESTDIR=$PKG
rm -rf $PKG/usr/lib/libintl.* $PKG/usr/share/locale/locale.alias $PKG/usr/include/libintl.h
chown -R root.bin $PKG/usr/bin
mv $PKG/usr/share/doc $PKG/usr/doc
mv $PKG/usr/doc/gettext $PKG/usr/doc/gettext-$VERSION
mv $PKG/usr/share/man $PKG/usr/man
( cd $PKG/usr/info
  rm -rf dir
  gzip -9 *
)
gzip -9 $PKG/usr/man/man?/*
( cd $PKG
  find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded
  find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded
)
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
makepkg -l y -c n $TMP/gettext-$VERSION-$ARCH-$BUILD.tgz
) 2>&1 | tee $TMP/gettext.build.log
