Package: guix-patches;
Reported by: David Elsing <david.elsing <at> posteo.net>
Date: Wed, 26 Jun 2024 19:26:02 UTC
Severity: normal
Tags: patch
Message #26 received at 71787 <at> debbugs.gnu.org (full text, mbox):
From: David Elsing <david.elsing <at> posteo.net> To: 71787 <at> debbugs.gnu.org Cc: David Elsing <david.elsing <at> posteo.net> Subject: [PATCH 07/12] gnu: mupdf: Update to 1.24.4 and unbundle remaining dependencies. Date: Wed, 26 Jun 2024 19:27:00 +0000
* gnu/packages/pdf.scm (mupdf): Update to 1.24.4. [source]: Use git-fetch. Adjust snippet. [inputs]: Add extract, lcms2mt and memento. [arguments]<make-flags>: Set USE_SYSTEM_LCMS2 and USE_SYTEM_GLUT to 'yes'. Remove USE_SYSTEM_LEPTONICA and USE_SYSTEM_TESSERACT. Add "LIBS=...". <phases>: Add 'unbundle' and 'symlink-memento-header' phases. --- gnu/packages/pdf.scm | 127 ++++++++++++++++++++++++++++++------------- 1 file changed, 89 insertions(+), 38 deletions(-) diff --git a/gnu/packages/pdf.scm b/gnu/packages/pdf.scm index 4e260d614d..232cafcbf1 100644 --- a/gnu/packages/pdf.scm +++ b/gnu/packages/pdf.scm @@ -27,6 +27,7 @@ ;;; Copyright © 2023 Felix Gruber <felgru <at> posteo.net> ;;; Copyright © 2024 dan <i <at> dan.games> ;;; Copyright © 2023 Benjamin Slade <slade <at> lambda-y.net> +;;; Copyright © 2024 David Elsing <david.elsing <at> posteo.net> ;;; ;;; This file is part of GNU Guix. ;;; @@ -64,6 +65,7 @@ (define-module (gnu packages pdf) #:use-module (gnu packages base) #:use-module (gnu packages bash) #:use-module (gnu packages build-tools) + #:use-module (gnu packages c) #:use-module (gnu packages check) #:use-module (gnu packages compression) #:use-module (gnu packages cups) @@ -87,6 +89,7 @@ (define-module (gnu packages pdf) #:use-module (gnu packages lesstif) #:use-module (gnu packages libffi) #:use-module (gnu packages linux) + #:use-module (gnu packages llvm) #:use-module (gnu packages lua) #:use-module (gnu packages man) #:use-module (gnu packages markup) @@ -107,6 +110,7 @@ (define-module (gnu packages pdf) #:use-module (gnu packages sdl) #:use-module (gnu packages sphinx) #:use-module (gnu packages sqlite) + #:use-module (gnu packages swig) #:use-module (gnu packages tex) #:use-module (gnu packages time) #:use-module (gnu packages tcl) @@ -833,28 +837,23 @@ (define-public python-pydyf (define-public mupdf (package (name "mupdf") - (version "1.23.11") + (version "1.24.4") (source (origin - (method url-fetch) - (uri (string-append "https://mupdf.com/downloads/archive/" - "mupdf-" version "-source.tar.lz")) + (method git-fetch) + (uri (git-reference + (url "git://git.ghostscript.com/mupdf") + (commit (string-append version)))) + (file-name (git-file-name name version)) (sha256 - (base32 "1kv44zqijkvljc9fcqmgb8zqkj7hmasga70fsz98aimmrfc2rmyv")) - (modules '((guix build utils) - (ice-9 ftw) - (srfi srfi-1))) + (base32 "1h97zkdnnr6wfi42d23x6lr037mkl4cab181f34d9cbri4y5sf39")) (snippet - ;; Remove bundled software. Keep patched variants. - #~(with-directory-excursion "thirdparty" - (let ((keep '("README" "extract" "freeglut" "lcms2"))) - (for-each delete-file-recursively - (lset-difference string=? - (scandir ".") - (cons* "." ".." keep)))))))) + '(begin (delete-file "include/mupdf/memento.h") + (delete-file "source/fitz/memento.c"))))) (build-system gnu-build-system) (inputs (list curl + extract libxrandr libxi freeglut ;for GL/gl.h @@ -865,39 +864,91 @@ (define-public mupdf libjpeg-turbo libx11 libxext + lcms2mt + memento mujs openjpeg openssl zlib)) (native-inputs - (list pkg-config)) + (list + pkg-config + python + python-clang-13 + python-setuptools + swig)) (arguments (list #:tests? #f ;no check target + #:imported-modules `((guix build python-build-system) + ,@%gnu-build-system-modules) + #:modules '(((guix build python-build-system) + #:select (python-version)) + (guix build gnu-build-system) + (guix build utils)) #:make-flags - #~(list "verbose=yes" - (string-append "CC=" #$(cc-for-target)) - "XCFLAGS=-fpic" - "USE_SYSTEM_FREETYPE=yes" - "USE_SYSTEM_GUMBO=yes" - "USE_SYSTEM_HARFBUZZ=yes" - "USE_SYSTEM_JBIG2DEC=yes" - "USE_SYSTEM_JPEGXR=no # not available" - "USE_SYSTEM_LCMS2=no # lcms2mt is strongly preferred" - "USE_SYSTEM_LIBJPEG=yes" - "USE_SYSTEM_MUJS=yes" - "USE_SYSTEM_OPENJPEG=yes" - "USE_SYSTEM_ZLIB=yes" - "USE_SYSTEM_GLUT=no" - "USE_SYSTEM_CURL=yes" - "USE_SYSTEM_LEPTONICA=yes" - "USE_SYSTEM_TESSERACT=yes" - "shared=yes" - (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib") - (string-append "prefix=" #$output)) + #~(list + "verbose=yes" + (string-append "CC=" #$(cc-for-target)) + "XCFLAGS=-fpic" + "USE_SYSTEM_LIBS=yes" + "USE_SYSTEM_FREETYPE=yes" + "USE_SYSTEM_GUMBO=yes" + "USE_SYSTEM_HARFBUZZ=yes" + "USE_SYSTEM_JBIG2DEC=yes" + "USE_SYSTEM_JPEGXR=no" ; non-free, also not bundled + "USE_SYSTEM_LCMS2=yes" + "USE_SYSTEM_LIBJPEG=yes" + "USE_SYSTEM_MUJS=yes" + "USE_SYSTEM_OPENJPEG=yes" + "USE_SYSTEM_ZLIB=yes" + "USE_SYSTEM_GLUT=yes" + "USE_SYSTEM_CURL=yes" + "VENV_FLAG=" + "shared=yes" + (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib") + (string-append "prefix=" #$output) + (string-append "pydir=" #$output "/lib/python" + (python-version #$(this-package-native-input "python")) + "/site-packages") + "XLIBS=-lextract -lmemento") #:phases - #~(modify-phases %standard-phases - (delete 'configure)))) ;no configure script + #~(let ((memento-header-orig + (string-append #$(this-package-input "memento") + "/include/memento.h")) + (memento-header-out + (string-append #$output "/include/mupdf/memento.h"))) + (modify-phases %standard-phases + (add-after 'unpack 'unbundle + (lambda _ + (substitute* "Makethird" + ((".*THIRD_SRC \\+=.*") "")) + ;; This bundled header is part of the mupdf API. + (symlink memento-header-orig "include/mupdf/memento.h"))) + (delete 'configure) ; no configure script + (replace 'build + (lambda* (#:key make-flags parallel-build? #:allow-other-keys) + ;; Run seperately to prevent concurrency problems + (for-each + (lambda (make-targets) + (display (string-append + "Building " (string-join make-targets " ") "\n")) + (apply invoke "make" + `(,@make-targets + ,@(if parallel-build? + `("-j" ,(number->string (parallel-job-count))) + '()) + ,@make-flags))) + '(("libs" "apps") ("c++") ("python"))))) + ;; Install Python binding + (add-after 'install 'install-python + (lambda* (#:key make-flags #:allow-other-keys) + (apply invoke "make" "install-shared-python" make-flags))) + ;; Change the copy back to a symlink. + (add-after 'install 'symlink-memento-header + (lambda _ + (delete-file memento-header-out) + (symlink memento-header-orig memento-header-out))))))) (home-page "https://mupdf.com") (synopsis "Lightweight PDF viewer and toolkit") (description -- 2.45.1
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.