1{ stdenv, fetchurl, makeWrapper
2, ghostscript, netpbm, perl }:
3# TODO: withTex
4
5# Ported from Homebrew.
6# https://github.com/Homebrew/homebrew-core/blob/21834573f690407d34b0bbf4250b82ec38dda4d6/Formula/latex2html.rb
7
8stdenv.mkDerivation rec {
9 name = "latex2html-${version}";
10 version = "2016";
11
12 src = fetchurl {
13 url = "http://mirrors.ctan.org/support/latex2html/latex2html-${version}.tar.gz";
14 sha256 = "028k0ypbq94mlhydf1sbqlphlfl2fhmlzhgqq5jjzihfmccbq7db";
15 };
16
17 buildInputs = [ ghostscript netpbm perl ];
18
19 nativeBuildInputs = [ makeWrapper ];
20
21 configurePhase = ''
22 ./configure \
23 --prefix="$out" \
24 --without-mktexlsr \
25 --with-texpath=$out/share/texmf/tex/latex/html
26 '';
27
28 postInstall = ''
29 for p in $out/bin/{latex2html,pstoimg}; do \
30 wrapProgram $p --add-flags '--tmp="''${TMPDIR:-/tmp}"'
31 done
32 '';
33
34 meta = with stdenv.lib; {
35 description = "LaTeX-to-HTML translator";
36 longDescription = ''
37 A Perl program that translates LaTeX into HTML (HyperText Markup
38 Language), optionally creating separate HTML files corresponding to each
39 unit (e.g., section) of the document. LaTeX2HTML proceeds by interpreting
40 LaTeX (to the best of its abilities). It contains definitions from a wide
41 variety of classes and packages, and users may add further definitions by
42 writing Perl scripts that provide information about class/package
43 commands.
44 '';
45
46 homepage = https://www.ctan.org/pkg/latex2html;
47
48 license = licenses.gpl2;
49 platforms = with platforms; linux ++ darwin;
50 maintainers = with maintainers; [ yurrriq ];
51 };
52}