#!/bin/bash ulimit -s unlimited shopt -s extglob # netpbmp.SlackBuild # Heavily based on the original Slackware build scripts, # Modified by Stuart Winter # # Copyright 2006, 2007, 2008, 2009, 2015, 2018 Patrick J. Volkerding, Sebeka, MN, USA # All rights reserved. # # Redistribution and use of this script, with or without modification, is # permitted provided that the following conditions are met: # # 1. Redistributions of this script must retain the above copyright # notice, this list of conditions and the following disclaimer. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # 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 # Extract source: tar xvvf $CWD/$PKGNAM-$VERSION.tar.!(*sign|*asc|*sig) cd $PKGNAM*/ || failextract slackhousekeeping # Apply patches: #zcat $CWD/netpbm-security-code.patch.gz | patch -p1 --verbose || exit 1 zcat $CWD/netpbm-ppmfadeusage.patch.gz | patch -p1 --verbose || exit 1 zcat $CWD/netpbm-noppmtompeg.patch.gz | patch -p1 --verbose || exit 1 zcat $CWD/netpbm-CVE-2017-2587.patch.gz | patch -p1 --verbose || exit 1 zcat $CWD/netpbm-python3.patch.gz | patch -p1 --verbose || exit 1 zcat $CWD/netpbm-time.patch.gz | patch -p1 --verbose || exit 1 zcat $CWD/netpbm-gcc4.patch.gz | patch -p1 --verbose || exit 1 zcat $CWD/netpbm-bmptopnm.patch.gz | patch -p1 --verbose || exit 1 zcat $CWD/netpbm-CAN-2005-2471.patch.gz | patch -p1 --verbose || exit 1 zcat $CWD/netpbm-xwdfix.patch.gz | patch -p1 --verbose || exit 1 zcat $CWD/netpbm-multilib.patch.gz | patch -p1 --verbose || exit 1 zcat $CWD/netpbm-glibc.patch.gz | patch -p1 --verbose || exit 1 zcat $CWD/netpbm-docfix.patch.gz | patch -p1 --verbose || exit 1 zcat $CWD/netpbm-cmuwtopbm.patch.gz | patch -p1 --verbose || exit 1 zcat $CWD/netpbm-manfix.patch.gz | patch -p1 --verbose || exit 1 zcat $CWD/netpbm-manual-pages.patch.gz | patch -p1 --verbose || exit 1 zcat $CWD/netpbm-libdir-so.patch.gz | patch -p1 --verbose || exit 1 # GCC 14 "fix": cat $CWD/netpbm.gcc14.diff | patch -p1 --verbose || exit 1 # Configure: # Send blank lines to "configure" to just take defaults: ./configure << EOF EOF # Build (doesn't like parallel builds) make $NUMJOBS || make || failmake # Install into package: rm -rf $PKG # otherwise the installation fails; it likes to make the directory itself make package pkgdir=$PKG # Put things in proper directories: ( cd $PKG rm README mkdir -p usr mv * usr 2> /dev/null cd usr mkdir -p doc/netpbm-$VERSION mv VERSION bin/doc.url doc/netpbm-$VERSION if [ -r lib/libnetpbm.so.11 ]; then ( cd lib ; rm -f libnetpbm.so ; ln -sf libnetpbm.so.11 libnetpbm.so ) else echo "ERROR: libnetpbm.so.11 not found." echo "Please edit the correct library major version into the build script" exit 1 fi mv lib lib${LIBDIRSUFFIX} 2> /dev/null # Remove junk directories: rm -rf link misc # Remove manweb related files: rm -rf bin/manweb man/web # Any other files in /usr are junk: rm --verbose * 2> /dev/null ) # Don't package the static library: rm -fv $PKG/usr/lib${LIBDIRSUFFIX}/libnetpbm.a # Create and install man pages for existing utilities: ( cd userguide for i in *.html ; do ../buildtools/makeman ${i} done for manpage in *.1 ; do if [ ! -r $PKG/usr/bin/$(basename $manpage .1) ]; then rm $manpage fi done for i in 1 3 5 ; do mkdir -p man/man${i} mv *.${i} man/man${i} done mv man $PKG/usr ) # Add a documentation directory: ( cd doc cp -a \ CONTRIBUTORS COPYRIGHT.PATENT GPL_LICENSE.txt HISTORY INSTALL \ Netpbm.programming USERDOC copyright_summary lgpl_v21.txt \ patent_summary \ $PKG/usr/doc/${PKGNAM}-$VERSION if [ -r HISTORY ]; then DOCSDIR=$(echo $PKG/usr/doc/${PKGNAM}-$VERSION) cat HISTORY | head -n 1000 > $DOCSDIR/HISTORY touch -r HISTORY $DOCSDIR/HISTORY fi ) # Apply generic Slackware packaging policies: cd $PKG slackstripall # strip all .a archives and all ELFs slack_delete_lafiles # delete usr/lib{,64}/*.la #slackstriprpaths # strip rpaths slackgzpages -i # compress man & info pages and delete usr/info/dir slackslack # chown -R root:root, chmod -R og-w, slackchown, slack644docs slackdesc # install slack-desc and doinst.sh slackmp # run makepkg # Perform any final checks on the package: cd $PKG slackhlinks # search for any hard links