diff options
author | Aleksana <me@aleksana.moe> | 2024-07-03 00:29:26 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-03 00:29:26 +0800 |
commit | e3c9b36367fc2df34123fdb8802495f34f9edc72 (patch) | |
tree | 8e3107d6d4d570754cc5a493bffbbd0ee429266d | |
parent | a5f1a73d7e1c8b8312391e72f771df8be183d75c (diff) | |
parent | e5e058dce36f37139983e78b58e827d1550d5934 (diff) |
Merge pull request #321661 from wrvsrx/clean-calibre-packaging-nixos-unstable
Clean calibre packaging
-rw-r--r-- | pkgs/applications/misc/calibre/default.nix | 117 |
1 files changed, 56 insertions, 61 deletions
diff --git a/pkgs/applications/misc/calibre/default.nix b/pkgs/applications/misc/calibre/default.nix index 0e19d15973651..e1bf6cffb008d 100644 --- a/pkgs/applications/misc/calibre/default.nix +++ b/pkgs/applications/misc/calibre/default.nix @@ -21,12 +21,13 @@ , qmake , qtbase , qtwayland -, removeReferencesTo , speechd , sqlite , wrapQtAppsHook , xdg-utils , wrapGAppsHook3 +, popplerSupport ? true +, speechSupport ? true , unrarSupport ? false }: @@ -69,7 +70,6 @@ stdenv.mkDerivation (finalAttrs: { cmake pkg-config qmake - removeReferencesTo wrapGAppsHook3 wrapQtAppsHook ]; @@ -91,48 +91,48 @@ stdenv.mkDerivation (finalAttrs: { qtbase qtwayland sqlite + (python3Packages.python.withPackages + (ps: with ps; [ + (apsw.overrideAttrs (oldAttrs: { + setupPyBuildFlags = [ "--enable=load_extension" ]; + })) + beautifulsoup4 + css-parser + cssselect + python-dateutil + dnspython + faust-cchardet + feedparser + html2text + html5-parser + lxml + markdown + mechanize + msgpack + netifaces + pillow + pychm + pyqt-builder + pyqt6 + python + regex + sip + setuptools + zeroconf + jeepney + pycryptodome + xxhash + # the following are distributed with calibre, but we use upstream instead + odfpy + ] ++ lib.optionals (lib.lists.any (p: p == stdenv.hostPlatform.system) pyqt6-webengine.meta.platforms) [ + # much of calibre's functionality is usable without a web + # browser, so we enable building on platforms which qtwebengine + # does not support by simply omitting qtwebengine. + pyqt6-webengine + ] ++ lib.optional (unrarSupport) unrardll) + ) xdg-utils - ] ++ ( - with python3Packages; [ - (apsw.overrideAttrs (oldAttrs: { - setupPyBuildFlags = [ "--enable=load_extension" ]; - })) - beautifulsoup4 - css-parser - cssselect - python-dateutil - dnspython - faust-cchardet - feedparser - html2text - html5-parser - lxml - markdown - mechanize - msgpack - netifaces - pillow - pychm - pyqt-builder - pyqt6 - python - regex - sip - setuptools - speechd - zeroconf - jeepney - pycryptodome - xxhash - # the following are distributed with calibre, but we use upstream instead - odfpy - ] ++ lib.optionals (lib.lists.any (p: p == stdenv.hostPlatform.system) pyqt6-webengine.meta.platforms) [ - # much of calibre's functionality is usable without a web - # browser, so we enable building on platforms which qtwebengine - # does not support by simply omitting qtwebengine. - pyqt6-webengine - ] ++ lib.optional (unrarSupport) unrardll - ); + ] ++ lib.optional (speechSupport) speechd; installPhase = '' runHook preInstall @@ -149,7 +149,7 @@ stdenv.mkDerivation (finalAttrs: { export XDG_DATA_HOME=$out/share export XDG_UTILS_INSTALL_MODE="user" - ${python3Packages.python.pythonOnBuildForHost.interpreter} setup.py install --root=$out \ + python setup.py install --root=$out \ --prefix=$out \ --libdir=$out/lib \ --staging-root=$out \ @@ -173,23 +173,18 @@ stdenv.mkDerivation (finalAttrs: { dontWrapQtApps = true; dontWrapGApps = true; - # Remove some references to shrink the closure size. This reference (as of - # 2018-11-06) was a single string like the following: - # /nix/store/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-podofo-0.9.6-dev/include/podofo/base/PdfVariant.h - preFixup = '' - remove-references-to -t ${podofo.dev} \ - $out/lib/calibre/calibre/plugins/podofo.so - - for program in $out/bin/*; do - wrapProgram $program \ - ''${qtWrapperArgs[@]} \ - ''${gappsWrapperArgs[@]} \ - --prefix PYTHONPATH : $PYTHONPATH \ - --prefix PATH : ${poppler_utils.out}/bin - done - ''; - - disallowedReferences = [ podofo.dev ]; + preFixup = + let + popplerArgs = "--prefix PATH : ${poppler_utils.out}/bin"; + in + '' + for program in $out/bin/*; do + wrapProgram $program \ + ''${qtWrapperArgs[@]} \ + ''${gappsWrapperArgs[@]} \ + ${if popplerSupport then popplerArgs else ""} + done + ''; meta = { homepage = "https://calibre-ebook.com"; |