at 18.03-beta 68 lines 1.9 kB view raw
1{ stdenv, fetchFromGitHub 2, freetype, harfbuzz, jbig2dec, libjpeg, libX11, mupdf, ncurses, openjpeg 3, openssl 4 5, imageSupport ? true, imlib2 ? null }: 6 7let 8 package = if imageSupport 9 then "jfbview" 10 else "jfbpdf"; 11 binaries = if imageSupport 12 then [ "jfbview" "jpdfcat" "jpdfgrep" ] # all require imlib2 13 else [ "jfbpdf" ]; # does not 14in 15 16stdenv.mkDerivation rec { 17 name = "${package}-${version}"; 18 version = "0.5.4"; 19 20 src = fetchFromGitHub { 21 repo = "JFBView"; 22 owner = "jichu4n"; 23 rev = version; 24 sha256 = "0p12b5n07yfkmfswjdb3a4c5c50jcphl030n3i71djcq4jjvrxlw"; 25 }; 26 27 hardeningDisable = [ "format" ]; 28 29 buildInputs = [ 30 freetype harfbuzz jbig2dec libjpeg libX11 mupdf ncurses openjpeg 31 openssl 32 ] ++ stdenv.lib.optionals imageSupport [ 33 imlib2 34 ]; 35 36 configurePhase = '' 37 # Hack. Probing (`ldconfig -p`) fails with cannot execute binary file. 38 # Overriding `OPENJP2 =` later works, but makes build output misleading: 39 substituteInPlace Makefile --replace "ldconfig -p" "echo libopenjp2" 40 41 make config.mk 42 ''; 43 44 buildFlags = binaries; 45 enableParallelBuilding = true; 46 47 installPhase = '' 48 mkdir -p $out/bin 49 install ${toString binaries} $out/bin 50 ''; 51 52 meta = with stdenv.lib; { 53 description = "PDF and image viewer for the Linux framebuffer"; 54 longDescription = '' 55 A very fast PDF and image viewer for the Linux framebuffer with some 56 advanced and unique features, including: 57 - Reads PDFs (MuPDF) and common image formats (Imlib2) 58 - Supports arbitrary zoom (10% - 1000%) and rotation 59 - Table of Contents (TOC) viewer for PDF documents 60 - Multi-threaded rendering on multi-core machines 61 - Asynchronous background rendering of the next page 62 - Customizable multi-threaded caching 63 ''; 64 homepage = https://seasonofcode.com/pages/jfbview.html; 65 license = licenses.asl20; 66 platforms = platforms.linux; 67 }; 68}