about summary refs log tree commit diff
path: root/pkgs/applications/misc/calibre
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2016-01-19 09:55:31 +0100
committerVladimír Čunát <vcunat@gmail.com>2016-01-19 09:55:31 +0100
commit716aac2519a7571e7f5fd984a886d579a4a051c5 (patch)
tree53cf89cf764d787f4dc8f08474479892b9733177 /pkgs/applications/misc/calibre
parentf8472457a440de3c44f6f604142d678b6ae2a762 (diff)
parent53b389327e34de319dc0dbda2b6bcab1a69db69d (diff)
downloadnixlib-716aac2519a7571e7f5fd984a886d579a4a051c5.tar
nixlib-716aac2519a7571e7f5fd984a886d579a4a051c5.tar.gz
nixlib-716aac2519a7571e7f5fd984a886d579a4a051c5.tar.bz2
nixlib-716aac2519a7571e7f5fd984a886d579a4a051c5.tar.lz
nixlib-716aac2519a7571e7f5fd984a886d579a4a051c5.tar.xz
nixlib-716aac2519a7571e7f5fd984a886d579a4a051c5.tar.zst
nixlib-716aac2519a7571e7f5fd984a886d579a4a051c5.zip
Merge branch 'staging' into closure-size
Diffstat (limited to 'pkgs/applications/misc/calibre')
-rw-r--r--pkgs/applications/misc/calibre/default.nix17
-rw-r--r--pkgs/applications/misc/calibre/dont_build_unrar_plugin.patch47
-rw-r--r--pkgs/applications/misc/calibre/no_updates_dialog.patch16
3 files changed, 74 insertions, 6 deletions
diff --git a/pkgs/applications/misc/calibre/default.nix b/pkgs/applications/misc/calibre/default.nix
index 46b09609d0bf..62da092470ab 100644
--- a/pkgs/applications/misc/calibre/default.nix
+++ b/pkgs/applications/misc/calibre/default.nix
@@ -1,21 +1,27 @@
 { stdenv, fetchurl, python, pyqt5, sip_4_16, poppler_utils, pkgconfig, libpng
 , imagemagick, libjpeg, fontconfig, podofo, qtbase, icu, sqlite
-, makeWrapper, unrar, chmlib, pythonPackages, xz, libusb1, libmtp
+, makeWrapper, unrarSupport ? false, chmlib, pythonPackages, xz, libusb1, libmtp
 , xdg_utils
 }:
 
 stdenv.mkDerivation rec {
-  version = "2.46.0";
+  version = "2.49.0";
   name = "calibre-${version}";
 
   src = fetchurl {
     url = "http://download.calibre-ebook.com/${version}/${name}.tar.xz";
-    sha256 = "0ig1pb62w57l6nhwg391mkjhw9dyicix6xigpdyw0320jdw9nlkb";
+    sha256 = "0jc476pg07c0nwccprhwgjdlvvb2fdzza9xrjqzc0c42c5v7qzxa";
   };
 
   inherit python;
 
-  patchPhase = ''
+  patches = [
+    # Patch from Debian that switches the version update change from
+    # enabled by default to disabled by default.
+    ./no_updates_dialog.patch
+  ] ++ stdenv.lib.optional (!unrarSupport) ./dont_build_unrar_plugin.patch;
+
+  prePatch = ''
     sed -i "/pyqt_sip_dir/ s:=.*:= '${pyqt5}/share/sip':"  \
       setup/build_environment.py
   '';
@@ -53,7 +59,6 @@ stdenv.mkDerivation rec {
 
     for a in $out/bin/*; do
       wrapProgram $a --prefix PYTHONPATH : $PYTHONPATH \
-                     --prefix LD_LIBRARY_PATH : ${unrar}/lib \
                      --prefix PATH : ${poppler_utils}/bin
     done
   '';
@@ -61,7 +66,7 @@ stdenv.mkDerivation rec {
   meta = with stdenv.lib; {
     description = "Comprehensive e-book software";
     homepage = http://calibre-ebook.com;
-    license = licenses.gpl3;
+    license = with licenses; if unrarSupport then unfreeRedistributable else gpl3;
     maintainers = with maintainers; [ viric iElectric pSub AndersonTorres ];
     platforms = platforms.linux;
     inherit version;
diff --git a/pkgs/applications/misc/calibre/dont_build_unrar_plugin.patch b/pkgs/applications/misc/calibre/dont_build_unrar_plugin.patch
new file mode 100644
index 000000000000..c910be89a5f1
--- /dev/null
+++ b/pkgs/applications/misc/calibre/dont_build_unrar_plugin.patch
@@ -0,0 +1,47 @@
+Author: Dmitry Shachnev <mitya57@gmail.com>
+Description: do not build unrar extension as we strip unrar from the tarball
+Forwarded: not-needed
+Last-Update: 2013-04-04
+
+Index: calibre/setup/extensions.py
+===================================================================
+--- calibre.orig/setup/extensions.py	2014-02-02 10:42:14.510954007 +0100
++++ calibre/setup/extensions.py	2014-02-02 10:42:14.502954007 +0100
+@@ -209,24 +209,6 @@
+                 sip_files=['calibre/ebooks/pdf/render/qt_hack.sip']
+                 ),
+ 
+-    Extension('unrar',
+-              ['unrar/%s.cpp'%(x.partition('.')[0]) for x in '''
+-               rar.o strlist.o strfn.o pathfn.o savepos.o smallfn.o global.o file.o
+-               filefn.o filcreat.o archive.o arcread.o unicode.o system.o
+-               isnt.o crypt.o crc.o rawread.o encname.o resource.o match.o
+-               timefn.o rdwrfn.o consio.o options.o ulinks.o errhnd.o rarvm.o
+-               secpassword.o rijndael.o getbits.o sha1.o extinfo.o extract.o
+-               volume.o list.o find.o unpack.o cmddata.o filestr.o scantree.o
+-               '''.split()] + ['calibre/utils/unrar.cpp'],
+-              inc_dirs=['unrar'],
+-              cflags=[('/' if iswindows else '-') + x for x in (
+-                  'DSILENT', 'DRARDLL', 'DUNRAR')] + (
+-                  [] if iswindows else ['-D_FILE_OFFSET_BITS=64',
+-                                        '-D_LARGEFILE_SOURCE']),
+-              optimize_level=2,
+-              libraries=['User32', 'Advapi32', 'kernel32', 'Shell32'] if iswindows else []
+-              ),
+-
+     ]
+ 
+ 
+Index: calibre/src/calibre/ebooks/metadata/archive.py
+===================================================================
+--- calibre.orig/src/calibre/ebooks/metadata/archive.py	2014-02-02 10:42:14.510954007 +0100
++++ calibre/src/calibre/ebooks/metadata/archive.py	2014-02-02 10:42:14.502954007 +0100
+@@ -42,7 +42,7 @@
+     description = _('Extract common e-book formats from archives '
+         '(zip/rar) files. Also try to autodetect if they are actually '
+         'cbz/cbr files.')
+-    file_types = set(['zip', 'rar'])
++    file_types = set(['zip'])
+     supported_platforms = ['windows', 'osx', 'linux']
+     on_import = True
+ 
diff --git a/pkgs/applications/misc/calibre/no_updates_dialog.patch b/pkgs/applications/misc/calibre/no_updates_dialog.patch
new file mode 100644
index 000000000000..52364f64dac7
--- /dev/null
+++ b/pkgs/applications/misc/calibre/no_updates_dialog.patch
@@ -0,0 +1,16 @@
+# 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'))