#!/bin/sh # Heavily based on the Slackware 13.0 SlackBuild # Author: Gufo gufopeopleit - http://gufo.dontexist.org # License Gplv2 # Some suggestion taken from http://slackbuilds.org/ # http://www.kernel.org/pub/linux/libs/pam/ # http://www.kernel.org/pub/linux/libs/pam/pre/library/Linux-PAM-0.99.9.0.tar.bz2 # This work used slackbuild by C. J. Meidlinger as a reference # (http://www.linuxpackages.net/pkg_details.php?id=9712) set -e APP=Linux-PAM VERSION=1.1.0 BUILD=${BUILD:-1gufo} ARCH=${ARCH:-i486} CWD=$(pwd) if [ "$TMP" = "" ]; then TMP=/tmp/txz fi if [ "$ARCH" = "i386" ]; then SLKCFLAGS="-O2 -march=i386 -mtune=i686" elif [ "$ARCH" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mtune=i686" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2 -fPIC" fi PKG=$TMP/$APP-$VERSION-build # Delete the leftover directories if they exist (due to a previous build) # and (re)create the packaging directory rm -rf $PKG $TMP/$APP-$VERSION mkdir -p $TMP $PKG cd $TMP tar jxvf "$CWD"/$APP-$VERSION.tar.bz2 cd $APP-$VERSION # Change ownership and permissions if necessary # This may not be needed in some source tarballs, but it never hurts chown -R root:root . chmod -R u+w,go+r-w,a-s . CFLAGS="$SLKCFLAGS" \ #./configure --prefix=/usr --sysconfdir=/etc/pam.d --disable-selinux \ # --docdir=/usr/doc/$APP-$VERSION ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --with-gnu-ld \ --enable-docdir=/usr/doc/${APP}-${VERSION} --mandir=/usr/man --enable-securedir=/usr/lib/pam \ --enable-sconfigdir=/etc/pam --enable-read-both-confs --includedir=/usr/include/pam make make install DESTDIR=$PKG mkdir -p $PKG/install cp "$CWD"/slack-desc $PKG/install # Documentation mkdir -p $PKG/usr/doc/$APP-$VERSION cat $CWD/linux-pam.SlackBuild > $PKG/usr/doc/$APP-$VERSION/linux-pam.SlackBuild # Copy documentation to the docs directory and fix permissions cp -a AUTHORS CHANGELOG COPYING ChangeLog Copyright NEWS README $PKG/usr/share/doc/Linux-PAM/*.txt $PKG/usr/doc/$APP-$VERSION find $PKG/usr/doc/$APP-$VERSION -type f -exec chmod 644 {} \; rm -rf $PKG/usr/share/doc mkdir $PKG/etc/pam.d/ # sane configuration default if [ -e $CWD/other.gz ]; then zcat $CWD/other.gz > $PKG/etc/pam.d/other.new fi # This is for vmware-server if [ -e $CWD/vmware-authd.gz ]; then zcat $CWD/vmware-authd.gz > $PKG/etc/pam.d/vmware-authd.new fi # Add doinst.sh to package (if it exists) if [ -e $CWD/doinst.sh.gz ]; then zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh fi if [ -e $CWD/rc.$APP.gz ]; then mkdir $PKG/etc/rc.d/ zcat $CWD/rc.$APP.gz > $PKG/etc/rc.d/rc.$APP.new fi # Strip some libraries and binaries ( cd $PKG find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null ) # Compress man pages if they exist if [ -d $PKG/usr/man ]; then ( cd $PKG/usr/man find . -type f -exec gzip -9 {} \; for i in `find . -type l` ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done ) fi # Compress info pages if they exist (and remove the dir file) if [ -d $PKG/usr/info ]; then gzip -9 $PKG/usr/info/*.info rm -f $PKG/usr/info/dir fi cd $PKG requiredbuilder -v -y -s $CWD $PKG /sbin/makepkg -l y -c n $CWD/../linux-pam-$VERSION-$ARCH-$BUILD.txz if [ "$1" = "--cleanup" ]; then rm -rf $PKG $TMP/$APP-$VERSION fi