From 38b96afce82d993f6612ce026d8bac9e51f60fee Mon Sep 17 00:00:00 2001 From: worldofpeace Date: Sun, 11 Aug 2019 10:42:47 -0400 Subject: [PATCH] calibre: wrap manually Also move wrapGAppsHook to nativeBuildInputs --- pkgs/applications/misc/calibre/default.nix | 34 +++++++++++----------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/pkgs/applications/misc/calibre/default.nix b/pkgs/applications/misc/calibre/default.nix index abcbe4434506..0b66be1f84c1 100644 --- a/pkgs/applications/misc/calibre/default.nix +++ b/pkgs/applications/misc/calibre/default.nix @@ -1,12 +1,12 @@ -{ stdenv, fetchurl, poppler_utils, pkgconfig, libpng +{ stdenv, mkDerivation, fetchurl, poppler_utils, pkgconfig, libpng , imagemagick, libjpeg, fontconfig, podofo, qtbase, qmake, icu, sqlite -, makeWrapper, unrarSupport ? false, chmlib, python2Packages, libusb1, libmtp +, unrarSupport ? false, chmlib, python2Packages, libusb1, libmtp , xdg_utils, makeDesktopItem, wrapGAppsHook, removeReferencesTo, qt5 }: -stdenv.mkDerivation rec { - version = "3.45.2"; +mkDerivation rec { name = "calibre-${version}"; + version = "3.45.2"; src = fetchurl { url = "https://download.calibre-ebook.com/${version}/${name}.tar.xz"; @@ -35,11 +35,11 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; - nativeBuildInputs = [ makeWrapper pkgconfig qmake removeReferencesTo qt5.wrapQtAppsHook ]; + nativeBuildInputs = [ pkgconfig qmake removeReferencesTo wrapGAppsHook ]; buildInputs = [ poppler_utils libpng imagemagick libjpeg - fontconfig podofo qtbase chmlib icu sqlite libusb1 libmtp xdg_utils wrapGAppsHook + fontconfig podofo qtbase chmlib icu sqlite libusb1 libmtp xdg_utils ] ++ (with python2Packages; [ apsw cssselect css-parser dateutil dnspython html5-parser lxml mechanize netifaces pillow python pyqt5_with_qtwebkit sip @@ -48,10 +48,6 @@ stdenv.mkDerivation rec { odfpy ]); - qtWrapperArgs = [ - "--prefix PATH : ${poppler_utils.out}/bin" - ]; - installPhase = '' runHook preInstall @@ -74,10 +70,6 @@ stdenv.mkDerivation rec { sed -i "s/env python[0-9.]*/python/" $PYFILES sed -i "2i import sys; sys.argv[0] = 'calibre'" $out/bin/calibre - for program in $out/bin/*; do - wrapQtApp $program --prefix PYTHONPATH : $PYTHONPATH - done - # Replace @out@ by the output path. mkdir -p $out/share/applications/ cp {$calibreDesktopItem,$ebookEditDesktopItem,$ebookViewerDesktopItem}/share/applications/* $out/share/applications/ @@ -91,15 +83,23 @@ stdenv.mkDerivation rec { runHook postInstall ''; + # Wrap manually + 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 - ''; - - postFixup = '' + for program in $out/bin/*; do + wrapProgram $program \ + ''${qtWrapperArgs[@]} \ + ''${gappsWrapperArgs[@]} \ + --prefix PYTHONPATH : $PYTHONPATH \ + --prefix PATH : ${poppler_utils.out}/bin + done ''; disallowedReferences = [ podofo.dev ];