slackbuilds_ponce/libraries/cracklib/cracklib.SlackBuild
David Somero 0ba1e6da59 libraries/cracklib: Misc automated cleanups.
Signed-off-by: David Somero <xgizzmo@slackbuilds.org>
2010-06-04 01:06:18 -04:00

90 lines
2 KiB
Bash

#!/bin/sh
# Slackware build script for cracklib
# Written by Christopher Walker <kris240376@gmail.com>
PRGNAM=cracklib
VERSION=${VERSION:-2.8.13}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
DICT=${DICT:-cracklib-words-20080507}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i486 ;;
arm*) ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) ARCH=$( uname -m ) ;;
esac
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mcpu=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
chmod -R a-s,u+w,go+r-w .
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--mandir=/usr/man \
--sysconfdir=/etc \
--localstatedir=/var \
--enable-shared \
--disable-static \
--build=$ARCH-slackware-linux
make
make install DESTDIR=$PKG
# Install large cracklib dictionary file if it exists
( cd $PKG/usr/share/cracklib
if [ -e $CWD/${DICT}.gz ]; then
zcat $CWD/${DICT}.gz > $PRGNAM-large
elif [ -e $CWD/${DICT} ]; then
cat $CWD/${DICT} > $PRGNAM-large
fi
)
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a \
ABOUT-NLS AUTHORS COPYING INSTALL NEWS README* \
$PKG/usr/doc/$PRGNAM-$VERSION
chmod 644 $PKG/usr/doc/$PRGNAM-$VERSION/*
mkdir $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}