Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pymupdf: bundle mupdf package #352845

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
19 changes: 11 additions & 8 deletions pkgs/development/python-modules/pymupdf/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ buildPythonPackage rec {
gumbo
] ++ 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 All @@ -89,12 +87,17 @@ buildPythonPackage rec {
PYMUPDF_MUPDF_INCLUDE = "${lib.getDev mupdf-cxx}/include";
};

# TODO: manually add mupdf rpath until upstream fixes it
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
for lib in */*.so $out/${python.sitePackages}/*/*.so; do
install_name_tool -add_rpath ${lib.getLib mupdf-cxx}/lib "$lib"
done
'';
postInstall =
(lib.optionalString stdenv.hostPlatform.isDarwin ''
# manually add mupdf rpath until upstream fixes it
for lib in */*.so $out/${python.sitePackages}/*/*.so; do
install_name_tool -add_rpath ${lib.getLib mupdf-cxx}/lib "$lib"
done
'')
+ ''
# bundle the `mupdf` module provided by mupdf-cxx
cp -r ${lib.getLib mupdf-cxx}/${python.sitePackages}/mupdf $out/${python.sitePackages}/mupdf
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could also use ln -s to save space.

'';

nativeCheckInputs = [
pytestCheckHook
Expand Down