2015-12-08 14:14:59 +00:00
|
|
|
{stdenv, fetchurl, unzip, python, makeWrapper, ghostscript, pngnq, pillow, djvulibre
|
2010-03-23 23:04:41 +00:00
|
|
|
, optipng, unrar}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "pdfread-1.8.2";
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
# I got it from http://www.mobileread.com/forums/showthread.php?t=21906
|
|
|
|
# But that needs user registration to allow downloading.
|
|
|
|
# This is an evolution from pdfread 1.7 in http://pdfread.sourceforge.net/
|
|
|
|
# Temporary place:
|
|
|
|
url = http://vicerveza.homeunix.net/~viric/soft/PDFRead-1.8.2-Source-noGUI-noInstaller.zip;
|
|
|
|
sha256 = "0mzxpnk97f0ww5ds7h4wsval3g4lnrhv6rhspjs7cy4i41gmk8an";
|
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [ unzip python makeWrapper ];
|
|
|
|
|
2015-12-08 14:14:45 +00:00
|
|
|
broken = true; # Not found.
|
|
|
|
|
2010-03-23 23:04:41 +00:00
|
|
|
phases = "unpackPhase patchPhase installPhase";
|
|
|
|
|
|
|
|
unpackPhase = ''
|
|
|
|
unzip $src
|
|
|
|
sourceRoot=`pwd`/PDFRead/src
|
|
|
|
'';
|
|
|
|
|
|
|
|
patchPhase = ''
|
|
|
|
sed -i 's,#!/usr.*,#!${python}/bin/python,' pdfread.py
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2012-01-18 20:16:00 +00:00
|
|
|
mkdir -p $out/bin
|
2010-03-23 23:04:41 +00:00
|
|
|
cp pdfread.py $out/bin
|
|
|
|
chmod +x $out/bin/pdfread.py
|
|
|
|
|
|
|
|
LIBSUFFIX=lib/${python.libPrefix}/site-packages/
|
|
|
|
PYDIR=$out/$LIBSUFFIX
|
2012-01-18 20:16:00 +00:00
|
|
|
mkdir -p $PYDIR
|
2010-03-23 23:04:41 +00:00
|
|
|
cp -R *.py pylrs $PYDIR
|
|
|
|
|
2015-12-08 14:14:59 +00:00
|
|
|
wrapProgram $out/bin/pdfread.py --prefix PYTHONPATH : $PYTHONPATH:${pillow}/$LIBSUFFIX/PIL:$PYDIR \
|
2015-10-28 18:36:40 +00:00
|
|
|
--prefix PATH : ${ghostscript}/bin:${pngnq}/bin:${djvulibre.bin}/bin:${unrar}/bin:${optipng}/bin
|
2010-03-23 23:04:41 +00:00
|
|
|
'';
|
|
|
|
|
2015-06-10 12:00:11 +01:00
|
|
|
meta = with stdenv.lib; {
|
2010-03-23 23:04:41 +00:00
|
|
|
description = "PDF/DJVU to ebook format converter";
|
|
|
|
homepage = http://www.mobileread.com/forums/showthread.php?t=21906;
|
2015-06-10 12:00:11 +01:00
|
|
|
license = licenses.mit;
|
2010-03-23 23:04:41 +00:00
|
|
|
};
|
|
|
|
}
|