From: David Elsing <david.elsing@posteo.net>
To: 71787@debbugs.gnu.org
Cc: David Elsing <david.elsing@posteo.net>
Subject: [bug#71787] [PATCH 07/12] gnu: mupdf: Update to 1.24.4 and unbundle remaining dependencies.
Date: Wed, 26 Jun 2024 19:27:00 +0000 [thread overview]
Message-ID: <20240626192717.12818-7-david.elsing@posteo.net> (raw)
In-Reply-To: <20240626192505.12401-1-david.elsing@posteo.net>
* 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@posteo.net>
;;; Copyright © 2024 dan <i@dan.games>
;;; Copyright © 2023 Benjamin Slade <slade@lambda-y.net>
+;;; Copyright © 2024 David Elsing <david.elsing@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
next prev parent reply other threads:[~2024-06-26 19:28 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-26 19:24 [bug#71787] [PATCH 00/12] Update and unbundle ghostscript and mupdf David Elsing
2024-06-26 19:26 ` [bug#71787] [PATCH 01/12] gnu: Add lcms2mt David Elsing
2024-06-26 19:26 ` [bug#71787] [PATCH 02/12] gnu: Add memento David Elsing
2024-06-26 19:26 ` [bug#71787] [PATCH 03/12] gnu: Add extract David Elsing
2024-06-26 19:26 ` [bug#71787] [PATCH 04/12] gnu: ijs: Remove unneeded files and build shared library David Elsing
2024-06-26 19:26 ` [bug#71787] [PATCH 05/12] gnu: ghostscript: Unbundle dependencies and remove non-free parts David Elsing
2024-06-26 19:26 ` [bug#71787] [PATCH 06/12] gnu: Add ghostscript/tesseract David Elsing
2024-06-26 19:27 ` David Elsing [this message]
2024-06-26 19:27 ` [bug#71787] [PATCH 08/12] gnu: Add mupdf/tesseract David Elsing
2024-06-26 19:27 ` [bug#71787] [PATCH 09/12] gnu: Add python-pymupdf David Elsing
2024-06-26 19:27 ` [bug#71787] [PATCH 10/12] gnu: Add python-svglib David Elsing
2024-06-26 19:27 ` [bug#71787] [PATCH 11/12] gnu: Add python-rst2pdf David Elsing
2024-06-26 19:27 ` [bug#71787] [PATCH 12/12] gnu: Add ghostscript-documentation David Elsing
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240626192717.12818-7-david.elsing@posteo.net \
--to=david.elsing@posteo.net \
--cc=71787@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).