Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

42 changes: 15 additions & 27 deletions pkgs/applications/misc/mupdf/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{ stdenv
, lib
, fetchurl
, fetchFromGitHub
, copyDesktopItems
, makeDesktopItem
, desktopToDarwinBundle
Expand Down Expand Up @@ -45,36 +44,23 @@

assert enablePython -> enableCxx;

let

freeglut-mupdf = freeglut.overrideAttrs (old: rec {
pname = "freeglut-mupdf";
version = "3.0.0-r${src.rev}";
src = fetchFromGitHub {
owner = "ArtifexSoftware";
repo = "thirdparty-freeglut";
rev = "13ae6aa2c2f9a7b4266fc2e6116c876237f40477";
hash = "sha256-0fuE0lm9rlAaok2Qe0V1uUrgP4AjMWgp3eTbw8G6PMM=";
};
});

in
stdenv.mkDerivation rec {
version = "1.23.6";
version = "1.24.0";
pname = "mupdf";

src = fetchurl {
url = "https://mupdf.com/downloads/archive/${pname}-${version}-source.tar.gz";
sha256 = "sha256-rBHrhZ3UBEiOUVPNyWUbtDQeW6r007Pyfir8gvmq3Ck=";
url = "https://mupdf.com/downloads/archive/mupdf-${version}-source.tar.gz";
hash = "sha256-UvYwA6b02J8jTp7ftLTIPSFrg6rrMjz9pgR8t1RZmuA=";
};

patches = [ ./0001-Use-command-v-in-favor-of-which.patch
./0002-Add-Darwin-deps.patch
./0003-Fix-cpp-build.patch
];
patches = [
./0002-Add-Darwin-deps.patch
./0003-Fix-cpp-build.patch
];

postPatch = ''
substituteInPlace Makerules --replace "(shell pkg-config" "(shell $PKG_CONFIG"
substituteInPlace Makerules \
--replace-fail "(shell pkg-config" "(shell $PKG_CONFIG"
Comment thread
dotlambda marked this conversation as resolved.

patchShebangs scripts/mupdfwrap.py

Expand All @@ -83,19 +69,21 @@ stdenv.mkDerivation rec {

# fix libclang unnamed struct format
for wrapper in ./scripts/wrap/{cpp,state}.py; do
substituteInPlace "$wrapper" --replace 'struct (unnamed' '(unnamed struct'
substituteInPlace "$wrapper" \
--replace-fail 'struct (unnamed' '(unnamed struct'
done
'';

makeFlags = [
"prefix=$(out)"
"shared=yes"
"USE_SYSTEM_LIBS=yes"
"PKG_CONFIG=${buildPackages.pkg-config}/bin/${buildPackages.pkg-config.targetPrefix}pkg-config"
] ++ lib.optionals (!enableX11) [ "HAVE_X11=no" ]
++ lib.optionals (!enableGL) [ "HAVE_GLUT=no" ]
++ lib.optionals (enableOcr) [ "USE_TESSERACT=yes" ];

env.USE_SONAME = "no";

nativeBuildInputs = [ pkg-config ]
++ lib.optional (enableGL || enableX11) copyDesktopItems
++ lib.optional (stdenv.isDarwin && (enableGL || enableX11)) desktopToDarwinBundle
Expand All @@ -110,7 +98,7 @@ stdenv.mkDerivation rec {
if stdenv.isDarwin then
with darwin.apple_sdk.frameworks; [ GLUT OpenGL ]
else
[ freeglut-mupdf libGLU ]
[ freeglut libGLU ]
)
++ lib.optionals enableOcr [ leptonica tesseract ]
;
Expand Down Expand Up @@ -210,6 +198,6 @@ stdenv.mkDerivation rec {
license = licenses.agpl3Plus;
maintainers = with maintainers; [ vrthra fpletz lilyinstarlight ];
platforms = platforms.unix;
mainProgram = "mupdf";
mainProgram = if (enableGL || enableX11) then "mupdf" else "mutool";
};
}
25 changes: 10 additions & 15 deletions pkgs/development/python-modules/pymupdf/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,15 @@
, setuptools
, swig

# native dependencies
# dependencies
, freetype
, harfbuzz
, openjpeg
, jbig2dec
, libjpeg_turbo
, gumbo
, memstreamHook

# dependencies
, mupdf
, mupdf-headless

# tests
, fonttools
Expand All @@ -30,27 +28,27 @@

let
# PyMuPDF needs the C++ bindings generated
mupdf-cxx = mupdf.override { enableOcr = true; enableCxx = true; enablePython = true; python3 = python; };
mupdf-cxx = mupdf-headless.override { enableOcr = true; enableCxx = true; enablePython = true; python3 = python; };
in buildPythonPackage rec {
pname = "pymupdf";
version = "1.23.26";
version = "1.24.0";
pyproject = true;

disabled = pythonOlder "3.7";
disabled = pythonOlder "3.8";

src = fetchFromGitHub {
owner = "pymupdf";
repo = "PyMuPDF";
rev = "refs/tags/${version}";
hash = "sha256-m2zq04+PDnlzFuqeSt27UhdHXTHxpHdMPIg5RQl/5bQ=";
hash = "sha256-lTyYVKKbrIUNrU7N+JOjjMslsXARSTdjdPNsuHI0tiw=";
};

# swig is not wrapped as python package
# libclang calls itself just clang in wheel metadata
postPatch = ''
substituteInPlace pyproject.toml \
--replace '"swig",' "" \
--replace "libclang" "clang"
substituteInPlace setup.py \
--replace-fail "ret.append( 'swig')" "pass" \
--replace-fail "'libclang'" "'clang'"
'';

nativeBuildInputs = [
Expand All @@ -67,14 +65,11 @@ in buildPythonPackage rec {
jbig2dec
libjpeg_turbo
gumbo
mupdf-cxx
] ++ lib.optionals (stdenv.system == "x86_64-darwin") [
memstreamHook
];

propagatedBuildInputs = [
mupdf-cxx
];

env = {
# force using system MuPDF (must be defined in environment and empty)
PYMUPDF_SETUP_MUPDF_BUILD = "";
Expand Down