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