aboutsummaryrefslogtreecommitdiff
path: root/system/info2man/info2man.SlackBuild
blob: b082d3e1508928ce5ff5ccf0f247701a541490a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash

# Slackware build script for info2man

# Written by B. Watson (yalhcru@gmail.com)

# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.

# 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 the variable PRINT_PACKAGE_NAME is set, then this script will report what
# the name of the created package would be, and then exit. This information
# could be useful to other scripts.
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