2018-05-28 21:12:29 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# 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.
|
|
|
|
|
|
|
|
cd $(dirname $0) ; CWD=$(pwd)
|
|
|
|
|
|
|
|
PKGNAM=man-db
|
2019-08-05 09:33:15 +02:00
|
|
|
VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
|
2024-09-19 21:16:36 +02:00
|
|
|
BUILD=${BUILD:-2}
|
2018-05-28 21:12:29 +02:00
|
|
|
|
|
|
|
MAN2HTML=${MAN2HTML:-20180101}
|
|
|
|
|
|
|
|
# 20180115 rworkman:
|
|
|
|
# Include Thomas Dickey's man2html script
|
|
|
|
|
|
|
|
# 20171128 volkerdi:
|
|
|
|
# Make some changes to the SlackBuild to bring it in line with the usual
|
|
|
|
# Slackware style, and then pull it into Slackware. Thanks to B. Watson.
|
|
|
|
# License remains WTFPL, because WTF not :-) I am adding the offical WTFPL
|
|
|
|
# no warranty disclaimer, however:
|
|
|
|
#
|
|
|
|
# /* This program is free software. It comes without any warranty, to
|
|
|
|
# * the extent permitted by applicable law. You can redistribute it
|
|
|
|
# * and/or modify it under the terms of the Do What The Fuck You Want
|
|
|
|
# * To Public License, Version 2, as published by Sam Hocevar. See
|
|
|
|
# * http://www.wtfpl.net/ for more details. */
|
|
|
|
#
|
|
|
|
|
|
|
|
# 20170305 bkw:
|
|
|
|
# - 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 üpgradepkg 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.
|
|
|
|
|
|
|
|
if [ -z "$ARCH" ]; then
|
|
|
|
case "$( uname -m )" in
|
2024-08-30 19:52:19 +02:00
|
|
|
i?86) ARCH=i686 ;;
|
2018-05-28 21:12:29 +02:00
|
|
|
arm*) ARCH=arm ;;
|
|
|
|
*) ARCH=$( uname -m ) ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
# 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 "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
TMP=${TMP:-/tmp}
|
|
|
|
PKG=$TMP/package-$PKGNAM
|
2022-11-21 21:23:13 +01:00
|
|
|
OUTPUT=${OUTPUT:-$TMP}
|
2018-05-28 21:12:29 +02:00
|
|
|
|
2018-09-21 20:51:07 +02:00
|
|
|
NUMJOBS=${NUMJOBS:-" -j$(expr $(nproc) + 1) "}
|
2018-05-28 21:12:29 +02:00
|
|
|
|
2024-08-30 19:52:19 +02:00
|
|
|
if [ "$ARCH" = "i686" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=pentium4 -mtune=generic"
|
2018-05-28 21:12:29 +02:00
|
|
|
LIBDIRSUFFIX=""
|
|
|
|
elif [ "$ARCH" = "x86_64" ]; then
|
2024-08-30 19:52:19 +02:00
|
|
|
SLKCFLAGS="-O2 -march=x86-64 -mtune=generic -fPIC"
|
2018-05-28 21:12:29 +02:00
|
|
|
LIBDIRSUFFIX="64"
|
|
|
|
else
|
|
|
|
SLKCFLAGS="-O2"
|
|
|
|
LIBDIRSUFFIX=""
|
|
|
|
fi
|
|
|
|
|
2018-08-23 01:44:25 +02:00
|
|
|
# Don't use icecream:
|
2018-09-18 21:22:30 +02:00
|
|
|
PATH=$(echo $PATH | sed "s|/usr/libexec/icecc/bin||g" | tr -s : | sed "s/^://g" | sed "s/:$//g")
|
2018-08-23 01:44:25 +02:00
|
|
|
|
2018-05-28 21:12:29 +02:00
|
|
|
# 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:
|
|
|
|
# (I actually felt free to strip out support for USR != yes :-)
|
|
|
|
USR="yes"
|
|
|
|
|
|
|
|
BINDIR=/opt/$PKGNAM/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
|
2019-08-05 09:33:15 +02:00
|
|
|
LIBVER=${LIBVER:-$(echo $LIBNAM-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
|
2018-05-28 21:12:29 +02:00
|
|
|
|
|
|
|
cd $TMP
|
|
|
|
rm -rf $LIBNAM-$LIBVER
|
2019-08-05 09:33:15 +02:00
|
|
|
tar xvf $CWD/$LIBNAM-$LIBVER.tar.?z || exit 1
|
2018-05-28 21:12:29 +02:00
|
|
|
cd $LIBNAM-$LIBVER || exit 1
|
|
|
|
chown -R root:root .
|
|
|
|
find -L . \
|
|
|
|
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
|
2019-09-30 23:08:32 +02:00
|
|
|
-o -perm 511 \) -exec chmod 755 {} \+ -o \
|
2018-05-28 21:12:29 +02:00
|
|
|
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
|
2019-09-30 23:08:32 +02:00
|
|
|
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \+
|
2018-05-28 21:12:29 +02:00
|
|
|
|
|
|
|
CFLAGS="$SLKCFLAGS" \
|
|
|
|
CXXFLAGS="$SLKCFLAGS" \
|
|
|
|
./configure \
|
|
|
|
--prefix=/usr \
|
|
|
|
--libdir=/usr/lib${LIBDIRSUFFIX} \
|
|
|
|
--sysconfdir=/etc \
|
|
|
|
--localstatedir=/var \
|
|
|
|
--mandir=/usr/man \
|
|
|
|
--docdir=/usr/doc/$PKGNAM-$VERSION/$LIBNAM-$LIBVER \
|
|
|
|
--build=$ARCH-slackware-linux || exit 1
|
|
|
|
|
|
|
|
make $NUMJOBS || make || exit 1
|
|
|
|
make install-strip DESTDIR=$PKG || exit 1
|
|
|
|
|
|
|
|
mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION/$LIBNAM-$LIBVER
|
|
|
|
cp -a COPYING* ChangeLog NEWS* README* TODO* \
|
|
|
|
$PKG/usr/doc/$PKGNAM-$VERSION/$LIBNAM-$LIBVER
|
|
|
|
|
|
|
|
# now build man-db itself, using the libpipeline installed in $PKG
|
|
|
|
cd $TMP
|
|
|
|
rm -rf $PKGNAM-$VERSION
|
2019-08-05 09:33:15 +02:00
|
|
|
tar xvf $CWD/$PKGNAM-$VERSION.tar.?z || exit 1
|
2018-05-28 21:12:29 +02:00
|
|
|
cd $PKGNAM-$VERSION || exit 1
|
|
|
|
|
|
|
|
chown -R root:root .
|
|
|
|
find -L . \
|
|
|
|
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
|
2019-09-30 23:08:32 +02:00
|
|
|
-o -perm 511 \) -exec chmod 755 {} \+ -o \
|
2018-05-28 21:12:29 +02:00
|
|
|
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
|
2019-09-30 23:08:32 +02:00
|
|
|
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \+
|
2018-05-28 21:12:29 +02:00
|
|
|
|
|
|
|
# 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/$PKGNAM-$VERSION \
|
|
|
|
--build=$ARCH-slackware-linux || exit 1
|
|
|
|
|
|
|
|
make $NUMJOBS || make || exit 1
|
|
|
|
make install-strip DESTDIR=$PKG || exit 1
|
|
|
|
|
|
|
|
# Add man2html
|
|
|
|
( cd $PKG/usr/bin
|
|
|
|
tar --strip-components=1 -xvf $CWD/other-scripts-${MAN2HTML}.tar.?z \
|
|
|
|
other-scripts-${MAN2HTML}/man2html
|
|
|
|
chown root:root man2html
|
|
|
|
chmod 755 man2html
|
|
|
|
)
|
|
|
|
|
|
|
|
# Don't ship .la files:
|
|
|
|
rm -f $PKG/usr/lib${LIBDIRSUFFIX}/*.la $PKG/usr/lib${LIBDIRSUFFIX}/man-db/*.la
|
|
|
|
|
|
|
|
# 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/
|
|
|
|
|
2019-09-30 23:08:32 +02:00
|
|
|
find $PKG/usr/man -type f -exec gzip -9 {} \+
|
2018-05-28 21:12:29 +02:00
|
|
|
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
|
|
|
|
|
|
|
|
# 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/$PKGNAM.cron $PKG/etc/cron.daily/$PKGNAM
|
|
|
|
|
2019-01-06 21:03:14 +01:00
|
|
|
# Choose a pager (defaults to 'most'):
|
|
|
|
mkdir -p $PKG/etc/profile.d
|
|
|
|
cp -a $CWD/man-db.sh $CWD/man-db.csh $PKG/etc/profile.d
|
|
|
|
chown root:root $PKG/etc/profile.d/*
|
|
|
|
chmod 755 $PKG/etc/profile.d/*
|
|
|
|
mv $PKG/etc/profile.d/man-db.csh $PKG/etc/profile.d/man-db.csh.new
|
|
|
|
mv $PKG/etc/profile.d/man-db.sh $PKG/etc/profile.d/man-db.sh.new
|
|
|
|
|
2018-05-28 21:12:29 +02:00
|
|
|
# modified default config, customized for Slackware. See the conf file for
|
|
|
|
# list of changes.
|
|
|
|
cat $CWD/man_db.conf.new \
|
|
|
|
| sed "s,@LIBDIRSUFFIX@,$LIBDIRSUFFIX,g" \
|
|
|
|
> $PKG/etc/man_db.conf.new
|
|
|
|
# Get rid of any existing file put there by "make install":
|
|
|
|
rm -rf $PKG/etc/man_db.conf
|
|
|
|
|
|
|
|
mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
|
2019-08-05 09:33:15 +02:00
|
|
|
cp -a \
|
2022-02-10 02:46:55 +01:00
|
|
|
ChangeLog FAQ* NEWS* README* COPYING* docs/HACKING* docs/INSTALL.quick \
|
|
|
|
docs/TODO* docs/*lsm docs/*example* \
|
2018-05-28 21:12:29 +02:00
|
|
|
$PKG/usr/doc/$PKGNAM-$VERSION
|
|
|
|
|
|
|
|
mkdir -p $PKG/install
|
|
|
|
cat $CWD/slack-desc > $PKG/install/slack-desc
|
|
|
|
zcat $CWD/doinst.sh.gz > $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/$PKGNAM-$VERSION-$ARCH-$BUILD.txz
|
|
|
|
|