2021-01-11 07:54:33 +00:00
|
|
|
|
{ lib, stdenv, fetchFromGitHub
|
2020-10-14 08:39:58 +01:00
|
|
|
|
, freetype, harfbuzz, jbig2dec, libjpeg, libX11, mupdf_1_17, ncurses, openjpeg
|
2016-05-06 12:45:34 +01:00
|
|
|
|
, openssl
|
|
|
|
|
|
|
|
|
|
, imageSupport ? true, imlib2 ? null }:
|
2015-01-14 22:31:47 +00:00
|
|
|
|
|
2015-04-21 19:00:01 +01:00
|
|
|
|
let
|
2016-05-06 12:45:34 +01:00
|
|
|
|
package = if imageSupport
|
|
|
|
|
then "jfbview"
|
|
|
|
|
else "jfbpdf";
|
|
|
|
|
binaries = if imageSupport
|
2017-02-07 03:44:31 +00:00
|
|
|
|
then [ "jfbview" "jpdfcat" "jpdfgrep" ] # all require imlib2
|
|
|
|
|
else [ "jfbpdf" ]; # does not
|
2015-04-21 19:00:01 +01:00
|
|
|
|
in
|
2016-05-06 12:45:34 +01:00
|
|
|
|
|
2016-01-25 19:08:34 +00:00
|
|
|
|
stdenv.mkDerivation rec {
|
2016-05-06 12:45:34 +01:00
|
|
|
|
name = "${package}-${version}";
|
2020-02-06 08:55:11 +00:00
|
|
|
|
version = "0.5.7";
|
2015-01-14 22:31:47 +00:00
|
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
|
repo = "JFBView";
|
|
|
|
|
owner = "jichu4n";
|
2017-09-03 01:03:06 +01:00
|
|
|
|
rev = version;
|
2020-02-06 08:55:11 +00:00
|
|
|
|
sha256 = "0ppns49hnmp04zdjw6wc28v0yvz31rkzvd5ylcj7arikx20llpxf";
|
2015-01-14 22:31:47 +00:00
|
|
|
|
};
|
|
|
|
|
|
2020-01-25 18:35:08 +00:00
|
|
|
|
postPatch = ''
|
|
|
|
|
substituteInPlace main.cpp \
|
|
|
|
|
--replace "<stropts.h>" "<sys/ioctl.h>"
|
|
|
|
|
'';
|
|
|
|
|
|
2017-09-03 01:03:06 +01:00
|
|
|
|
hardeningDisable = [ "format" ];
|
|
|
|
|
|
2016-05-06 12:45:34 +01:00
|
|
|
|
buildInputs = [
|
2020-10-14 08:39:58 +01:00
|
|
|
|
freetype harfbuzz jbig2dec libjpeg libX11 mupdf_1_17 ncurses openjpeg
|
2016-05-06 12:45:34 +01:00
|
|
|
|
openssl
|
2021-01-15 14:45:37 +00:00
|
|
|
|
] ++ lib.optionals imageSupport [
|
2016-05-06 12:45:34 +01:00
|
|
|
|
imlib2
|
|
|
|
|
];
|
2015-01-14 22:31:47 +00:00
|
|
|
|
|
2016-05-06 10:56:56 +01:00
|
|
|
|
configurePhase = ''
|
2016-05-06 12:45:34 +01:00
|
|
|
|
# Hack. Probing (`ldconfig -p`) fails with ‘cannot execute binary file’.
|
|
|
|
|
# Overriding `OPENJP2 =` later works, but makes build output misleading:
|
2016-05-06 10:56:56 +01:00
|
|
|
|
substituteInPlace Makefile --replace "ldconfig -p" "echo libopenjp2"
|
|
|
|
|
|
|
|
|
|
make config.mk
|
|
|
|
|
'';
|
|
|
|
|
|
2015-04-21 19:00:01 +01:00
|
|
|
|
buildFlags = binaries;
|
2015-01-14 22:31:47 +00:00
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
|
mkdir -p $out/bin
|
2015-04-21 19:00:01 +01:00
|
|
|
|
install ${toString binaries} $out/bin
|
2015-01-14 22:31:47 +00:00
|
|
|
|
'';
|
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
|
meta = with lib; {
|
2015-01-14 22:31:47 +00:00
|
|
|
|
description = "PDF and image viewer for the Linux framebuffer";
|
|
|
|
|
longDescription = ''
|
2015-04-21 19:00:01 +01:00
|
|
|
|
A very fast PDF and image viewer for the Linux framebuffer with some
|
|
|
|
|
advanced and unique features, including:
|
|
|
|
|
- Reads PDFs (MuPDF) and common image formats (Imlib2)
|
|
|
|
|
- Supports arbitrary zoom (10% - 1000%) and rotation
|
|
|
|
|
- Table of Contents (TOC) viewer for PDF documents
|
|
|
|
|
- Multi-threaded rendering on multi-core machines
|
|
|
|
|
- Asynchronous background rendering of the next page
|
|
|
|
|
- Customizable multi-threaded caching
|
2015-01-14 22:31:47 +00:00
|
|
|
|
'';
|
2020-04-01 02:11:51 +01:00
|
|
|
|
homepage = "https://seasonofcode.com/pages/jfbview.html";
|
2015-05-28 18:20:29 +01:00
|
|
|
|
license = licenses.asl20;
|
2015-11-17 20:29:29 +00:00
|
|
|
|
platforms = platforms.linux;
|
2015-01-14 22:31:47 +00:00
|
|
|
|
};
|
|
|
|
|
}
|