Package: libmupdf-dev
Version: 1.28.2+ds1-2
Severity: normal
Tags: patch

/usr/lib/x86_64-linux-gnu/pkgconfig/mupdf.pc says "Version: 1.24.10",
although the installed library is 1.28.2:

  $ pkg-config --modversion mupdf
  1.24.10

Builds that check the MuPDF version through pkg-config therefore fail.
For example, emacs-reader requires at least 1.26.0 and stops with
"MuPDF version 1.24.10 too old. Require ≥ 1.26.0."
(https://codeberg.org/MonadicSheep/emacs-reader/issues/188).

debian/rules generates the file from debian/mupdf.pc.in and substitutes
only @@DEB_HOST_MULTIARCH@@; the version in the template is still
1.24.10. Trixie's 1.25.1+ds1-6+deb13u1 ships the same file.

The first line of the template also says "refix=/usr" instead of
"prefix=/usr", so ${prefix} is undefined and pkgconf expands it to an
empty string: "pkg-config --cflags mupdf" prints "-I/include".

The attached patch fills in the upstream version from DEB_VERSION_UPSTREAM
and corrects the prefix line. I tested the changed recipe on sid with
the dpkg makefiles that debian/rules includes (architecture.mk,
pkg-info.mk): the generated file says "Version: 1.28.2" and
"prefix=/usr", "pkgconf --validate mupdf" passes, and
"pkgconf --atleast-version=1.26.0 mupdf" succeeds. I did not run a full
package build.
--- a/debian/mupdf.pc.in
+++ b/debian/mupdf.pc.in
@@ -1,10 +1,10 @@
-refix=/usr
+prefix=/usr
 exec_prefix=${prefix}
 libdir=${exec_prefix}/lib/@@DEB_HOST_MULTIARCH@@
 includedir=${prefix}/include
 
 Name: mupdf
 Description: Library for rendering PDF documents
-Version: 1.24.10
+Version: @@VERSION@@
 Libs: -L${libdir} -lmupdf
 Cflags: -I${includedir}
--- a/debian/rules
+++ b/debian/rules
@@ -67,7 +67,9 @@
 	dh_clean
 
 override_dh_auto_build:
-	-sed -e s,@@DEB_HOST_MULTIARCH@@,${DEB_HOST_MULTIARCH}, debian/mupdf.pc.in > debian/mupdf.pc
+	-sed -e s,@@DEB_HOST_MULTIARCH@@,${DEB_HOST_MULTIARCH}, \
+	     -e s,@@VERSION@@,$(firstword $(subst +, ,$(DEB_VERSION_UPSTREAM))), \
+	     debian/mupdf.pc.in > debian/mupdf.pc
 	debian/replace-fonts.sh
 	-mkdir source/pdf/cmaps
 	sh scripts/runcmapdump.sh

Reply via email to