#!/bin/bash shopt -s extglob ulimit -s unlimited # man-db.SlackBuild # Heavily based on the original Slackware build scripts, # Modified by Stuart Winter for Slackware ARM. # # Written by B. Watson (yalhcru@gmail.com) # # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. # # 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. */ # # Record toolchain & other info for the build log: slackbuildinfo # Paths to skeleton port's source & real Slackware source tree: slackset_var_cwds # Temporary build locations: export TMPBUILD=$TMP/build-$PKGNAM export PKG=$TMP/package-$PKGNAM mkpkgdirs # Delete & re-create temporary directories then cd into $TMPBUILD # Set paths for the package's install locations: BINDIR=/usr/bin MANDIR=/usr/man # Version of man2html: MAN2HTML=${MAN2HTML:-20180101} ### Build libpipeline ##################### # 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 pushd $CWD LIBVER=${LIBVER:-$(echo $LIBNAM-*.tar.!(*sign|*asc|*sig) | rev | cut -f 3- -d . | cut -f 1 -d - | rev)} echo $LIBVER popd # Extract source: tar xvvf $CWD/$LIBNAM-*.tar.!(*sign|*asc|*sig) cd $LIBNAM-*/ || exit 1 slackhousekeeping # Configure: 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 \ --host=${SLK_ARCH_HOST} \ --build=${SLK_ARCH_BUILD} || failconfig # Build: make $NUMJOBS || make || failmake # Install into package framework: make install-strip DESTDIR=$PKG || failinstall mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION/$LIBNAM-$LIBVER cp -fav COPYING* ChangeLog NEWS* README* TODO* \ $PKG/usr/doc/$PKGNAM-$VERSION/$LIBNAM-$LIBVER ### Build man-db ##################### # Extract source: cd $TMPBUILD tar xvvf $CWD/$PKGNAM-$VERSION.tar.!(*sign|*asc|*sig) || exit 1 cd $PKGNAM-$VERSION || exit 1 slackhousekeeping # # Apply Patches: # # 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. zcat $CWD/dont_write_in_usr.diff.gz | patch -p1 --verbose || exit 1 # Configure: # # 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 \ --host=${SLK_ARCH_HOST} \ --build=${SLK_ARCH_BUILD} || failconfig # Build: make $NUMJOBS || make || exit 1 # Install in to package: make install-strip DESTDIR=$PKG || exit 1 # Add man2html ( cd $PKG/usr/bin tar --strip-components=1 -xvf $CWD/other-scripts-${MAN2HTML}.tar.!(*sign|*asc|*sig) \ other-scripts-${MAN2HTML}/man2html chmod 755 man2html ) # 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/ # 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 -vpm755 $CWD/$PKGNAM.cron $PKG/etc/cron.daily/$PKGNAM # 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 chmod 755 $PKG/etc/profile.d/* mv -fv $PKG/etc/profile.d/man-db.csh $PKG/etc/profile.d/man-db.csh.new mv -fv $PKG/etc/profile.d/man-db.sh $PKG/etc/profile.d/man-db.sh.new # 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 # Add documentation: mkdir -vpm755 $PKG/usr/doc/$PKGNAM-$VERSION cp -fav \ ChangeLog FAQ* NEWS* README* docs/COPYING* docs/HACKING docs/INSTALL.quick \ docs/TODO docs/*lsm docs/*example* \ $PKG/usr/doc/$PKGNAM-$VERSION #changelogliposuction ChangeLog $PKGNAM $VERSION # Trim down a "ChangeLog" file # Apply generic Slackware packaging policies: cd $PKG slackstripall # strip all .a archives and all ELFs #slackstriprpaths # strip rpaths slack_delete_lafiles # delete usr/lib{,64}/*.la slackgzpages -i # compress man & info pages and delete usr/info/dir slackslack # set standard Slackware file/dir permissions and ownerships slackdesc # install slack-desc and doinst.sh slackmp -p # run makepkg -l y -c n -p (for symlink pre-pend code) # Perform any final checks on the package: cd $PKG slackhlinks # search for any hard links