1{ lib, fetchurl, perlPackages, ncurses, lynx, makeWrapper }:
2
3perlPackages.buildPerlPackage {
4 pname = "wml";
5 version = "2.0.11";
6
7 src = fetchurl {
8 url = "http://thewml.org/distrib/wml-2.0.11.tar.gz";
9 sha256 = "0jjxpq91x7y2mgixz7ghqp01m24qa37wl3zz515rrzv7x8cyy4cf";
10 };
11
12 setOutputFlags = false;
13
14 # Getting lots of Non-ASCII character errors from pod2man.
15 # Inserting =encoding utf8 before the first =head occurrence.
16 # Wasn't able to fix mp4h.
17 preConfigure = ''
18 touch Makefile.PL
19 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
20 sed -i '0,/^=head/{s/^=head/=encoding utf8\n=head/}' $i
21 done
22 sed -i 's/ doc / /g' wml_backend/p2_mp4h/Makefile.in
23 sed -i '/p2_mp4h\/doc/d' Makefile.in
24 '';
25
26 nativeBuildInputs = [ makeWrapper ];
27 buildInputs = with perlPackages;
28 [ perl TermReadKey GD BitVector ncurses lynx ImageSize ];
29
30 patches = [ ./redhat-with-thr.patch ./dynaloader.patch ./no_bitvector.patch ];
31
32 # Workaround build failure on -fno-common toolchains:
33 # ld: iselect_browse.o:(.bss+0x2020): multiple definition of `Line'; iselect_main.o:(.bss+0x100000): first defined here
34 env.NIX_CFLAGS_COMPILE = "-fcommon";
35
36 hardeningDisable = [ "format" ];
37
38 postPatch = ''
39 substituteInPlace wml_frontend/wml.src \
40 --replace "File::PathConvert::realpath" "Cwd::realpath" \
41 --replace "File::PathConvert::abs2rel" "File::Spec->abs2rel" \
42 --replace "File::PathConvert" "File::Spec"
43
44 for i in wml_include/des/imgbg.src wml_include/des/imgdot.src; do
45 substituteInPlace $i \
46 --replace "WML::GD" "GD"
47 done
48
49 rm wml_test/t/11-wmk.t
50 '';
51
52 preFixup = ''
53 wrapProgram $out/bin/wml \
54 --set PERL5LIB ${with perlPackages; makePerlPath [
55 BitVector TermReadKey ImageSize
56 ]}
57 '';
58
59 enableParallelBuilding = false;
60
61 installTargets = [ "install" ];
62
63 meta = with lib; {
64 homepage = "https://www.shlomifish.org/open-source/projects/website-meta-language/";
65 description = "Off-line HTML generation toolkit for Unix";
66 license = licenses.gpl2;
67 platforms = platforms.linux;
68 };
69}