slackbuilds/d/quilt/quilt.SlackBuild

92 lines
2.1 KiB
Plaintext
Raw Normal View History

#!/bin/sh
# Set initial variables:
CWD=$(pwd)
APP=quilt
VERSION=$(ls $APP-*.tar.?z* | sed -e 's/\.tar\..z.*//' | rev | cut -d- -f1 | rev)
ARCH=${ARCH:-noarch}
BUILD=${BUILD:-1}
TAG=${TAG:-micu}
LIBSUFFIX=${LIBSUFFIX:-64}
MAKE="make -j 5"
if [ "$TMP" = "" ]; then
TMP=/tmp
fi
PKG=$TMP/package-$APP
rm -rf $PKG
mkdir -p $PKG
cd $TMP
rm -rf $APP-$VERSION
tar xvf $CWD/$APP-$VERSION.tar.?z* || exit 1
cd $APP-$VERSION
chown -R root.root .
find . -perm 444 -exec chmod 644 {} \;
find . -perm 777 -exec chmod 755 {} \;
find . -perm 666 -exec chmod 644 {} \;
./configure --prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var/lib \
--mandir=/usr/man \
--libdir=/usr/lib$LIBSUFFIX \
--docdir=/usr/doc/$APP-$VERSION || exit 1
$MAKE || exit 1
make install BUILD_ROOT=$PKG || exit 1
# Don't ship .la files:
rm -f $PKG/{,usr/}lib${LIBSUFFIX}/*.la
chown -R root.bin $PKG/usr/bin
# Preserve original config file:
mv $PKG/etc/quilt.quiltrc $PKG/etc/quilt.quiltrc.new
# Compress and if needed symlink the man pages:
if [ -d $PKG/usr/info ]; then
rm -f $PKG/usr/info/dir
gzip -9 $PKG/usr/info/*
fi
if [ -d $PKG/usr/man ]; then
( cd $PKG/usr/man
for manpagedir in $(find . -type d -name "man*") ; do
( cd $manpagedir
for eachpage in $( find . -type l -maxdepth 1) ; do
ln -s $( readlink $eachpage ).gz $eachpage.gz
rm $eachpage
done
gzip -9 *.?
)
done
)
fi
# Directory already created by 'make install':
cp -a AUTHORS COPYING NEWS TODO \
$PKG/usr/doc/$APP-$VERSION
mkdir -p $PKG/install
[ -f $CWD/doinst.sh ] && cat $CWD/doinst.sh > $PKG/install/doinst.sh
[ -f $CWD/doinst.sh.gz ] && zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
cat $CWD/slack-desc > $PKG/install/slack-desc
# Allow to run as non-root until now:
if [ $(id -u) -ne 0 ]; then
echo "*** Running as non-root, skipping makepkg."
echo "*** Package contents is in $PKG directory."
exit 0
fi
cd $PKG
makepkg -l y -c n $TMP/$APP-$VERSION-$ARCH-${BUILD}${TAG}.txz
# Clean up the extra stuff:
if [ "$1" = "--cleanup" ]; then
rm -rf $TMP/$APP-$VERSION
rm -rf $PKG
fi