mupdf: 1.24.8 -> 1.24.9, fixes (#342894)

This commit is contained in:
Emily
2024-09-20 16:26:59 +01:00
committed by GitHub
7 changed files with 135 additions and 157 deletions
@@ -1,57 +0,0 @@
From 0f0ccfc01cfe72d96eafee57ec6c5107f09c7238 Mon Sep 17 00:00:00 2001
From: toonn <toonn@toonn.io>
Date: Wed, 9 Mar 2022 00:08:28 +0100
Subject: [PATCH 2/2] Add Darwin deps
---
Makerules | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/Makerules b/Makerules
index 6d52cca..a6bd0ed 100644
--- a/Makerules
+++ b/Makerules
@@ -153,6 +153,40 @@ else ifeq ($(OS),MACOS)
LIBCRYPTO_CFLAGS := $(shell pkg-config --cflags libcrypto) -DHAVE_LIBCRYPTO
LIBCRYPTO_LIBS := $(shell pkg-config --libs libcrypto)
endif
+ # Required for mupdf-gl
+ ifeq ($(shell pkg-config --exists harfbuzz && echo yes),yes)
+ SYS_HARFBUZZ_CFLAGS := $(shell pkg-config --cflags harfbuzz)
+ SYS_HARFBUZZ_LIBS := $(shell pkg-config --libs harfbuzz)
+ endif
+ ifeq ($(shell pkg-config --exists libopenjp2 && echo yes),yes)
+ SYS_OPENJPEG_CFLAGS := $(shell pkg-config --cflags libopenjp2)
+ SYS_OPENJPEG_LIBS := $(shell pkg-config --libs libopenjp2)
+ endif
+ ifeq ($(shell pkg-config --exists freetype2 && echo yes),yes)
+ SYS_FREETYPE_CFLAGS := $(shell pkg-config --cflags freetype2)
+ SYS_FREETYPE_LIBS := $(shell pkg-config --libs freetype2)
+ endif
+ ifeq ($(shell pkg-config --exists gumbo && echo yes),yes)
+ SYS_GUMBO_CFLAGS := $(shell pkg-config --cflags gumbo)
+ SYS_GUMBO_LIBS := $(shell pkg-config --libs gumbo)
+ endif
+ # Required for mupdf-x11
+ HAVE_X11 := $(shell pkg-config --exists x11 xext && echo yes)
+ ifeq ($(HAVE_X11),yes)
+ X11_CFLAGS := $(shell pkg-config --cflags x11 xext)
+ X11_LIBS := $(shell pkg-config --libs x11 xext)
+ endif
+ # Required for mupdf-x11-curl
+ HAVE_SYS_CURL := $(shell pkg-config --exists libcurl && echo yes)
+ ifeq ($(HAVE_SYS_CURL),yes)
+ SYS_CURL_CFLAGS := $(shell pkg-config --cflags libcurl)
+ SYS_CURL_LIBS := $(shell pkg-config --libs libcurl)
+ endif
+ HAVE_PTHREAD := yes
+ ifeq ($(HAVE_PTHREAD),yes)
+ PTHREAD_CFLAGS :=
+ PTHREAD_LIBS := -lpthread
+ endif
endif
else ifeq ($(OS),Linux)
--
2.17.2 (Apple Git-113)
+16 -12
View File
@@ -59,18 +59,23 @@ let
});
in
stdenv.mkDerivation rec {
version = "1.24.8";
version = "1.24.9";
pname = "mupdf";
src = fetchurl {
url = "https://mupdf.com/downloads/archive/${pname}-${version}-source.tar.gz";
hash = "sha256-pRjZvpds2yAG1FOC1/+xubjWS8P9PLc8picNdS+n9Eg=";
hash = "sha256-C0RqoO7MEU6ZadzNcMl4k1j8y2WJqB1HDclBoIdNqYo=";
};
patches = [
./0002-Add-Darwin-deps.patch
./0003-Fix-cpp-build.patch
# Upstream makefile does not work with system deps on macOS by default, so
# we reuse the Linux section instead.
./fix-darwin-system-deps.patch
# Upstream C++ wrap script only defines fixed-sized integers on macOS but
# this is required on aarch64-linux too.
./fix-cpp-build.patch
];
postPatch = ''
@@ -99,7 +104,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ pkg-config ]
++ lib.optional (enableGL || enableX11) copyDesktopItems
++ lib.optional (stdenv.isDarwin && (enableGL || enableX11)) desktopToDarwinBundle
++ lib.optionals (enableCxx || enablePython) [ python3 python3.pkgs.setuptools python3.pkgs.libclang ]
++ lib.optionals (enableCxx || enablePython) [ (python3.pythonOnBuildForHost.withPackages (ps: [ ps.setuptools ps.libclang ])) ]
++ lib.optionals (enablePython) [ which swig ]
++ lib.optionals stdenv.isDarwin [ fixDarwinDylibNames xcbuild ];
@@ -114,6 +119,7 @@ stdenv.mkDerivation rec {
)
++ lib.optionals enableOcr [ leptonica tesseract ]
;
outputs = [ "bin" "dev" "out" "man" "doc" ];
preConfigure = ''
@@ -166,7 +172,6 @@ stdenv.mkDerivation rec {
EOF
moveToOutput "bin" "$bin"
cp ./build/shared-release/libmupdf${stdenv.hostPlatform.extensions.sharedLibrary}* $out/lib
'' + (lib.optionalString (stdenv.isDarwin) ''
for exe in $bin/bin/*; do
install_name_tool -change build/shared-release/libmupdf.dylib $out/lib/libmupdf.dylib "$exe"
@@ -180,17 +185,19 @@ stdenv.mkDerivation rec {
ln -s "$bin/bin/mupdf-x11" "$bin/bin/mupdf"
'') + (lib.optionalString (enableCxx) ''
cp platform/c++/include/mupdf/*.h $out/include/mupdf
cp build/*/libmupdfcpp.so* $out/lib
cp build/*/libmupdfcpp.so $out/lib
'') + (lib.optionalString (enablePython) (''
mkdir -p $out/${python3.sitePackages}/mupdf
cp build/*/_mupdf.so $out/${python3.sitePackages}
cp build/*/_mupdf.so $out/${python3.sitePackages}/mupdf
cp build/*/mupdf.py $out/${python3.sitePackages}/mupdf/__init__.py
'' + lib.optionalString (stdenv.isDarwin) ''
install_name_tool -add_rpath $out/lib $out/${python3.sitePackages}/_mupdf.so
install_name_tool -add_rpath $out/lib $out/${python3.sitePackages}/mupdf/_mupdf.so
''));
enableParallelBuilding = true;
env.USE_SONAME = "no";
passthru = {
tests = {
inherit cups-filters zathura;
@@ -212,8 +219,5 @@ stdenv.mkDerivation rec {
maintainers = with maintainers; [ fpletz ];
platforms = platforms.unix;
mainProgram = "mupdf";
# ImportError: cannot import name '_mupdf' from partially initialized module 'mupdf'
# (most likely due to a circular import)
broken = enablePython;
};
}
@@ -0,0 +1,60 @@
diff --git a/Makerules b/Makerules
index f582dc061..2da5680b6 100644
--- a/Makerules
+++ b/Makerules
@@ -178,39 +178,20 @@ ifneq "$(CLUSTER)" ""
endif
ifeq ($(OS),Linux)
- LINUX_OR_OPENBSD := yes
+ LINUX_OR_OPENBSD_OR_MACOS := yes
endif
ifeq ($(OS),OpenBSD)
- LINUX_OR_OPENBSD := yes
+ LINUX_OR_OPENBSD_OR_MACOS := yes
+endif
+ifeq ($(OS),MACOS)
+ LINUX_OR_OPENBSD_OR_MACOS := yes
endif
ifeq ($(OS),MINGW)
WINDRES := windres
HAVE_WIN32 := yes
-else ifeq ($(OS),MACOS)
- HAVE_GLUT := yes
- SYS_GLUT_CFLAGS := -Wno-deprecated-declarations
- SYS_GLUT_LIBS := -framework GLUT -framework OpenGL
- CC = xcrun cc
- AR = xcrun ar
- LD = xcrun ld
- RANLIB = xcrun ranlib
-
- ifneq ($(ARCHFLAGS),)
- $(warning "MacOS with ARCHFLAGS set. Assuming we are building for arm64, and setting HAVE_LIBCRYPTO to no.")
- HAVE_LIBCRYPTO := no
- else ifeq (, $(shell command -v pkg-config))
- $(warning "No pkg-config found, install it for proper integration of libcrypto")
- else
- HAVE_LIBCRYPTO := $(shell pkg-config --exists 'libcrypto >= 1.1.0' && echo yes)
- ifeq ($(HAVE_LIBCRYPTO),yes)
- LIBCRYPTO_CFLAGS := $(shell pkg-config --cflags libcrypto) -DHAVE_LIBCRYPTO
- LIBCRYPTO_LIBS := $(shell pkg-config --libs libcrypto)
- endif
- endif
-
-else ifeq ($(LINUX_OR_OPENBSD),yes)
+else ifeq ($(LINUX_OR_OPENBSD_OR_MACOS),yes)
ifeq ($(OS),Linux)
HAVE_OBJCOPY := yes
@@ -274,6 +255,9 @@ else ifeq ($(LINUX_OR_OPENBSD),yes)
ifeq ($(OS),OpenBSD)
SYS_GLUT_CFLAGS := $(shell pkg-config --cflags glut gl)
SYS_GLUT_LIBS := $(shell pkg-config --libs glut gl)
+ else ifeq ($(OS),MACOS)
+ SYS_GLUT_CFLAGS := -Wno-deprecated-declarations
+ SYS_GLUT_LIBS := -framework GLUT -framework OpenGL
else
SYS_GLUT_CFLAGS :=
SYS_GLUT_LIBS := -lglut -lGL
@@ -0,0 +1,31 @@
{
lib,
buildPythonPackage,
fetchPypi,
setuptools,
}:
buildPythonPackage rec {
pname = "pymupdf-fonts";
version = "1.0.5";
pyproject = true;
src = fetchPypi {
pname = "pymupdf_fonts";
inherit version;
hash = "sha256-rBLj7Er/o16aCsopE170HCO9vldYwzVdrCNphjCea8Y=";
};
build-system = [
setuptools
];
pythonImportsCheck = [ "pymupdf_fonts" ];
meta = {
description = "Collection of optional fonts for PyMuPDF";
homepage = "https://github.com/pymupdf/pymupdf-fonts";
license = lib.licenses.ofl;
maintainers = [ ];
};
}
@@ -25,8 +25,10 @@
mupdf,
# tests
fonttools,
pytestCheckHook,
fonttools,
pillow,
pymupdf-fonts,
}:
let
@@ -40,7 +42,7 @@ let
in
buildPythonPackage rec {
pname = "pymupdf";
version = "1.24.8";
version = "1.24.10";
pyproject = true;
disabled = pythonOlder "3.7";
@@ -49,7 +51,7 @@ buildPythonPackage rec {
owner = "pymupdf";
repo = "PyMuPDF";
rev = "refs/tags/${version}";
hash = "sha256-NG4ZJYMYTQHiqpnaOz7hxf5UW417UKawe5EqXaBnKJ8=";
hash = "sha256-QAcQPWzPTnTg3l5lGJ8me4FUbK7xgXgyYHep+rF3wf4=";
};
# swig is not wrapped as Python package
@@ -96,97 +98,34 @@ buildPythonPackage rec {
nativeCheckInputs = [
pytestCheckHook
];
checkInputs = [
fonttools
pillow
pymupdf-fonts
];
disabledTests = [
# Do not lint code
"test_codespell"
"test_pylint"
"test_flake8"
# Upstream recommends disabling these when not using bundled MuPDF build
"test_color_count"
"test_3050"
"test_textbox3"
];
pythonImportsCheck = [
"pymupdf"
"fitz"
];
preCheck = ''
export PATH="$PATH:$out/bin";
export PATH="$out/bin:$PATH";
'';
disabledTests =
[
# Fails in release tarballs without .git
"test_codespell"
"test_pylint"
# fails for indeterminate reasons
"test_2548"
"test_2753"
"test_3020"
"test_3050"
"test_3058"
"test_3177"
"test_3186"
"test_color_count"
"test_pilsave"
"test_fz_write_pixmap_as_jpeg"
# NotImplementedError
"test_1824"
"test_2093"
"test_2093"
"test_2108"
"test_2182"
"test_2182"
"test_2246"
"test_2270"
"test_2270"
"test_2391"
"test_2788"
"test_2861"
"test_2871"
"test_2886"
"test_2904"
"test_2922"
"test_2934"
"test_2957"
"test_2969"
"test_3070"
"test_3131"
"test_3140"
"test_3209"
"test_3209"
"test_3301"
"test_3347"
"test_caret"
"test_deletion"
"test_file_info"
"test_line"
"test_page_links_generator"
"test_polyline"
"test_redact"
"test_techwriter_append"
"test_text2"
# Issue with FzArchive
"test_htmlbox"
"test_2246"
"test_3140"
"test_3400"
"test_707560"
"test_open"
"test_objectstream1"
"test_objectstream2"
"test_objectstream3"
"test_fit_springer"
"test_write_stabilized_with_links"
"test_textbox"
"test_delete_image"
# Fonts not available
"test_fontarchive"
"test_subset_fonts"
# Exclude lint tests
"test_flake8"
]
++ lib.optionals stdenv.isDarwin [
# darwin does not support OCR right now
"test_tesseract"
];
disabledTestPaths = [
# Issue with FzArchive
"tests/test_docs_samples.py"
];
pythonImportsCheck = [ "fitz" ];
meta = {
description = "Python bindings for MuPDF's rendering library";
homepage = "https://github.com/pymupdf/PyMuPDF";
+1
View File
@@ -11660,6 +11660,7 @@ self: super: with self; {
};
pymupdf = callPackage ../development/python-modules/pymupdf { };
pymupdf-fonts = callPackage ../development/python-modules/pymupdf-fonts { };
pymvglive = callPackage ../development/python-modules/pymvglive { };