2015-05-07 13:05:22 +01:00
|
|
|
{ stdenv, fetchurl, python, pyqt5, sip_4_16, poppler_utils, pkgconfig, libpng
|
2015-07-09 21:22:58 +01:00
|
|
|
, imagemagick, libjpeg, fontconfig, podofo, qt5, icu, sqlite
|
2013-07-26 12:18:08 +01:00
|
|
|
, pil, makeWrapper, unrar, chmlib, pythonPackages, xz, libusb1, libmtp
|
2014-08-23 11:03:03 +01:00
|
|
|
, xdg_utils
|
2010-03-23 14:04:47 +00:00
|
|
|
}:
|
2010-01-07 22:47:30 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2015-08-09 15:14:52 +01:00
|
|
|
name = "calibre-${version}";
|
2015-09-11 10:57:17 +01:00
|
|
|
version = "2.38.0";
|
2010-01-07 22:47:30 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2015-08-04 12:52:55 +01:00
|
|
|
url = "https://github.com/kovidgoyal/calibre/releases/download/v${version}/${name}.tar.xz";
|
2015-09-11 10:57:17 +01:00
|
|
|
sha256 = "075axil53djss99fj9drfh5cvxdbjw6z5z5qk53vm13k5pw6bmhn";
|
2010-01-07 22:47:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
inherit python;
|
|
|
|
|
2013-08-25 08:49:20 +01:00
|
|
|
patchPhase = ''
|
2014-08-23 11:03:03 +01:00
|
|
|
sed -i "/pyqt_sip_dir/ s:=.*:= '${pyqt5}/share/sip':" \
|
|
|
|
setup/build_environment.py
|
2013-08-25 08:49:20 +01:00
|
|
|
'';
|
|
|
|
|
2014-08-23 11:03:03 +01:00
|
|
|
nativeBuildInputs = [ makeWrapper pkgconfig ];
|
|
|
|
|
2010-03-23 14:04:47 +00:00
|
|
|
buildInputs =
|
2015-05-07 13:05:22 +01:00
|
|
|
[ python pyqt5 sip_4_16 poppler_utils libpng imagemagick libjpeg
|
2015-07-09 21:22:58 +01:00
|
|
|
fontconfig podofo qt5.base pil chmlib icu sqlite libusb1 libmtp xdg_utils
|
2011-03-28 12:50:47 +01:00
|
|
|
pythonPackages.mechanize pythonPackages.lxml pythonPackages.dateutil
|
2013-07-26 12:18:08 +01:00
|
|
|
pythonPackages.cssutils pythonPackages.beautifulsoup pythonPackages.pillow
|
2013-08-25 08:49:20 +01:00
|
|
|
pythonPackages.sqlite3 pythonPackages.netifaces pythonPackages.apsw
|
|
|
|
pythonPackages.cssselect
|
2010-03-23 14:04:47 +00:00
|
|
|
];
|
2010-01-07 22:47:30 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
2010-02-28 22:42:39 +00:00
|
|
|
export HOME=$TMPDIR/fakehome
|
2015-05-07 13:05:22 +01:00
|
|
|
export POPPLER_INC_DIR=${poppler_utils}/include/poppler
|
|
|
|
export POPPLER_LIB_DIR=${poppler_utils}/lib
|
2010-01-07 22:47:30 +00:00
|
|
|
export MAGICK_INC=${imagemagick}/include/ImageMagick
|
|
|
|
export MAGICK_LIB=${imagemagick}/lib
|
|
|
|
export FC_INC_DIR=${fontconfig}/include/fontconfig
|
|
|
|
export FC_LIB_DIR=${fontconfig}/lib
|
|
|
|
export PODOFO_INC_DIR=${podofo}/include/podofo
|
|
|
|
export PODOFO_LIB_DIR=${podofo}/lib
|
2014-08-23 11:03:03 +01:00
|
|
|
export SIP_BIN=${sip_4_16}/bin/sip
|
2010-01-07 22:47:30 +00:00
|
|
|
python setup.py install --prefix=$out
|
|
|
|
|
|
|
|
PYFILES="$out/bin/* $out/lib/calibre/calibre/web/feeds/*.py
|
|
|
|
$out/lib/calibre/calibre/ebooks/metadata/*.py
|
|
|
|
$out/lib/calibre/calibre/ebooks/rtf2xml/*.py"
|
|
|
|
|
2011-12-29 16:22:46 +00:00
|
|
|
sed -i "s/env python[0-9.]*/python/" $PYFILES
|
2014-08-23 11:03:03 +01:00
|
|
|
sed -i "2i import sys; sys.argv[0] = 'calibre'" $out/bin/calibre
|
|
|
|
|
2010-01-07 22:47:30 +00:00
|
|
|
for a in $out/bin/*; do
|
2014-08-23 11:03:03 +01:00
|
|
|
wrapProgram $a --prefix PYTHONPATH : $PYTHONPATH \
|
|
|
|
--prefix LD_LIBRARY_PATH : ${unrar}/lib \
|
2015-05-07 13:05:22 +01:00
|
|
|
--prefix PATH : ${poppler_utils}/bin
|
2010-01-07 22:47:30 +00:00
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2013-07-26 12:18:08 +01:00
|
|
|
meta = with stdenv.lib; {
|
2010-01-07 22:47:30 +00:00
|
|
|
description = "Comprehensive e-book software";
|
|
|
|
homepage = http://calibre-ebook.com;
|
2013-07-26 12:18:08 +01:00
|
|
|
license = licenses.gpl3;
|
2014-08-23 11:03:03 +01:00
|
|
|
maintainers = with maintainers; [ viric iElectric pSub ];
|
2013-07-26 12:18:08 +01:00
|
|
|
platforms = platforms.linux;
|
2010-01-07 22:47:30 +00:00
|
|
|
};
|
|
|
|
}
|