slackbuilds/perl/perl-io-uncompress-brotli/perl-io-uncompress-brotli.S...

88 lines
2.3 KiB
Bash

#!/bin/bash
# Slackware build script for perl-io-uncompress-brotli
# Written by B. Watson (urchlay@slackware.uk)
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
# Note: this doesn't build against the system brotli, it uses its own
# bundled source, which it builds statically, links with, and doesn't
# install in the package.
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=perl-io-uncompress-brotli
SRCNAM=IO-Compress-Brotli
VERSION=${VERSION:-0.019}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
fi
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
# No need for SLKCFLAGS, upstream's defaults are -O3 -fPIC, which they
# actually test with. Changing that to -O2 would be more work and I
# don't see the point.
# Don't need LIBDIRSUFFIX either, perl knows where to install its modules.
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $SRCNAM-$VERSION
tar xvf $CWD/$SRCNAM-$VERSION.tar.gz
cd $SRCNAM-$VERSION
chown -R root:root .
find -L . -perm /111 -a \! -perm 755 -a -exec chmod -h 755 {} + -o \
\! -perm /111 -a \! -perm 644 -a -exec chmod -h 644 {} +
# Makefile.PL uses a module called Alien::cmake3, but all it uses it
# for is to find the cmake executable. Patch just makes it use PATH,
# which has worked for decades without yet another perl module.
patch -p1 < $CWD/no_alien_cmake3.diff
# Note: the -j1 really is needed, it's a bummer, but it doesn't take *that*
# long to build.
perl Makefile.PL \
PREFIX=/usr \
INSTALLDIRS=vendor \
INSTALLVENDORMAN3DIR=/usr/man/man3
make -j1 VERBOSE=1
make test
strip blib/arch/auto/*/*/*/*.so
make install DESTDIR=$PKG
gzip $PKG/usr/man/man*/*
find $PKG \( -name perllocal.pod \
-o -name ".packlist" \
-o -name "*.bs" \) \
-delete
PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p $PKGDOC
cp -a README Changes $PKGDOC
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
mkdir -p $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