aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2014-08-15 14:58:19 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2014-08-15 23:21:33 +0700
commitb1e258732ea485dd4feb6d25dd2ae3f636dbfaef (patch)
treea6b0eceb0da7f56da97d89fc45e06b1910939b26
parent4c4f7066fc127ec5a20de1c5dad2ac1668cbd4e5 (diff)
system/man-db: Added (database-driven manual pager suite).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r--system/man-db/README12
-rw-r--r--system/man-db/README.Slackware50
-rw-r--r--system/man-db/doinst.sh32
-rw-r--r--system/man-db/man-db.SlackBuild167
-rw-r--r--system/man-db/man-db.cron23
-rw-r--r--system/man-db/man-db.csh12
-rw-r--r--system/man-db/man-db.info12
-rw-r--r--system/man-db/man-db.sh16
-rw-r--r--system/man-db/man_db.conf.new.gzbin0 -> 2404 bytes
-rw-r--r--system/man-db/slack-desc19
10 files changed, 343 insertions, 0 deletions
diff --git a/system/man-db/README b/system/man-db/README
new file mode 100644
index 0000000000000..b8ff80058e83c
--- /dev/null
+++ b/system/man-db/README
@@ -0,0 +1,12 @@
+man-db (database-driven manual pager suite)
+
+This package provides the man command and related utilities for examining
+on-line help files (manual pages). It can act as a replacement for
+Slackware's man package. It has several enhancements over man, including
+an indexed database, the ability to easily view man pages in a browser,
+and better i18n support.
+
+This build includes a complete install of libpipeline.
+
+By default, man-db doesn't conflict with Slackware's man package. See
+README.Slackware for details.
diff --git a/system/man-db/README.Slackware b/system/man-db/README.Slackware
new file mode 100644
index 0000000000000..f0eb6b57ca842
--- /dev/null
+++ b/system/man-db/README.Slackware
@@ -0,0 +1,50 @@
+By default, man-db can be installed alongside Slackware's man package
+without conflict, as it installs its binaries and man pages into
+/opt/man-db. After installation, either log out and back in, or source
+/etc/profile.d/man-db.sh in your shell (this adjusts $PATH so the man
+command from /opt/man-db will be found first).
+
+Alternately, man-db can be built as a replacement for Slackware's
+man package. To do this, set USR=yes in the script's environment,
+and "removepkg man" before installing man-db. No profile scripts are
+installed in this case.
+
+When installing man-db, the doinst.sh script may take several minutes to
+run. This is because it's indexing all the man pages on the system. Also,
+a cron job is installed in /etc/cron.daily, which adds newly-installed
+man pages to the database. The index speeds up searching via "man -K",
+"man -k", or "apropos". It's fast enough that "man -K" is now actually
+useful... the disadvantage is that newly-installed man pages won't be
+found in these searches until the database has been updated, so any time
+you install new man pages, you'll want to run "mandb" as root, or wait
+for cron to do it for you (if you don't do this, the new pages can still
+be displayed, they just won't be searchable). The indexing runs quickly
+once the initial database has been created, so the cron job or manual
+update shouldn't bring your system to its knees.
+
+The database is located in /var/cache/man, and on a full Slackware install
+will be approximately 5MB in size. During index creation, approximately
+10MB in /var is used. If you decide to removepkg man-db, you'll probably
+also want to get rid of its database with "rm -rf /var/cache/man". If
+the database gets corrupted somehow, it can be regenerated from scratch
+by running "mandb -c" or just reinstalling the man-db package.
+
+Although man-db supports caching formatted pages ("cat" pages), it's
+disabled in this build, to make man-db behave more like Slackware's man
+(which supports caching, but it's disabled). On modern (and even 10+
+year old) systems, the small amount of extra time it takes to format
+a man page every time it's viewed is probably not worth the headaches
+caused by stale cat pages.
+
+Unlike some distro packages of man-db, this build doesn't install man or
+mandb setuid. This prevents caching cat pages from working (see above),
+and prevents man from automatically adding new man pages to the database
+the first time a user views them (they will be indexed by the cron job,
+or by root manually running "mandb", if you're impatient).
+
+A word about i18n support: the whole reason I packaged man-db is because
+Slackware's man can't handle Japanese man pages, and I couldn't come
+up with a way to make them work after several hours of research and
+man.conf editing. With man-db, they Just Work, with LANG=ja_JP.UTF-8
+(now all I have to do is learn to read Japanese). In general, UTF-8
+locales are preferred for man-db, although non-UTF-8 is also supported.
diff --git a/system/man-db/doinst.sh b/system/man-db/doinst.sh
new file mode 100644
index 0000000000000..42773f6cd9913
--- /dev/null
+++ b/system/man-db/doinst.sh
@@ -0,0 +1,32 @@
+
+config() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
+ # toss the redundant copy
+ rm $NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+}
+
+config etc/man_db.conf.new
+
+# Generate the initial man database (or rebuild it if it exists).
+# We want to skip this step if installing somewhere besides / (e.g. with
+# the -root option or ROOT env variable set for installpkg), hence the
+# readlink silliness.
+
+# The -c option means it blows away any existing db. I thought about
+# leaving it off (it will still create the db if it doesn't exist),
+# but decided it's better to build it fresh if the package gets
+# reinstalled (in case the db format has changed, or in case the
+# db is corrupted and the user is trying to fix it by reinstalling
+# this package).
+
+[ -x /bin/readlink ] && \
+[ "$( /bin/readlink -f $( pwd ) )" = "/" ] && \
+( [ -x /opt/man-db/bin/mandb ] && /opt/man-db/bin/mandb -c -q ) || \
+( [ -x /usr/bin/mandb ] && /usr/bin/mandb -c -q )
diff --git a/system/man-db/man-db.SlackBuild b/system/man-db/man-db.SlackBuild
new file mode 100644
index 0000000000000..10aeb339301e3
--- /dev/null
+++ b/system/man-db/man-db.SlackBuild
@@ -0,0 +1,167 @@
+#!/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.
+
+PRGNAM=man-db
+VERSION=${VERSION:-2.6.7}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i486 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -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.3.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 {} \;
+
+libpipeline_CFLAGS="-I$PKG/usr/include" \
+libpipeline_LIBS="-L$PKG/usr/lib$LIBDIRSUFFIX -lpipeline" \
+CFLAGS="$SLKCFLAGS" \
+CXXFLAGS="$SLKCFLAGS" \
+./configure \
+ --disable-setuid \
+ --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
+
+# 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}
diff --git a/system/man-db/man-db.cron b/system/man-db/man-db.cron
new file mode 100644
index 0000000000000..d25bf3b5ec71b
--- /dev/null
+++ b/system/man-db/man-db.cron
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+# man-db daily cronjob, part of the slackbuilds.org man-db package.
+# Author: B. Watson.
+# Adapted from Debian's man-db package, so I guess the license is GPL.
+
+set -e
+
+if ! [ -d /var/cache/man ]; then
+ # Recover from deletion, per FHS.
+ mkdir -p /var/cache/man
+ chown man:root /var/cache/man || true
+ chmod 2755 /var/cache/man
+fi
+
+# expunge old catman pages which have not been read in a week
+# commented out, as we've got cat pages disabled in this build. Left
+# here for reference in case someone really wants to enable cat pages
+# some day.
+#find /var/cache/man -type f -name '*.gz' -atime +6 -print0 | xargs -r0 rm -f &> /dev/null
+
+# regenerate man database
+[ -x /opt/man-db/bin/mandb ] && /opt/man-db/bin/mandb --no-purge --quiet
diff --git a/system/man-db/man-db.csh b/system/man-db/man-db.csh
new file mode 100644
index 0000000000000..6cf39ce0ba496
--- /dev/null
+++ b/system/man-db/man-db.csh
@@ -0,0 +1,12 @@
+#!/bin/csh
+
+# Set up environment for man-db. This file is part of the slackbuilds.org
+# man-db build.
+
+# Author: B. Watson. License: WTFPL
+
+setenv MANPATH /opt/man-db/man:$MANPATH
+set path = ( /opt/man-db/bin $path )
+if ("`id -u`" == "0") then
+ set path = ( /opt/man-db/sbin $path )
+endif
diff --git a/system/man-db/man-db.info b/system/man-db/man-db.info
new file mode 100644
index 0000000000000..002eb47f21585
--- /dev/null
+++ b/system/man-db/man-db.info
@@ -0,0 +1,12 @@
+PRGNAM="man-db"
+VERSION="2.6.7"
+HOMEPAGE="http://savannah.nongnu.org/projects/man-db"
+DOWNLOAD="http://download.savannah.gnu.org/releases/man-db/man-db-2.6.7.tar.xz \
+ http://download.savannah.gnu.org/releases/libpipeline/libpipeline-1.3.0.tar.gz"
+MD5SUM="68010e84597651ed673ff1b93beb83b1 \
+ 242428c01dca255cdcb2195073a9c6ed"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES=""
+MAINTAINER="B. Watson"
+EMAIL="yalhcru@gmail.com"
diff --git a/system/man-db/man-db.sh b/system/man-db/man-db.sh
new file mode 100644
index 0000000000000..54c9b34ae069a
--- /dev/null
+++ b/system/man-db/man-db.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+# Set up environment for man-db. This file is part of the slackbuilds.org
+# man-db build.
+
+# Author: B. Watson. License: WTFPL
+
+MANPATH="/opt/man-db/man:$MANPATH"
+PATH="/opt/man-db/bin:$PATH"
+
+if [ "$( id -u )" = "0" ]; then
+ PATH="/opt/man-db/sbin:$PATH"
+fi
+
+export MANPATH
+export PATH
diff --git a/system/man-db/man_db.conf.new.gz b/system/man-db/man_db.conf.new.gz
new file mode 100644
index 0000000000000..1d128438c41d3
--- /dev/null
+++ b/system/man-db/man_db.conf.new.gz
Binary files differ
diff --git a/system/man-db/slack-desc b/system/man-db/slack-desc
new file mode 100644
index 0000000000000..0ac352659f93c
--- /dev/null
+++ b/system/man-db/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+man-db: man-db (database-driven manual pager suite)
+man-db:
+man-db: This package provides the man command and related utilities
+man-db: for examining on-line help files (manual pages). It can act as a
+man-db: replacement for Slackware's man package. It has several enhancements
+man-db: over man, including an indexed database, the ability to easily view
+man-db: man pages in a browser, and better i18n support.
+man-db:
+man-db: This package installs binaries in @BINDIR@.
+man-db:
+man-db: