Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 115 lines 3.1 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 python311, 6 libxslt, 7 texliveBasic, 8 enableAllFeatures ? false, 9 imagemagick, 10 fig2dev, 11 inkscape, 12 fontconfig, 13 ghostscript, 14 15 tex ? texliveBasic.withPackages ( 16 ps: with ps; [ 17 # satisfy all packages that ./configure mentions 18 epstopdf 19 anysize 20 appendix 21 changebar 22 fancybox 23 fancyvrb 24 float 25 footmisc 26 listings 27 jknapltx # for mathrsfs.sty 28 multirow 29 overpic 30 pdfpages 31 pdflscape 32 graphics 33 stmaryrd 34 subfigure 35 titlesec 36 wasysym 37 # pkgs below don't seem requested by dblatex, but our manual fails without them 38 ec 39 zapfding 40 symbol 41 eepic 42 times 43 rsfs 44 cs 45 tex4ht 46 courier 47 helvetic 48 ly1 49 ] 50 ), 51}: 52 53# NOTE: enableAllFeatures just purifies the expression, it doesn't actually 54# enable any extra features. 55 56stdenv.mkDerivation rec { 57 pname = "dblatex${lib.optionalString enableAllFeatures "-full"}"; 58 version = "0.3.12"; 59 60 src = fetchurl { 61 url = "mirror://sourceforge/dblatex/${pname}3-${version}.tar.bz2"; 62 sha256 = "0yd09nypswy3q4scri1dg7dr99d7gd6r2dwx0xm81l9f4y32gs0n"; 63 }; 64 65 buildInputs = [ 66 python311 67 libxslt 68 tex 69 ] 70 ++ lib.optionals enableAllFeatures [ 71 imagemagick 72 fig2dev 73 ]; 74 75 # TODO: dblatex tries to execute texindy command, but nixpkgs doesn't have 76 # that yet. In Ubuntu, texindy is a part of the xindy package. 77 preConfigure = '' 78 sed -i 's|self.install_layout == "deb"|False|' setup.py 79 '' 80 + lib.optionalString enableAllFeatures '' 81 for file in $(find -name "*.py"); do 82 sed -e 's|cmd = \["xsltproc|cmd = \["${libxslt.bin}/bin/xsltproc|g' \ 83 -e 's|Popen(\["xsltproc|Popen(\["${libxslt.bin}/bin/xsltproc|g' \ 84 -e 's|cmd = \["texindy|cmd = ["nixpkgs_is_missing_texindy|g' \ 85 -e 's|cmd = "epstopdf|cmd = "${tex}/bin/epstopdf|g' \ 86 -e 's|cmd = \["makeindex|cmd = ["${tex}/bin/makeindex|g' \ 87 -e 's|doc.program = "pdflatex"|doc.program = "${tex}/bin/pdflatex"|g' \ 88 -e 's|self.program = "latex"|self.program = "${tex}/bin/latex"|g' \ 89 -e 's|Popen("pdflatex|Popen("${tex}/bin/pdflatex|g' \ 90 -e 's|"fc-match"|"${fontconfig.bin}/bin/fc-match"|g' \ 91 -e 's|"fc-list"|"${fontconfig.bin}/bin/fc-list"|g' \ 92 -e 's|cmd = "inkscape|cmd = "${inkscape}/bin/inkscape|g' \ 93 -e 's|cmd = "fig2dev|cmd = "${fig2dev}/bin/fig2dev|g' \ 94 -e 's|cmd = \["ps2pdf|cmd = ["${ghostscript}/bin/ps2pdf|g' \ 95 -e 's|cmd = "convert|cmd = "${imagemagick.out}/bin/convert|g' \ 96 -i "$file" 97 done 98 ''; 99 100 dontBuild = true; 101 102 installPhase = '' 103 ${python311.interpreter} ./setup.py install --prefix="$out" --use-python-path --verbose 104 ''; 105 106 passthru = { inherit tex; }; 107 108 meta = { 109 description = "Program to convert DocBook to DVI, PostScript or PDF via LaTeX or ConTeXt"; 110 mainProgram = "dblatex"; 111 homepage = "https://dblatex.sourceforge.net/"; 112 license = lib.licenses.gpl2Plus; 113 platforms = lib.platforms.unix; 114 }; 115}