#!/bin/sh # Slackware build script for mupdf # Originally written by Hubert Hesse (email removed). # Heavily modified by B. Watson (yalhcru@gmail.com). # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. # 20200217 bkw: update for 1.16.1. # 20180623 bkw: BUILD=2, add patch for dynamic linking. Thanks # to Thomas Morper for pointing me in the right direction. # 20180615 bkw: update for 1.13.0, move old change comments to ChangeLog.old # 20180101 bkw: update for 1.12.0. # 20170711 bkw: update for 1.11. # 20170621 bkw: fix build with -current's newer openjpeg, BUILD=2. # 20170122 bkw: update for 1.10a. PRGNAM=mupdf VERSION=${VERSION:-1.16.1} BUILD=${BUILD:-1} 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 rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP rm -rf $PRGNAM-$VERSION-source tar xvf $CWD/$PRGNAM-$VERSION-source.tar.?z cd $PRGNAM-$VERSION-source chown -R root:root . find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \ \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+ # Hard-code the version number so it'll stop trying to use git to retrieve # it and spewing harmless but scary 'fatal: Not a git repository' errors. sed -i "/^VERSION/s,=.*,= $VERSION," Makefile # 20180623 bkw: Finally, dynamic linking again. Patch is based on # http://www.linuxfromscratch.org/patches/blfs/svn/mupdf-1.13.0-shared_libs-1.patch # but I added versioned sonames. See README_shared.txt for the gory details. STATIC=${STATIC:-no} if [ "$STATIC" != "yes" ]; then patch -p1 < $CWD/shared_libs.diff LIBTYPE=shared else LIBTYPE=static fi # Build against system libs instead of bundled ones. If we didn't do this, # libmupdf would be useless for building anything else. make verbose=yes \ XCFLAGS="$SLKCFLAGS -DJBIG_NO_MEMENTO" \ USE_SYSTEM_LIBS=yes \ build=release \ prefix=/usr \ libdir=/usr/lib$LIBDIRSUFFIX \ mandir=/usr/man \ docdir=/usr/doc/$PRGNAM-$VERSION \ DESTDIR=$PKG \ all install strip $PKG/usr/bin/* gzip -9 $PKG/usr/man/man1/*.1 # Compatibility symlinks. Older versions, the binary is just "mupdf". # Separate -curl binary exists in 1.5 but not 1.4. ln -s $PRGNAM-x11 $PKG/usr/bin/$PRGNAM for i in x11 x11-curl gl; do [ -e $PKG/usr/bin/$PRGNAM-$i ] && \ ln -s $PRGNAM.1.gz $PKG/usr/man/man1/$PRGNAM-$i.1.gz done # Installed permissions are atrocious (everything 755). find $PKG -type f | xargs chmod 644 chmod 755 $PKG/usr/bin/* if [ "$STATIC" != "yes" ]; then chmod 755 $PKG/usr/lib$LIBDIRSUFFIX/lib*.so.*.* fi # .desktop taken from debian and modified: # - make it validate. # - add mime types for cbz and xps. mkdir -p $PKG/usr/share/applications cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop # Icon converted from platform/x11/mupdf.ico, with icotool. mkdir -p $PKG/usr/share/pixmaps cat $CWD/$PRGNAM.png > $PKG/usr/share/pixmaps/$PRGNAM.png # .pc file taken from debian and parameterized. PCLIBS="-l$PRGNAM -lfreetype -lharfbuzz -ljbig2dec -ljpeg -lcrypto -lopenjp2 -lz -lm" PCLIBS="$PCLIBS -lmupdfthird" mkdir -p $PKG/usr/lib$LIBDIRSUFFIX/pkgconfig/ sed -e "s,@LIB@,lib$LIBDIRSUFFIX,g" \ -e "s,@VERSION@,$VERSION,g" \ -e "s,@PCLIBS@,$PCLIBS,g" \ $CWD/$PRGNAM.pc > $PKG/usr/lib$LIBDIRSUFFIX/pkgconfig/$PRGNAM.pc # 'make install' already installed most of the docs. cp -a CONTRIBUTORS $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild # slack-desc will conveniently say whether javascript is built in, # and whether libs are shared or static. mkdir -p $PKG/install sed -e "s,@LIBTYPE@,$LIBTYPE," \ $CWD/slack-desc > $PKG/install/slack-desc cd $PKG /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}