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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
|
#!/bin/sh
# Slackware build script for man-db
# Written by B. Watson (yalhcru@gmail.com)
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
# 20180208 bkw: update for man-db 2.8.0, libpipeline 1.5.0.
# This may be the last SBo update, since Pat has imported man-db
# into Slackware-current. Depends on how long it is from now until
# the next release: I'll maintain this until SBo stops accepting
# submissions for 14.2.
# 20170305 bkw:
# - BUILD=2
# - get rid of systemd-specific /usr/lib/tmpfiles.d from package.
# - patch configure so it doesn't write to /usr/lib.
# 20170215 bkw:
# - update for 2.7.6.1 (whoops, last update wasn't for the latest version
# - only update the cache in doinst.sh if it's over an hour old. this
# takes several minutes, and happens twice (uselessly) if the package
# is upgraded (since upgradepkg runs doinst.sh twice). waiting an hour
# also makes my life easier when I'm testing this script.
# - fix man-db.cron so it works even if USR=yes (whoops), and stop trying
# to chown the cache to the nonexistent 'man' user.
# 20170125 bkw:
# - update for 2.7.6.
# - add --disable-cache-owner. TODO: revisit this at some
# point. Maybe create a dedicated 'man' user, or use one of the existing
# users like 'bin' or 'operator'.
# 20160726 bkw:
# - update for 2.7.5.
# 20150507 bkw:
# - update for 2.7.1.
# - fix homepage in .info file.
# - had to update libpipeline to 1.4.0.
# 20140924 bkw:
# - update for 2.7.0.1, which fixes the clash between man-db's zsoelim
# and groff's zsoelim.
# - update README and README.Slackware slightly.
PRGNAM=man-db
VERSION=${VERSION:-2.8.0}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=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
# By default, install binaries to /opt, so as not to stomp on Slackware's
# man pkg. We will have to include a /etc/profile.d script to set PATH,
# MANPATH, etc. Note that only binaries and the man pages for man-db itself
# go to /opt. Everything else (libpipeline, man-db's shared libs, localized
# messages, etc) goes to /usr as usual.
# If you want a proper replacement for Slack's man pkg, build with
# USR="yes", which puts the binaries in the usual places. If your name is
# Patrick V. and you're finally replacing man with man-db in Slackware,
# feel free to uncomment the next line:
#USR="yes"
BINDIR=/opt/$PRGNAM/bin
[ "${USR:-no}" = "yes" ] && BINDIR=/usr/bin
MANDIR="${BINDIR/bin/man}"
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
# libpipeline is a pretty niche-market library. It used to be bundled
# in the man-db source, and as far as I can tell, nothing else uses it.
# Instead of making it a separate build and external dep, we'll just
# bundle it here.
LIBNAM=libpipeline
LIBVER=1.5.0
cd $TMP
rm -rf $LIBNAM-$LIBVER
tar xvf $CWD/$LIBNAM-$LIBVER.tar.gz
cd $LIBNAM-$LIBVER
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--sysconfdir=/etc \
--localstatedir=/var \
--mandir=/usr/man \
--docdir=/usr/doc/$PRGNAM-$VERSION/$LIBNAM-$LIBVER \
--build=$ARCH-slackware-linux
make
make install-strip DESTDIR=$PKG
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/$LIBNAM-$LIBVER
cp -a COPYING ChangeLog* NEWS README TODO \
$PKG/usr/doc/$PRGNAM-$VERSION/$LIBNAM-$LIBVER
# now build man-db itself, using the libpipeline installed in $PKG
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.xz
cd $PRGNAM-$VERSION
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
# The 'checking for long filenames' test in the configure script writes to
# /usr/lib, which is bad behaviour for a configure script. Not to mention
# wrong (it assumes configure is always being run as root). We already
# know we have long filename support, because we live in the 21st century
# now, so this patch gets rid of the test and force-enables it.
patch -p1 < $CWD/dont_write_in_usr.diff
# The circumlocutions below are needed because doing it the sane way:
# libpipeline_LIBS="-L$PKG/usr/lib$LIBDIRSUFFIX -lpipeline"
# gets broken by libtool (it *insists* on replacing -lpipeline with
# /usr/lib64/libpipeline.so, which will fail if it's an older version).
LD_LIBRARY_PATH="$PKG/usr/lib$LIBDIRSUFFIX" \
LDFLAGS="$PKG/usr/lib$LIBDIRSUFFIX/libpipeline.so" \
libpipeline_CFLAGS="-I$PKG/usr/include" \
libpipeline_LIBS="-L$PKG/usr/lib$LIBDIRSUFFIX $PKG/usr/lib$LIBDIRSUFFIX/libpipeline.so" \
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
--disable-setuid \
--disable-cache-owner \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--sysconfdir=/etc \
--localstatedir=/var \
--mandir=$MANDIR \
--bindir=$BINDIR \
--sbindir=${BINDIR/bin/sbin} \
--docdir=/usr/doc/$PRGNAM-$VERSION \
--build=$ARCH-slackware-linux
make
make install-strip DESTDIR=$PKG
# This stuff is for systemd, we don't need it (and it might confuse
# people coming from systemd distros):
rm -rf $PKG/usr/lib/tmpfiles.d/
# There will always be man pages here, regardless of USR=yes or no.
find $PKG/usr/man -type f -exec gzip -9 {} \;
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
if [ "${USR:-no}" != "yes" ]; then
# separate dir full of man pages and symlinks in /opt
find $PKG/$MANDIR -type f -exec gzip -9 {} \;
for i in $( find $PKG/$MANDIR -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
# only need the profile.d stuff if installing to /opt
mkdir -p $PKG/etc/profile.d
install -m0755 -oroot -groot $CWD/$PRGNAM.sh $CWD/$PRGNAM.csh $PKG/etc/profile.d
fi
# no special ownership or perms needed here since we --disable-setuid
mkdir -p $PKG/var/cache/man
# only ship a daily cronjob, don't need a weekly one like Debian has.
mkdir -p $PKG/etc/cron.daily
install -m0755 -oroot -groot $CWD/$PRGNAM.cron $PKG/etc/cron.daily/$PRGNAM
# modified default config, customized for Slackware. See the conf file for
# list of changes.
zcat $CWD/man_db.conf.new.gz \
| sed "s,@LIBDIRSUFFIX@,$LIBDIRSUFFIX,g" \
> $PKG/etc/man_db.conf.new
rm -rf $PKG/etc/man_db.conf
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a ABOUT-NLS Change* FAQ NEWS README docs/* $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
sed "s,@BINDIR@,$BINDIR," < $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
# N.B. the -p option is actually needed here (for libpipeline.so).
cd $PKG
/sbin/makepkg -p -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|