summary refs log tree commit diff
path: root/pkgs/applications/misc/calibre
diff options
context:
space:
mode:
authorEduardo Sánchez Muñoz <esm@eduardosm.net>2021-01-13 21:39:14 +0100
committerEduardo Sánchez Muñoz <esm@eduardosm.net>2021-01-29 11:23:49 +0100
commita2807e67f06f36597bd040a2e1c12bcf93036f86 (patch)
treead4294e87e793fa515d3850d0b2c7ff06513ee3e /pkgs/applications/misc/calibre
parent36945fedef3aaaa4fb2ac627a1f27cc76098365b (diff)
downloadnixpkgs-a2807e67f06f36597bd040a2e1c12bcf93036f86.tar
nixpkgs-a2807e67f06f36597bd040a2e1c12bcf93036f86.tar.gz
nixpkgs-a2807e67f06f36597bd040a2e1c12bcf93036f86.tar.bz2
nixpkgs-a2807e67f06f36597bd040a2e1c12bcf93036f86.tar.lz
nixpkgs-a2807e67f06f36597bd040a2e1c12bcf93036f86.tar.xz
nixpkgs-a2807e67f06f36597bd040a2e1c12bcf93036f86.tar.zst
nixpkgs-a2807e67f06f36597bd040a2e1c12bcf93036f86.zip
calibre: 4.23.0 -> 5.10.1
Co-authored-by: ento <ento+github@i.pearlwaffles.xyz>
Co-authored-by: Eduardo Sánchez Muñoz <esm@eduardosm.net>
Diffstat (limited to 'pkgs/applications/misc/calibre')
-rw-r--r--pkgs/applications/misc/calibre/default.nix36
1 files changed, 24 insertions, 12 deletions
diff --git a/pkgs/applications/misc/calibre/default.nix b/pkgs/applications/misc/calibre/default.nix
index d838cd4e859..47d2ee52f81 100644
--- a/pkgs/applications/misc/calibre/default.nix
+++ b/pkgs/applications/misc/calibre/default.nix
@@ -1,4 +1,5 @@
 { lib
+, stdenv
 , mkDerivation
 , fetchurl
 , poppler_utils
@@ -16,7 +17,7 @@
 , hyphen
 , unrarSupport ? false
 , chmlib
-, pythonPackages
+, python3Packages
 , libusb1
 , libmtp
 , xdg_utils
@@ -26,11 +27,11 @@
 
 mkDerivation rec {
   pname = "calibre";
-  version = "4.23.0";
+  version = "5.10.1";
 
   src = fetchurl {
     url = "https://download.calibre-ebook.com/${version}/${pname}-${version}.tar.xz";
-    sha256 = "sha256-Ft5RRzzw4zb5RqVyUaHk9Pu6H4V/F9j8FKoTLn61lRg=";
+    sha256 = "18pnqxdyvgmw12yarxhvsgs4jk6c5hp05gf8khybcd78330954v9";
   };
 
   patches = [
@@ -42,9 +43,20 @@ mkDerivation rec {
     # the unrar patch is not from debian
   ] ++ lib.optional (!unrarSupport) ./dont_build_unrar_plugin.patch;
 
+  escaped_pyqt5_dir = builtins.replaceStrings ["/"] ["\\/"] (toString python3Packages.pyqt5);
+  platform_tag =
+    if stdenv.hostPlatform.isDarwin then
+      "WS_MACX"
+    else if stdenv.hostPlatform.isWindows then
+      "WS_WIN"
+    else
+      "WS_X11";
+
   prePatch = ''
-    sed -i "/pyqt_sip_dir/ s:=.*:= '${pythonPackages.pyqt5}/share/sip/PyQt5':"  \
-      setup/build_environment.py
+    sed -i "s/\[tool.sip.project\]/[tool.sip.project]\nsip-include-dirs = [\"${escaped_pyqt5_dir}\/share\/sip\/PyQt5\"]/g" \
+      setup/build.py
+    sed -i "s/\[tool.sip.bindings.pictureflow\]/[tool.sip.bindings.pictureflow]\ntags = [\"${platform_tag}\"]/g" \
+      setup/build.py
 
     # Remove unneeded files and libs
     rm -rf resources/calibre-portable.* \
@@ -57,8 +69,6 @@ mkDerivation rec {
 
   nativeBuildInputs = [ pkg-config qmake removeReferencesTo ];
 
-  CALIBRE_PY3_PORT = builtins.toString pythonPackages.isPy3k;
-
   buildInputs = [
     chmlib
     fontconfig
@@ -76,7 +86,7 @@ mkDerivation rec {
     sqlite
     xdg_utils
   ] ++ (
-    with pythonPackages; [
+    with python3Packages; [
       apsw
       beautifulsoup4
       css-parser
@@ -92,11 +102,13 @@ mkDerivation rec {
       msgpack
       netifaces
       pillow
+      pyqt-builder
       pyqt5
       pyqtwebengine
       python
       regex
-      sip
+      sip_5
+      zeroconf
       # the following are distributed with calibre, but we use upstream instead
       odfpy
     ] ++ lib.optional (unrarSupport) unrardll
@@ -114,11 +126,11 @@ mkDerivation rec {
     export FC_LIB_DIR=${fontconfig.lib}/lib
     export PODOFO_INC_DIR=${podofo.dev}/include/podofo
     export PODOFO_LIB_DIR=${podofo.lib}/lib
-    export SIP_BIN=${pythonPackages.sip}/bin/sip
+    export SIP_BIN=${python3Packages.sip}/bin/sip
     export XDG_DATA_HOME=$out/share
     export XDG_UTILS_INSTALL_MODE="user"
 
-    ${pythonPackages.python.interpreter} setup.py install --root=$out \
+    ${python3Packages.python.interpreter} setup.py install --root=$out \
       --prefix=$out \
       --libdir=$out/lib \
       --staging-root=$out \
@@ -147,7 +159,7 @@ mkDerivation rec {
   #   /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${lib.optionalString pythonPackages.isPy3k "/3"}/podofo.so
+      $out/lib/calibre/calibre/plugins/podofo.so
 
     for program in $out/bin/*; do
       wrapProgram $program \