diff options
author | Bjørn Forsman <bjorn.forsman@gmail.com> | 2013-09-28 00:38:28 +0200 |
---|---|---|
committer | Bjørn Forsman <bjorn.forsman@gmail.com> | 2013-10-06 12:18:08 +0200 |
commit | 83c9a264bff56c56bcf8c7ca0ba3a5d4e13e7dc1 (patch) | |
tree | 5bd57f1b8fa17e10b69325fa0b927165c2dad9fd /pkgs/tools/typesetting/tex | |
parent | 9db68de9e616bbc64182847eae79a398ccc3e885 (diff) | |
download | nixlib-83c9a264bff56c56bcf8c7ca0ba3a5d4e13e7dc1.tar nixlib-83c9a264bff56c56bcf8c7ca0ba3a5d4e13e7dc1.tar.gz nixlib-83c9a264bff56c56bcf8c7ca0ba3a5d4e13e7dc1.tar.bz2 nixlib-83c9a264bff56c56bcf8c7ca0ba3a5d4e13e7dc1.tar.lz nixlib-83c9a264bff56c56bcf8c7ca0ba3a5d4e13e7dc1.tar.xz nixlib-83c9a264bff56c56bcf8c7ca0ba3a5d4e13e7dc1.tar.zst nixlib-83c9a264bff56c56bcf8c7ca0ba3a5d4e13e7dc1.zip |
dblatex: purify and add dblatexFull attribute
imagemagick, transfig, inkscape, fontconfig and ghostscript are missing dependencies of dblatex. Instead of adding all those dependencies to the existing dblatex attribute, make a new dblatexFull attribute for that. Also pass --use-python-path at install time so that script shebangs end up with #!/path/to/python instead of #!/path/to/env python (which is impure when not run in a wrapper).
Diffstat (limited to 'pkgs/tools/typesetting/tex')
-rw-r--r-- | pkgs/tools/typesetting/tex/dblatex/default.nix | 45 |
1 files changed, 40 insertions, 5 deletions
diff --git a/pkgs/tools/typesetting/tex/dblatex/default.nix b/pkgs/tools/typesetting/tex/dblatex/default.nix index fa4746a562ea..6993158291c2 100644 --- a/pkgs/tools/typesetting/tex/dblatex/default.nix +++ b/pkgs/tools/typesetting/tex/dblatex/default.nix @@ -1,4 +1,15 @@ -{ stdenv, fetchurl, python, libxslt, tetex }: +{ stdenv, fetchurl, python, libxslt, tetex +, enableAllFeatures ? false, imagemagick ? null, transfig ? null, inkscape ? null, fontconfig ? null, ghostscript ? null }: + +# NOTE: enableAllFeatures just purifies the expression, it doesn't actually +# enable any extra features. + +assert enableAllFeatures -> + imagemagick != null && + transfig != null && + inkscape != null && + fontconfig != null && + ghostscript != null; stdenv.mkDerivation rec { name = "dblatex-0.3.4"; @@ -8,15 +19,39 @@ stdenv.mkDerivation rec { sha256 = "120w3wm07qx0k1grgdhjwm2vpwil71icshjvqznskp1f6ggch290"; }; + buildInputs = [ python libxslt tetex ] + ++ stdenv.lib.optionals enableAllFeatures [ imagemagick transfig ]; + + # TODO: dblatex tries to execute texindy command, but nixpkgs doesn't have + # that yet. In Ubuntu, texindy is a part of the xindy package. + preConfigure = '' + sed -i 's|self.install_layout == "deb"|False|' setup.py + '' + stdenv.lib.optionalString enableAllFeatures '' + for file in $(find -name "*.py"); do + sed -e 's|cmd = \["xsltproc|cmd = \["${libxslt}/bin/xsltproc|g' \ + -e 's|Popen(\["xsltproc|Popen(\["${libxslt}/bin/xsltproc|g' \ + -e 's|cmd = \["texindy|cmd = ["nixpkgs_is_missing_texindy|g' \ + -e 's|cmd = "epstopdf|cmd = "${tetex}/bin/epstopdf|g' \ + -e 's|cmd = \["makeindex|cmd = ["${tetex}/bin/makeindex|g' \ + -e 's|doc.program = "pdflatex"|doc.program = "${tetex}/bin/pdflatex"|g' \ + -e 's|self.program = "latex"|self.program = "${tetex}/bin/latex"|g' \ + -e 's|Popen("pdflatex|Popen("${tetex}/bin/pdflatex|g' \ + -e 's|"fc-match"|"${fontconfig}/bin/fc-match"|g' \ + -e 's|"fc-list"|"${fontconfig}/bin/fc-list"|g' \ + -e 's|cmd = "inkscape|cmd = "${inkscape}/bin/inkscape|g' \ + -e 's|cmd = "fig2dev|cmd = "${transfig}/bin/fig2dev|g' \ + -e 's|cmd = \["ps2pdf|cmd = ["${ghostscript}/bin/ps2pdf|g' \ + -e 's|cmd = "convert|cmd = "${imagemagick}/bin/convert|g' \ + -i "$file" + done + ''; + buildPhase = "true"; installPhase = '' - sed -i 's|self.install_layout == "deb"|False|' setup.py - python ./setup.py install --prefix=$out + python ./setup.py install --prefix="$out" --use-python-path --verbose ''; - buildInputs = [ python libxslt tetex ]; - meta = { description = "A program to convert DocBook to DVI, PostScript or PDF via LaTeX or ConTeXt"; homepage = http://dblatex.sourceforge.net/; |