1{ stdenv, fetchurl, perlPackages, gettext }:
2
3# Note: this package is used for bootstrapping fetchurl, and thus
4# cannot use fetchpatch! All mutable patches (generated by GitHub or
5# cgit) that are needed here should be included directly in Nixpkgs as
6# files.
7
8stdenv.mkDerivation rec {
9 name = "help2man-1.47.16";
10
11 src = fetchurl {
12 url = "mirror://gnu/help2man/${name}.tar.xz";
13 sha256 = "1x586h7wvripcay35kdh2kvydx84y8yy93ffjah2rqw6bc65iy1y";
14 };
15
16 nativeBuildInputs = [ gettext perlPackages.LocaleGettext ];
17 buildInputs = [ perlPackages.perl perlPackages.LocaleGettext ];
18
19 doCheck = false; # target `check' is missing
20
21 patches = if stdenv.hostPlatform.isCygwin then [ ./1.40.4-cygwin-nls.patch ] else null;
22
23 # We don't use makeWrapper here because it uses substitutions our
24 # bootstrap shell can't handle.
25 postInstall = ''
26 mv $out/bin/help2man $out/bin/.help2man-wrapped
27 cat > $out/bin/help2man <<EOF
28 #! $SHELL -e
29 export PERL5LIB=\''${PERL5LIB:+:}${perlPackages.LocaleGettext}/${perlPackages.perl.libPrefix}
30 ${stdenv.lib.optionalString stdenv.hostPlatform.isCygwin
31 ''export PATH=\''${PATH:+:}${gettext}/bin''}
32 exec -a \$0 $out/bin/.help2man-wrapped "\$@"
33 EOF
34 chmod +x $out/bin/help2man
35 '';
36
37 meta = with stdenv.lib; {
38 description = "Generate man pages from `--help' output";
39
40 longDescription =
41 '' help2man produces simple manual pages from the ‘--help’ and
42 ‘--version’ output of other commands.
43 '';
44
45 homepage = "https://www.gnu.org/software/help2man/";
46
47 license = licenses.gpl3Plus;
48 platforms = platforms.all;
49 maintainers = with maintainers; [ pSub ];
50 };
51}