diff options
author | B. Watson <urchlay@slackware.uk> | 2023-01-17 03:23:51 -0500 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2023-01-21 10:22:09 +0700 |
commit | 6973a7d31dc59398e2b54bf2ef7a8b8cd8c50122 (patch) | |
tree | 358e0087b66f4b44d1851863a3cfb4d1baed6794 | |
parent | babd926c0afb138873782a0652c4175f80cdf620 (diff) |
office/mupdf: Updated for version 1.21.1.
Signed-off-by: B. Watson <urchlay@slackware.uk>
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r-- | office/mupdf/README | 10 | ||||
-rw-r--r-- | office/mupdf/mupdf.SlackBuild | 137 | ||||
-rw-r--r-- | office/mupdf/mupdf.info | 8 | ||||
-rw-r--r-- | office/mupdf/mupdf.pc | 1 | ||||
-rw-r--r-- | office/mupdf/slack-desc | 2 |
5 files changed, 92 insertions, 66 deletions
diff --git a/office/mupdf/README b/office/mupdf/README index 4f9b5b1a81ce..82512e4acd25 100644 --- a/office/mupdf/README +++ b/office/mupdf/README @@ -1,7 +1,7 @@ mupdf is a lightweight PDF, CBZ, and XPS viewer and toolkit. The renderer in MuPDF is tailored for high quality anti-aliased -graphics. MuPDF renders text with metrics and spacing accurate to +graphics. MuPDF renders text with metrics and spacing accurate to within fractions of a pixel for the highest fidelity in reproducing the look of a printed page on screen. @@ -11,6 +11,10 @@ and more. It also reads XPS and OpenXPS documents. MuPDF is written modularly, so features can be added on by integrators if they so desire. +Optional dependency: tesseract. If this is installed, mupdf will be +built with OCR support. If it's installed but you don't want to build +mupdf with it, export TESSERACT=no in the environment. + Notes: 1. It's no longer possible to build mupdf without JavaScript support. @@ -19,7 +23,3 @@ Notes: regular PDF viewer, and mupdf-x11-curl has support for fetching remote resources from the network (which may be considered a security risk). mupdf-gl uses OpenGL for rendering (and doesn't support curl). - -3. mupdf's PDF digital signature verification and signing support is -disabled in this build, because Slackware 14.2's openssl is too old. -For most users, this is a rarely- or never-used feature anyway. diff --git a/office/mupdf/mupdf.SlackBuild b/office/mupdf/mupdf.SlackBuild index 9db2285904eb..ea13d0a46198 100644 --- a/office/mupdf/mupdf.SlackBuild +++ b/office/mupdf/mupdf.SlackBuild @@ -7,6 +7,13 @@ # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. +# 20230117 bkw: update for 1.21.1. +# - Again, this script can't build older versions. +# - There's a gumbo-parser SlackBuild now, so build with it instead of +# upstream's bundled version. +# - tesseract builds work, so make that an option. +# - Include pre-scaled PNG icons. + # 20201020 bkw: update for 1.18.0. See notes, below. # 20200217 bkw: update for 1.16.1. # 20180623 bkw: BUILD=2, add patch for dynamic linking. Thanks @@ -54,7 +61,7 @@ cd $(dirname $0) ; CWD=$(pwd) PRGNAM=mupdf -VERSION=${VERSION:-1.18.0} +VERSION=${VERSION:-1.21.1} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} @@ -91,27 +98,32 @@ else fi set -e -# Tesseract code left here for future reference. At some point upstream -# (or maybe I) will fix it. -if [ "${TESSERACT:-no}" = "yes" ]; then - TESSARGS="USE_SYSTEM_LEPTONICA=yes USE_SYSTEM_TESSERACT=yes" - cat <<EOF -*** -*** 20201023 bkw: Tesseract support in mupdf is currently broken. If -*** you want to forcibly build with it, edit the SlackBuild. Aborting. -*** +# Building mupdf seems to work OK if an older version is installed, +# but I only tested 1.21.1 when 1.18.0 was installed (doesn't mean +# it works for all versions). +print_failed_message() { + if pkg-config --exists mupdf; then + cat 1>&2 <<EOF + +************************************************************************** +* The build failed. This might have happened because you had an existing * +* (older) mupdf package installed. Run "removepkg mupdf" and try again. * +************************************************************************** EOF + fi exit 1 -else - TESSARGS="HAVE_LEPTONICA=no HAVE_TESSERACT=no" -fi +} +# 20230117 bkw: tesseract builds work fine in 1.21.1, but tesseract +# doesn't get autodetected. Help it out a little. +TESS=no +[ "${TESSERACT:-yes}" = "yes" ] && pkg-config --exists tesseract && TESS=yes rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP rm -rf $PRGNAM-$VERSION-source -tar xvf $CWD/$PRGNAM-$VERSION-source.tar.?z +tar xvf $CWD/$PRGNAM-$VERSION-source.tar.lz cd $PRGNAM-$VERSION-source chown -R root:root . @@ -131,52 +143,70 @@ SOMAJOR=$(echo $VERSION | cut -d. -f1-2 | sed -e 's,\.[0-9]$,0&,' -e 's,\.,,g') SOMINOR=$(echo $VERSION | cut -d. -f3- | sed 's,\.,,g' ) SOVER=$SOMAJOR.$SOMINOR -# Shared libraries should be installed executable. -sed -i '/install.*644.*INSTALL_LIBS/s,644,755,' Makefile - -# tesseract autodetection is mildly broken: -sed -i 's,tesseract-ocr,tesseract,' Makerules - # Build against system libs instead of bundled ones, where possible. +# Upstream recommends using their bundled lcms2 and mujs, I'll go with that. +# Also, we *still* (in Slack 15.0) have to use the bundled freeglut +# to get copy/paste working in mupdf-gl. # C++ (XCXXFLAGS) is only actually used if building with tesseract. make verbose=yes \ shared=yes \ LIB_LDFLAGS="-shared -Wl,-soname -Wl,libmupdf.so.$SOMAJOR" \ - SO="so.$SOVER" \ - XCFLAGS="$SLKCFLAGS -DJBIG_NO_MEMENTO" \ - XCXXFLAGS="-std=c++11 -fpermissive" \ USE_SYSTEM_LIBS=yes \ - USE_SYSTEM_GUMBO=no \ USE_SYSTEM_GLUT=no \ - $TESSARGS \ + tesseract=$TESS \ build=release \ prefix=/usr \ libdir=/usr/lib$LIBDIRSUFFIX \ mandir=/usr/man \ docdir=/usr/doc/$PRGNAM-$VERSION \ DESTDIR=$PKG \ - all install + all install || print_failed_message # bins and libs are already stripped. gzip -9 $PKG/usr/man/man1/*.1 -# ldconfig will create the libmupdf.so.$SOVER link, but the libmupdf.so -# one has to be part of the package. -ln -s lib$PRGNAM.so.$SOMAJOR.$SOMINOR $PKG/usr/lib$LIBDIRSUFFIX/lib$PRGNAM.so - -# Historically, mupdf has included two libraries: libmupdf itself, -# and libmupdf-third, containing all the bundled third party code -# included with the source. In version 1.18.0, when building a -# shared lib, no libmupdf-third gets created (all the code ends up in -# libmupdf.so). However, most projects that link with libmupdf expect -# this library to exist. This will probably change in the future as -# those projects get updated for the changes in mupdf, but for now, -# to be compatible with older mupdf versions, we include an empty -# libmupdf-third for stuff to link with. -ar crs $PKG/usr/lib$LIBDIRSUFFIX/libmupdf-third.a +# 20230117 bkw: fix up the lib dir. +cd $PKG/usr/lib$LIBDIRSUFFIX + # 20230117 bkw: AFAIK, we have to list every shared lib this one + # depends on in the .pc file. This rather odd-looking bit of code + # creates the list. + PCLIBS="-lmupdf $( + objdump -p libmupdf.so | \ + perl -ne 'next unless /NEEDED/; + chomp; + s,.* lib([^.]*)\.so.*,\1,; + print "-l$_ " unless /^(c|gcc_s)$/;' + )" + WITHTESS=WITHOUT + echo "$PCLIBS" | grep -q ltesseract && WITHTESS=WITH + echo "==> PCLIBS='$PCLIBS'" + + # 20230117 bkw: the library is versioned, but the filename isn't... + chmod 755 libmupdf.so + mv libmupdf.so libmupdf.so.$SOVER + ln -s libmupdf.so.$SOVER libmupdf.so + ln -s libmupdf.so.$SOVER libmupdf.so.$SOMAJOR + + # .pc file taken from debian and parameterized. + mkdir -p pkgconfig/ + sed -e "s,@LIB@,lib$LIBDIRSUFFIX,g" \ + -e "s,@VERSION@,$VERSION,g" \ + -e "s,@PCLIBS@,$PCLIBS,g" \ + $CWD/$PRGNAM.pc > pkgconfig/$PRGNAM.pc + + # Historically, mupdf has included two libraries: libmupdf itself, + # and libmupdf-third, containing all the bundled third party code + # included with the source. In version >=1.18.0, when building a + # shared lib, no libmupdf-third gets created (all the code ends up in + # libmupdf.so). However, most projects that link with libmupdf expect + # this library to exist. This will probably change in the future as + # those projects get updated for the changes in mupdf, but for now, + # to be compatible with older mupdf versions, we include an empty + # libmupdf-third for stuff to link with. + ar crs libmupdf-third.a +cd - # 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 ] && \ @@ -189,27 +219,24 @@ done mkdir -p $PKG/usr/share/applications cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop -# Use shipped PNG and SVG icons. +# Use shipped SVG icon, make PNGs at various sizes. mkdir -p $PKG/usr/share/pixmaps $PKG/usr/share/icons/hicolor/scalable/apps -cat docs/logo/mupdf-icon.png > $PKG/usr/share/pixmaps/$PRGNAM.png -cat docs/logo/mupdf-logo.svg > $PKG/usr/share/icons/hicolor/scalable/apps/$PRGNAM.svg - -# .pc file taken from debian and parameterized. -# -lcrypto used to be in this list, will be again someday. -PCLIBS="-l$PRGNAM -lfreetype -lharfbuzz -ljbig2dec -ljpeg -lopenjp2 -lz -lm" - -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 +svg=docs/logo/mupdf-logo.svg +for i in 16 22 32 48 64 128; do + px=${i}x${i} + dir=$PKG/usr/share/icons/hicolor/$px/apps + mkdir -p $dir + rsvg-convert --width=$i --height=$i -o $dir/$PRGNAM.png $svg +done +cat $svg > $PKG/usr/share/icons/hicolor/scalable/apps/$PRGNAM.svg +ln -s ../icons/hicolor/48x48/apps/$PRGNAM.png $PKG/usr/share/pixmaps/$PRGNAM.png # 'make install' already installed most of the docs. cp -a CONTRIBUTORS docs/api $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild mkdir -p $PKG/install -cat $CWD/slack-desc > $PKG/install/slack-desc +sed "s,@WITHTESS@,$WITHTESS," < $CWD/slack-desc > $PKG/install/slack-desc cat $CWD/doinst.sh > $PKG/install/doinst.sh cd $PKG diff --git a/office/mupdf/mupdf.info b/office/mupdf/mupdf.info index 2d5edae7a55f..5ded702d0d4f 100644 --- a/office/mupdf/mupdf.info +++ b/office/mupdf/mupdf.info @@ -1,10 +1,10 @@ PRGNAM="mupdf" -VERSION="1.18.0" +VERSION="1.21.1" HOMEPAGE="https://www.mupdf.com/" -DOWNLOAD="https://www.mupdf.com/downloads/archive/mupdf-1.18.0-source.tar.xz" -MD5SUM="3135391b027cdbedf915db1787b4ea05" +DOWNLOAD="https://www.mupdf.com/downloads/archive/mupdf-1.21.1-source.tar.lz" +MD5SUM="476ac6c3e71f85378a056844fa2daa8a" DOWNLOAD_x86_64="" MD5SUM_x86_64="" -REQUIRES="jbig2dec" +REQUIRES="jbig2dec gumbo-parser" MAINTAINER="B. Watson" EMAIL="urchlay@slackware.uk" diff --git a/office/mupdf/mupdf.pc b/office/mupdf/mupdf.pc index 50cb195d72d6..2f8aa9afcf54 100644 --- a/office/mupdf/mupdf.pc +++ b/office/mupdf/mupdf.pc @@ -5,7 +5,6 @@ includedir=${prefix}/include Name: mupdf Description: Library for rendering PDF documents -Requires.private: freetype2 Version: @VERSION@ Libs: -L${libdir} @PCLIBS@ Cflags: -I${includedir} diff --git a/office/mupdf/slack-desc b/office/mupdf/slack-desc index b2765401f2f4..8110a7fe4f4d 100644 --- a/office/mupdf/slack-desc +++ b/office/mupdf/slack-desc @@ -15,5 +15,5 @@ mupdf: the look of a printed page on screen. mupdf: mupdf: https://www.mupdf.com/ mupdf: -mupdf: +mupdf: This package was built @WITHTESS@ tesseract support. mupdf: |