[bug#78401] gnu: mupdf: Update to 1.26.0.

Message ID 87sel52i8k.fsf@subvertising.org
State New
Headers
Series [bug#78401] gnu: mupdf: Update to 1.26.0. |

Commit Message

Divya Ranjan May 16, 2025, 6:16 a.m. UTC
  Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

> Hi,

Hello Maxim,

> Divya Ranjan <divya@subvertising.org> writes:
>
>> * gnu/packages/pdf.scm (mupdf): Update to 1.26.0.
>
> Various changes done here are not listed in the change log.  Please
> consult other commits for examples or (info "(standards) Style of Change
> Logs").

Please find the updated patch with the indentation and commit message fixed.
>
>>         (modules '((guix build utils)
>>                    (ice-9 ftw)
>>                    (srfi srfi-1)))
>> @@ -895,6 +895,7 @@ (define-public mupdf
>>             libx11
>>             libxext
>>             mujs
>> +	   brotli
>
> Is this strictly needed for the update?  Otherwise, it'd be best done in
> a distinct, separated commit.

Indeed, it is a new dependency with the update.
>
>>             openjpeg
>>             openssl
>>             zlib))
>> @@ -907,6 +908,7 @@ (define-public mupdf
>>        #~(list "verbose=yes"
>>                (string-append "CC=" #$(cc-for-target))
>>                "XCFLAGS=-fpic"
>> +	      "USE_SYSTEM_BROTLI=yes"
>
> I assume that's necessary and not something the build system
> automatically tries?  If the later, do not explicit it (it makes inputs
> rewriting less useful).

Indeed, the build system doesn’t do that with USE_SYSTEM_LIBS=yes.

>>                "USE_SYSTEM_FREETYPE=yes"
>>                "USE_SYSTEM_GUMBO=yes"
>>                "USE_SYSTEM_HARFBUZZ=yes"
>> @@ -921,7 +923,7 @@ (define-public mupdf
>>                "USE_SYSTEM_CURL=yes"
>>                "USE_SYSTEM_LEPTONICA=yes"
>>                "USE_SYSTEM_TESSERACT=yes"
>> -              "USE_SONAME=no"           ;install as libmupdf.so
>> +              "USE_SONAME=yes"
>

Without enabling that, one runs in to "Too many levels of symbolic links" errors. This is due to a recent change in mupdf upstream that updated their symbol table for the library. I was part of the changes made for this, and the devs agree that USE_SONAME should be enabled. Here’s the backtrace with USE_SONAME=yes:

error: in phase 'validate-runpath': uncaught exception:
system-error "open-file" "~A: ~S" ("Too many levels of symbolic links" "/gnu/store/j6r6rgvmmm59a8i7vh330c7bpxmgicma-mupdf-1.26.0/lib/libmupdf.so") (40) 
phase `validate-runpath' failed after 0.0 seconds
Backtrace:
          13 (primitive-load "/gnu/store/304wldk8xn5xd2cnpvr66lbkn82…")
In guix/build/gnu-build-system.scm:
    966:2 12 (gnu-build #:source _ #:outputs _ #:inputs _ #:phases . #)
In ice-9/boot-9.scm:
  1752:10 11 (with-exception-handler _ _ #:unwind? _ # _)
In srfi/srfi-1.scm:
    634:9 10 (for-each #<procedure 7fffef021240 at guix/build/gnu-b…> …)
In ice-9/boot-9.scm:
  1752:10  9 (with-exception-handler _ _ #:unwind? _ # _)
In guix/build/gnu-build-system.scm:
   987:23  8 (_)
   605:16  7 (validate-runpath #:validate-runpath? _ # _ #:outputs _)
In guix/build/utils.scm:
   735:23  6 (loop ("/gnu/store/j6r6rgvmmm59a8i7vh330c7bpxmgicma…" …) …)
In guix/build/gnu-build-system.scm:
   587:36  5 (validate "/gnu/store/j6r6rgvmmm59a8i7vh330c7bpxmgicma-…")
In guix/build/utils.scm:
   549:10  4 (find-files "/gnu/store/j6r6rgvmmm59a8i7vh330c7bpxmgic…" …)
In ice-9/ftw.scm:
   505:39  3 (loop _ _ #(25 88653728 16877 1 999 30000 0 22 # # # …) …)
In guix/build/utils.scm:
   551:34  2 (_ "/gnu/store/j6r6rgvmmm59a8i7vh330c7bpxmgicma-mupdf-…" …)
In ice-9/boot-9.scm:
  1685:16  1 (raise-exception _ #:continuable? _)
  1685:16  0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
In procedure open-file: Too many levels of symbolic links: "/gnu/store/j6r6rgvmmm59a8i7vh330c7bpxmgicma-mupdf-1.26.0/lib/libmupdf.so"
build process 18 exited with status 256


Also, I don’t want to open another bug report, but enabling SONAME breaks sioyek which depends on mupdf-1.24. Since the latter inherits from mupdf, thus also inheriting USE_SONAME=yes, it breaks sioyek that relies on having it disabled.

I’ve attached another patch that specifically disables SONAME for mupdf-1.24, allowing sioyek to build fine as usual.
  

Patch

From 9e57a2805db3f870e5c0edc0d13eba308b0827a3 Mon Sep 17 00:00:00 2001
Message-ID: <9e57a2805db3f870e5c0edc0d13eba308b0827a3.1747375463.git.divya@subvertising.org>
From: Divya Ranjan <divya@subvertising.org>
Date: Fri, 16 May 2025 06:01:18 +0000
Subject: [PATCH] gnu: mupdf: Modify #:make-flags

[arguments]: Disable SONAME

Change-Id: I070c59100ffedf9c451a7ce344ae6e210f1190f6
---
 gnu/packages/pdf.scm | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/gnu/packages/pdf.scm b/gnu/packages/pdf.scm
index c8c636976a..25a3f84533 100644
--- a/gnu/packages/pdf.scm
+++ b/gnu/packages/pdf.scm
@@ -948,7 +948,8 @@  (define-public mupdf
                    license:silofl1.1 ;resources/fonts/{han,noto,sil,urw}
                    license:asl2.0)))) ; resources/fonts/droid
 
-(define-public mupdf-1.24 ; Needed for sioyek
+(define-public mupdf-1.24
+   ;Needed for sioyek
   (package
     (inherit mupdf)
     (name "mupdf")
@@ -956,8 +957,8 @@  (define-public mupdf-1.24 ; Needed for sioyek
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "https://mupdf.com/downloads/archive/"
-                           "mupdf-" version "-source.tar.lz"))
+       (uri (string-append "https://mupdf.com/downloads/archive/" "mupdf-"
+                           version "-source.tar.lz"))
        (sha256
         (base32 "0hydmp8sdnkrkpqyysa6klkxbwv9awf1xc753r27gcj7ds7375fj"))
        (modules '((guix build utils)
@@ -970,7 +971,14 @@  (define-public mupdf-1.24 ; Needed for sioyek
               (for-each delete-file-recursively
                         (lset-difference string=?
                                          (scandir ".")
-                                         (cons* "." ".." keep))))))))))
+                                         (cons* "." ".." keep))))))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments mupdf)
+       ((#:make-flags flags)
+        #~(append (filter (lambda (flag)
+                            (not (string-prefix? "USE_SONAME=" flag)))
+                          #$flags)
+                  (list "USE_SONAME=no")))))))
 
 
 (define-public qpdf

base-commit: efac01f19b65d7d77a98bbfd57fe2073fb13064a
prerequisite-patch-id: e0b65c11f00f64b0496909046ee872884b87653c
-- 
2.49.0