Unverified Commit daef0a6a authored by Philip Taron's avatar Philip Taron Committed by GitHub
Browse files

mupdf: 1.25.3 -> 1.26.1; python3Packages.pymupdf: 1.25.2 -> 1.26.0 (#410552)

parents 4435c367 8e103365
Loading
Loading
Loading
Loading
+0 −60
Original line number Diff line number Diff line
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
+11 −9
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@
  swig,
  xcbuild,
  gitUpdater,
  enableBarcode ? false,

  # for passthru.tests
  cups-filters,
@@ -61,18 +62,15 @@ let
in

stdenv.mkDerivation rec {
  version = "1.25.3";
  version = "1.26.1";
  pname = "mupdf";

  src = fetchurl {
    url = "https://mupdf.com/downloads/archive/${pname}-${version}-source.tar.gz";
    hash = "sha256-uXTXBqloBTPRBLQRIiTHvz3pPye+fKQbS/tRVSYk8Kk=";
    hash = "sha256-vc4BfHdnRMKIsCECl37gN4y0NseN+BJ6I/KB8TYEBv0=";
  };

  patches = [
    # 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
@@ -101,7 +99,11 @@ stdenv.mkDerivation rec {
    ]
    ++ lib.optionals (!enableX11) [ "HAVE_X11=no" ]
    ++ lib.optionals (!enableGL) [ "HAVE_GLUT=no" ]
    ++ lib.optionals (enableOcr) [ "USE_TESSERACT=yes" ];
    ++ lib.optionals (enableOcr) [ "USE_TESSERACT=yes" ]
    ++ lib.optionals (enableBarcode) [
      "barcode=yes"
      "USE_SYSTEM_ZXINGCPP=no"
    ];

  nativeBuildInputs =
    [ pkg-config ]
@@ -159,7 +161,7 @@ stdenv.mkDerivation rec {
  ];

  preConfigure = ''
    # Don't remove mujs because upstream version is incompatible
    # Don't remove mujs or zxing-cpp because upstream version is incompatible
    rm -rf thirdparty/{curl,freetype,glfw,harfbuzz,jbig2dec,libjpeg,openjpeg,zlib}
  '';

@@ -242,7 +244,7 @@ stdenv.mkDerivation rec {
    )
    + (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) (
      ''
@@ -257,7 +259,7 @@ stdenv.mkDerivation rec {

  enableParallelBuilding = true;

  env.USE_SONAME = "no";
  env.USE_SONAME = "yes";

  passthru = {
    tests = {
+11 −14
Original line number Diff line number Diff line
@@ -37,35 +37,25 @@ let
    enableOcr = true;
    enableCxx = true;
    enablePython = true;
    enableBarcode = true;
    python3 = python;
  };
in
buildPythonPackage rec {
  pname = "pymupdf";
  version = "1.25.2";
  version = "1.26.0";
  pyproject = true;

  disabled = pythonOlder "3.7";
  disabled = pythonOlder "3.9";

  src = fetchFromGitHub {
    owner = "pymupdf";
    repo = "PyMuPDF";
    tag = version;
    hash = "sha256-6XbHQ8PE9IF0kngUhYkFSGjwgt+r+19v+PeDAQin2Ko=";
    hash = "sha256-juBjlS9/ykpji9RbDcyOjAu+cVSDaFc3HAmxYHTylt8=";
  };

  patches = [
    # Fix build against mupdf-1.25.3:
    #   https://github.com/pymupdf/PyMuPDF/pull/4248
    (fetchpatch {
      name = "mupdf-1.25.3.patch";
      url = "https://github.com/pymupdf/PyMuPDF/commit/f42ef85058fee087d3f5e565f34a7657aad11240.patch";
      hash = "sha256-X5JF8nPLj4uubdEdvUJ5aEf0yZkW+ks99pzua0vCrZc=";
    })
  ];

  # swig is not wrapped as Python package
  # libclang calls itself just clang in wheel metadata
  postPatch = ''
    substituteInPlace setup.py \
      --replace-fail "ret.append( 'swig')" "pass" \
@@ -125,6 +115,13 @@ buildPythonPackage rec {
    "test_color_count"
    "test_3050"
    "test_textbox3"
    "test_3493"
    "test_4180"
    # Requires downloads
    "test_4457"
    "test_4445"
    # Not a git repository, so git ls-files fails
    "test_open2"
  ];

  pythonImportsCheck = [