Unverified Commit e3c9b363 authored by Aleksana's avatar Aleksana Committed by GitHub
Browse files

Merge pull request #321661 from wrvsrx/clean-calibre-packaging-nixos-unstable

Clean calibre packaging
parents a5f1a73d e5e058dc
Loading
Loading
Loading
Loading
+56 −61
Original line number Diff line number Diff line
@@ -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,9 +91,8 @@ stdenv.mkDerivation (finalAttrs: {
    qtbase
    qtwayland
    sqlite
    xdg-utils
  ] ++ (
    with python3Packages; [
    (python3Packages.python.withPackages
      (ps: with ps; [
        (apsw.overrideAttrs (oldAttrs: {
          setupPyBuildFlags = [ "--enable=load_extension" ];
        }))
@@ -119,7 +118,6 @@ stdenv.mkDerivation (finalAttrs: {
        regex
        sip
        setuptools
      speechd
        zeroconf
        jeepney
        pycryptodome
@@ -131,8 +129,10 @@ stdenv.mkDerivation (finalAttrs: {
        # browser, so we enable building on platforms which qtwebengine
        # does not support by simply omitting qtwebengine.
        pyqt6-webengine
    ] ++ lib.optional (unrarSupport) unrardll
  );
      ] ++ lib.optional (unrarSupport) unrardll)
    )
    xdg-utils
  ] ++ 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,24 +173,19 @@ 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

  preFixup =
    let
      popplerArgs = "--prefix PATH : ${poppler_utils.out}/bin";
    in
    ''
      for program in $out/bin/*; do
        wrapProgram $program \
          ''${qtWrapperArgs[@]} \
          ''${gappsWrapperArgs[@]} \
        --prefix PYTHONPATH : $PYTHONPATH \
        --prefix PATH : ${poppler_utils.out}/bin
          ${if popplerSupport then popplerArgs else ""}
      done
    '';

  disallowedReferences = [ podofo.dev ];

  meta = {
    homepage = "https://calibre-ebook.com";
    description = "Comprehensive e-book software";