slackbuilds/system/info2man/info2man.SlackBuild

89 lines
2.5 KiB
Bash

#!/bin/bash
# Slackware build script for info2man
# Written by B. Watson (urchlay@slackware.uk)
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
# 20210825 bkw: no changes. looked at debian's 1.1-10, but there are
# no changes there that apply to us (only apply to debian's package
# building tools).
# 20201102 bkw: update for v1.1_9 (debian's 1.1-9)
# 20140907 bkw: original site blocks downloads based on user-agent. Host
# the src on my own server. Only the .info file changed, not the script, so
# didn't bump the BUILD.
# Original download link: http://www.cskk.ezoshosting.com/cs/css/info2man.tar.gz
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=info2man
VERSION=${VERSION:-1.1_9}
ARCH=noarch
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
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}
set -e
# Trying to teach myself to use bash string stuff instead of echoing
# to 'cut' or whatever. But this is really hard to remember and read:
SRCVER=${VERSION%%_*}
DEBVER=${VERSION##*_}
PERLMODDIR=/usr/share/info2pod
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$SRCVER
tar xvf $CWD/${PRGNAM}_${SRCVER}.orig.tar.gz
cd $PRGNAM-$SRCVER
tar xvf $CWD/${PRGNAM}_${SRCVER}-${DEBVER}.debian.tar.xz
chown -R root:root .
find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
\! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
# Apply debian patches
for i in $( cat debian/patches/series); do
patch -p1 < debian/patches/$i
done
# Make the script use its own private perl module dir, so we don't
# pollute /usr/lib/perl5.
sed -i -e '2iuse lib "'$PERLMODDIR'";' info2pod
mkdir -p $PKG/usr/bin $PKG/$PERLMODDIR
install -m0755 -oroot -groot $PRGNAM $PKG/usr/bin
install -m0755 -oroot -groot info2pod $PKG/usr/bin
cp -r cs $PKG/$PERLMODDIR/cs
# Include debian's man pages
mkdir -p $PKG/usr/man/man1
gzip -9c < debian/$PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz
gzip -9c < debian/info2pod.1 > $PKG/usr/man/man1/info2pod.1.gz
# 1.1_9 has 0README.txt, but it's mostly install instructions,
# plus a bunch of cruft culled from the original author's other
# projects. Don't bother.
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/README > $PKG/usr/doc/$PRGNAM-$VERSION/README
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$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