iputils: Code refactoring and fixes

- Fix the cross-compiling check and add openssl for ninfod
- Add "AS-IS, SUN MICROSYSTEMS license" to meta.licenses
- Install igp (see man pg3)

+34 -25
+34 -25
pkgs/os-specific/linux/iputils/default.nix
··· 1 1 { stdenv, fetchFromGitHub, fetchpatch 2 2 , libxslt, docbook_xsl, docbook_xml_dtd_44 3 - , libcap, nettle, libidn2 3 + , libcap, nettle, libidn2, openssl 4 4 }: 5 + 6 + with stdenv.lib; 5 7 6 8 let 7 9 time = "20180629"; 8 - in 9 - stdenv.mkDerivation rec { 10 + # ninfod probably could build on cross, but the Makefile doesn't pass --host 11 + # etc to the sub configure... 12 + withNinfod = stdenv.hostPlatform == stdenv.buildPlatform; 13 + sunAsIsLicense = { 14 + fullName = "AS-IS, SUN MICROSYSTEMS license"; 15 + url = "https://github.com/iputils/iputils/blob/s${time}/rdisc.c"; 16 + }; 17 + in stdenv.mkDerivation { 10 18 name = "iputils-${time}"; 11 19 12 20 src = fetchFromGitHub { ··· 17 25 }; 18 26 19 27 patches = [ 20 - (fetchpatch { 28 + (fetchpatch { 21 29 name = "dont-hardcode-the-location-of-xsltproc.patch"; 22 30 url = "https://github.com/iputils/iputils/commit/d0ff83e87ea9064d9215a18e93076b85f0f9e828.patch"; 23 31 sha256 = "05wrwf0bfmax69bsgzh3b40n7rvyzw097j8z5ix0xsg0kciygjvx"; ··· 34 42 ''; 35 43 36 44 # Disable idn usage w/musl: https://github.com/iputils/iputils/pull/111 37 - makeFlags = [ "USE_GNUTLS=no" ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl "USE_IDN=no"; 45 + makeFlags = optional stdenv.hostPlatform.isMusl "USE_IDN=no"; 38 46 39 47 nativeBuildInputs = [ libxslt.bin ]; 40 - buildInputs = [ 41 - libcap nettle 42 - ] ++ stdenv.lib.optional (!stdenv.hostPlatform.isMusl) libidn2; 48 + buildInputs = [ libcap nettle ] 49 + ++ optional (!stdenv.hostPlatform.isMusl) libidn2 50 + ++ optional withNinfod openssl; # TODO: Build with nettle 43 51 44 - # ninfod probably could build on cross, but the Makefile doesn't pass --host etc to the sub configure... 45 - buildFlags = "man all" + stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) " ninfod"; 52 + buildFlags = "man all" + optionalString withNinfod " ninfod"; 53 + 54 + installPhase = '' 55 + mkdir -p $out/bin 56 + mkdir -p $out/share/man/man8 46 57 47 - installPhase = 48 - '' 49 - mkdir -p $out/bin 50 - cp -p arping clockdiff ping rarpd rdisc tftpd tracepath traceroute6 $out/bin/ 51 - if [ -x ninfod/ninfod ]; then 52 - cp -p ninfod/ninfod $out/bin 53 - fi 58 + for tool in arping clockdiff ping rarpd rdisc tftpd tracepath traceroute6; do 59 + cp $tool $out/bin/ 60 + cp doc/$tool.8 $out/share/man/man8/ 61 + done 54 62 55 - mkdir -p $out/share/man/man8 56 - cd doc 57 - cp -p \ 58 - arping.8 clockdiff.8 ninfod.8 pg3.8 ping.8 rarpd.8 rdisc.8 tftpd.8 tracepath.8 traceroute6.8 \ 59 - $out/share/man/man8 60 - ''; 63 + # TODO: Requires kernel module pg3 64 + cp ipg $out/bin/ 65 + cp doc/pg3.8 $out/share/man/man8/ 66 + '' + optionalString withNinfod '' 67 + cp ninfod/ninfod $out/bin/ 68 + cp doc/ninfod.8 $out/share/man/man8/ 69 + ''; 61 70 62 - meta = with stdenv.lib; { 71 + meta = { 63 72 homepage = https://github.com/iputils/iputils; 64 73 description = "A set of small useful utilities for Linux networking"; 65 - license = with licenses; [ gpl2Plus bsd3 ]; # TODO: AS-IS, SUN MICROSYSTEMS license 74 + license = with licenses; [ gpl2Plus bsd3 sunAsIsLicense ]; 66 75 platforms = platforms.linux; 67 76 maintainers = with maintainers; [ primeos lheckemann ]; 68 77 };