1{ lib, stdenv, fetchurl, perlPackages, gettext, libintl }:
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 pname = "help2man";
10 version = "1.49.3";
11
12 src = fetchurl {
13 url = "mirror://gnu/help2man/help2man-${version}.tar.xz";
14 sha256 = "sha256-TX5P3vLspq/geiaCFRzqeHgeCk6PliIULZ9wwIOi/U8=";
15 };
16
17 strictDeps = true;
18
19 enableParallelBuilding = true;
20
21 nativeBuildInputs = [ gettext perlPackages.perl perlPackages.LocaleGettext ];
22 buildInputs = [ perlPackages.LocaleGettext libintl ];
23
24 configureFlags = [
25 "--enable-nls"
26 ];
27
28 doCheck = false; # target `check' is missing
29
30 patches = lib.optional stdenv.hostPlatform.isCygwin ./1.40.4-cygwin-nls.patch;
31
32 # We don't use makeWrapper here because it uses substitutions our
33 # bootstrap shell can't handle.
34 postInstall = ''
35 mv $out/bin/help2man $out/bin/.help2man-wrapped
36 cat > $out/bin/help2man <<EOF
37 #! $SHELL -e
38 export PERL5LIB=\''${PERL5LIB:+:}${perlPackages.LocaleGettext}/${perlPackages.perl.libPrefix}
39 ${lib.optionalString stdenv.hostPlatform.isCygwin ''export PATH=\''${PATH:+:}${gettext}/bin''}
40 exec -a \$0 $out/bin/.help2man-wrapped "\$@"
41 EOF
42 chmod +x $out/bin/help2man
43 '';
44
45 meta = with lib; {
46 description = "Generate man pages from `--help' output";
47 mainProgram = "help2man";
48 longDescription = ''
49 help2man produces simple manual pages from the ‘--help’ and ‘--version’ output of other commands.
50 '';
51 homepage = "https://www.gnu.org/software/help2man/";
52 license = licenses.gpl3Plus;
53 platforms = platforms.all;
54 maintainers = with maintainers; [ pSub ];
55 };
56}