1{ stdenv, fetchurl, perlPackages, ncurses, lynx, makeWrapper }:
2
3perlPackages.buildPerlPackage rec {
4 name = "wml-2.0.11";
5
6 src = fetchurl {
7 url = "http://thewml.org/distrib/${name}.tar.gz";
8 sha256 = "0jjxpq91x7y2mgixz7ghqp01m24qa37wl3zz515rrzv7x8cyy4cf";
9 };
10
11 setOutputFlags = false;
12
13 # Getting lots of Non-ASCII character errors from pod2man.
14 # Inserting =encoding utf8 before the first =head occurrence.
15 # Wasn't able to fix mp4h.
16 preConfigure = ''
17 touch Makefile.PL
18 for i in wml_backend/p6_asubst/asubst.src wml_aux/freetable/freetable.src wml_docs/*.pod wml_include/des/*.src wml_include/fmt/*.src; do
19 sed -i '0,/^=head/{s/^=head/=encoding utf8\n=head/}' $i
20 done
21 sed -i 's/ doc / /g' wml_backend/p2_mp4h/Makefile.in
22 sed -i '/p2_mp4h\/doc/d' Makefile.in
23 '';
24
25 buildInputs = with perlPackages;
26 [ perl TermReadKey GD BitVector ncurses lynx makeWrapper ImageSize ];
27
28 patches = [ ./redhat-with-thr.patch ./dynaloader.patch ./no_bitvector.patch ];
29
30 hardeningDisable = [ "format" ];
31
32 postPatch = ''
33 substituteInPlace wml_frontend/wml.src \
34 --replace "File::PathConvert::realpath" "Cwd::realpath" \
35 --replace "File::PathConvert::abs2rel" "File::Spec->abs2rel" \
36 --replace "File::PathConvert" "File::Spec"
37
38 for i in wml_include/des/imgbg.src wml_include/des/imgdot.src; do
39 substituteInPlace $i \
40 --replace "WML::GD" "GD"
41 done
42
43 rm wml_test/t/11-wmk.t
44 '';
45
46 preFixup = ''
47 wrapProgram $out/bin/wml \
48 --set PERL5LIB ${with perlPackages; stdenv.lib.makePerlPath [
49 BitVector TermReadKey ImageSize
50 ]}
51 '';
52
53 enableParallelBuilding = false;
54
55 installTargets = "install";
56
57 meta = with stdenv.lib; {
58 homepage = http://thewml.org/;
59 description = "Off-line HTML generation toolkit for Unix";
60 license = licenses.gpl2;
61 platforms = platforms.linux;
62 };
63}