nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 107 lines 3.1 kB view raw
1{ 2 enableGUI ? true, 3 enablePDFtoPPM ? true, 4 enablePrinting ? true, 5 lib, 6 stdenv, 7 fetchzip, 8 cmake, 9 makeDesktopItem, 10 zlib, 11 libpng, 12 cups ? null, 13 freetype ? null, 14 qtbase ? null, 15 qtsvg ? null, 16 wrapQtAppsHook, 17}: 18 19assert enableGUI -> qtbase != null && qtsvg != null && freetype != null; 20assert enablePDFtoPPM -> freetype != null; 21assert enablePrinting -> cups != null; 22 23stdenv.mkDerivation rec { 24 pname = "xpdf"; 25 version = "4.05"; 26 27 src = fetchzip { 28 urls = [ 29 "https://dl.xpdfreader.com/xpdf-${version}.tar.gz" 30 "https://dl.xpdfreader.com/old/xpdf-${version}.tar.gz" 31 ]; 32 hash = "sha256-LBxKSrXTdoulZDjPiyYMaJr63jFHHI+VCgVJx310i/w="; 33 }; 34 35 # Fix "No known features for CXX compiler", see 36 # https://cmake.org/pipermail/cmake/2016-December/064733.html and the note at 37 # https://cmake.org/cmake/help/v3.10/command/cmake_minimum_required.html 38 postPatch = lib.optionalString stdenv.hostPlatform.isDarwin '' 39 substituteInPlace CMakeLists.txt --replace \ 40 'cmake_minimum_required(VERSION 2.8.12)' 'cmake_minimum_required(VERSION 3.1.0)' 41 ''; 42 43 nativeBuildInputs = [ cmake ] ++ lib.optional enableGUI wrapQtAppsHook; 44 45 cmakeFlags = [ 46 "-DSYSTEM_XPDFRC=/etc/xpdfrc" 47 "-DA4_PAPER=ON" 48 "-DOPI_SUPPORT=ON" 49 ] 50 ++ lib.optional (!enablePrinting) "-DXPDFWIDGET_PRINTING=OFF"; 51 52 buildInputs = [ 53 zlib 54 libpng 55 ] 56 ++ lib.optional enableGUI qtbase 57 ++ lib.optional enablePrinting cups 58 ++ lib.optional enablePDFtoPPM freetype; 59 60 desktopItem = makeDesktopItem { 61 name = "xpdf"; 62 desktopName = "Xpdf"; 63 comment = "Views Adobe PDF files"; 64 icon = "xpdf"; 65 exec = "xpdf %f"; 66 categories = [ "Office" ]; 67 }; 68 69 postInstall = lib.optionalString (!stdenv.hostPlatform.isDarwin) '' 70 install -Dm644 ${desktopItem}/share/applications/xpdf.desktop -t $out/share/applications 71 install -Dm644 $src/xpdf-qt/xpdf-icon.svg $out/share/pixmaps/xpdf.svg 72 ''; 73 74 meta = with lib; { 75 homepage = "https://www.xpdfreader.com"; 76 description = "Viewer for Portable Document Format (PDF) files"; 77 longDescription = '' 78 XPDF includes multiple tools for viewing and processing PDF files. 79 xpdf: PDF viewer (with Graphical Interface) 80 pdftotext: converts PDF to text 81 pdftops: converts PDF to PostScript 82 pdftoppm: converts PDF pages to netpbm (PPM/PGM/PBM) image files 83 pdftopng: converts PDF pages to PNG image files 84 pdftohtml: converts PDF to HTML 85 pdfinfo: extracts PDF metadata 86 pdfimages: extracts raw images from PDF files 87 pdffonts: lists fonts used in PDF files 88 pdfdetach: extracts attached files from PDF files 89 ''; 90 license = with licenses; [ 91 gpl2Only 92 gpl3Only 93 ]; 94 platforms = platforms.unix; 95 maintainers = with maintainers; [ sikmir ]; 96 knownVulnerabilities = [ 97 "CVE-2023-26930" 98 "CVE-2024-2971" 99 "CVE-2024-3247" 100 "CVE-2024-3248" 101 "CVE-2024-3900" 102 "CVE-2024-4141" 103 "CVE-2024-4568" 104 "CVE-2024-4976" 105 ]; 106 }; 107}