diff --git a/pkgs/applications/misc/calibre/default.nix b/pkgs/applications/misc/calibre/default.nix index 327596006091..fe5227e395b4 100644 --- a/pkgs/applications/misc/calibre/default.nix +++ b/pkgs/applications/misc/calibre/default.nix @@ -1,29 +1,50 @@ -{ stdenv, fetchurl, python, pyqt5, sip, poppler_utils, pkgconfig, libpng +{ stdenv, fetchurl, fetchpatch, python, pyqt5, sip, poppler_utils, pkgconfig, libpng , imagemagick, libjpeg, fontconfig, podofo, qtbase, qmakeHook, icu, sqlite , makeWrapper, unrarSupport ? false, chmlib, pythonPackages, xz, libusb1, libmtp , xdg_utils, makeDesktopItem }: stdenv.mkDerivation rec { - version = "2.64.0"; + version = "2.66.0"; name = "calibre-${version}"; src = fetchurl { url = "https://download.calibre-ebook.com/${version}/${name}.tar.xz"; - sha256 = "0jjbkhd3n7rh5q6cl6yy51hyjbxmgm6xj7i2a1d3h2ggrip1zmr9"; + sha256 = "1dbv6p9cq9zj51zvhfy2b7aic2zqa44lmfmq7k7fkqcgb6wmanic"; }; inherit python; patches = [ - # Patch from Debian that switches the version update change from - # enabled by default to disabled by default. - ./no_updates_dialog.patch + # Patches from Debian that: + # - disable plugin installation (very insecure) + # - disables loading of web bug for privacy + # - switches the version update from enabled to disabled by default + (fetchpatch { + name = "disable_plugins.patch"; + url = "http://bazaar.launchpad.net/~calibre-packagers/calibre/debian/download/head:/disable_plugins.py-20111220183043-dcl08ccfagjxt1dv-1/disable_plugins.py"; + sha256 = "19spdx52dhbrfn9lm084yl3cfwm6f90imd51k97sf7flmpl569pk"; + }) + (fetchpatch { + name = "links_privacy.patch"; + url = "http://bazaar.launchpad.net/~calibre-packagers/calibre/debian/download/head:/linksprivacy.patch-20160417214308-6hvive72pc0r4awc-1/links-privacy.patch"; + sha256 = "0f6pq2b7q56pxrq2j8yqd7bksc623q2zgq29qcli30f13vga1w60"; + }) + (fetchpatch { + name = "no_updates_dialog.patch"; + url = "http://bazaar.launchpad.net/~calibre-packagers/calibre/debian/download/head:/no_updates_dialog.pa-20081231120426-rzzufl0zo66t3mtc-16/no_updates_dialog.patch"; + sha256 = "16xwa2fa47jvs954fjrwr8rhh89aljgi1d1wrfxa40sknlmfwxif"; + }) + # the unrar patch is not from debian ] ++ stdenv.lib.optional (!unrarSupport) ./dont_build_unrar_plugin.patch; prePatch = '' sed -i "/pyqt_sip_dir/ s:=.*:= '${pyqt5}/share/sip/PyQt5':" \ setup/build_environment.py + + # Remove unneeded files and libs + rm -rf resources/calibre-portable.* \ + src/{chardet,cherrypy,html5lib,odf,routes} ''; dontUseQmakeConfigure = true; @@ -34,14 +55,14 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ makeWrapper pkgconfig qmakeHook ]; - buildInputs = - [ python pyqt5 sip poppler_utils libpng imagemagick libjpeg - fontconfig podofo qtbase chmlib icu sqlite libusb1 libmtp xdg_utils - pythonPackages.mechanize pythonPackages.lxml pythonPackages.dateutil - pythonPackages.cssutils pythonPackages.beautifulsoup pythonPackages.pillow - pythonPackages.sqlite3 pythonPackages.netifaces pythonPackages.apsw - pythonPackages.cssselect - ]; + buildInputs = [ + python pyqt5 sip poppler_utils libpng imagemagick libjpeg + fontconfig podofo qtbase chmlib icu sqlite libusb1 libmtp xdg_utils + ] ++ (with pythonPackages; [ + apsw beautifulsoup cssselect cssutils dateutil lxml mechanize netifaces pillow sqlite3 + # the following are distributed with calibre, but we use upstream instead + chardet cherrypy html5lib odfpy routes + ]); installPhase = '' export HOME=$TMPDIR/fakehome diff --git a/pkgs/applications/misc/calibre/no_updates_dialog.patch b/pkgs/applications/misc/calibre/no_updates_dialog.patch deleted file mode 100644 index 52364f64dac7..000000000000 --- a/pkgs/applications/misc/calibre/no_updates_dialog.patch +++ /dev/null @@ -1,16 +0,0 @@ -# Description: Disable update check by default. -Index: calibre/src/calibre/gui2/main.py -=================================================================== ---- calibre.orig/src/calibre/gui2/main.py 2014-02-02 10:41:28.470954623 +0100 -+++ calibre/src/calibre/gui2/main.py 2014-02-02 10:41:56.546954247 +0100 -@@ -37,8 +37,8 @@ - help=_('Start minimized to system tray.')) - parser.add_option('-v', '--verbose', default=0, action='count', - help=_('Ignored, do not use. Present only for legacy reasons')) -- parser.add_option('--no-update-check', default=False, action='store_true', -- help=_('Do not check for updates')) -+ parser.add_option('--update-check', dest='no_update_check', default=True, action='store_false', -+ help=_('Check for updates')) - parser.add_option('--ignore-plugins', default=False, action='store_true', - help=_('Ignore custom plugins, useful if you installed a plugin' - ' that is preventing calibre from starting')) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index eb2e5b8decf6..2e6dc1f8b023 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -12527,7 +12527,7 @@ in calcurse = callPackage ../applications/misc/calcurse { }; - calibre = qt55.callPackage ../applications/misc/calibre { + calibre = qt5.callPackage ../applications/misc/calibre { inherit (pythonPackages) pyqt5 sip; };