summary refs log tree commit diff
path: root/pkgs/os-specific/linux/iputils
diff options
context:
space:
mode:
authorMichael Weiss <dev.primeos@gmail.com>2018-09-02 12:40:46 +0200
committerMichael Weiss <dev.primeos@gmail.com>2018-09-02 15:56:35 +0200
commit1ef5b1780fdc02e4da1c98cec4612e4fdaddca97 (patch)
tree17b653ceffc614b6a6ea03ff18baf45d39e6a699 /pkgs/os-specific/linux/iputils
parenta9629064d8c8b24c442f9db7fd451ede53d387b7 (diff)
downloadnixpkgs-1ef5b1780fdc02e4da1c98cec4612e4fdaddca97.tar
nixpkgs-1ef5b1780fdc02e4da1c98cec4612e4fdaddca97.tar.gz
nixpkgs-1ef5b1780fdc02e4da1c98cec4612e4fdaddca97.tar.bz2
nixpkgs-1ef5b1780fdc02e4da1c98cec4612e4fdaddca97.tar.lz
nixpkgs-1ef5b1780fdc02e4da1c98cec4612e4fdaddca97.tar.xz
nixpkgs-1ef5b1780fdc02e4da1c98cec4612e4fdaddca97.tar.zst
nixpkgs-1ef5b1780fdc02e4da1c98cec4612e4fdaddca97.zip
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)
Diffstat (limited to 'pkgs/os-specific/linux/iputils')
-rw-r--r--pkgs/os-specific/linux/iputils/default.nix59
1 files changed, 34 insertions, 25 deletions
diff --git a/pkgs/os-specific/linux/iputils/default.nix b/pkgs/os-specific/linux/iputils/default.nix
index ce70cc37d69..e66dbe41d01 100644
--- a/pkgs/os-specific/linux/iputils/default.nix
+++ b/pkgs/os-specific/linux/iputils/default.nix
@@ -1,12 +1,20 @@
 { stdenv, fetchFromGitHub, fetchpatch
 , libxslt, docbook_xsl, docbook_xml_dtd_44
-, libcap, nettle, libidn2
+, libcap, nettle, libidn2, openssl
 }:
 
+with stdenv.lib;
+
 let
   time = "20180629";
-in
-stdenv.mkDerivation rec {
+  # ninfod probably could build on cross, but the Makefile doesn't pass --host
+  # etc to the sub configure...
+  withNinfod = stdenv.hostPlatform == stdenv.buildPlatform;
+  sunAsIsLicense = {
+    fullName = "AS-IS, SUN MICROSYSTEMS license";
+    url = "https://github.com/iputils/iputils/blob/s${time}/rdisc.c";
+  };
+in stdenv.mkDerivation {
   name = "iputils-${time}";
 
   src = fetchFromGitHub {
@@ -17,7 +25,7 @@ stdenv.mkDerivation rec {
   };
 
   patches = [
-   (fetchpatch {
+    (fetchpatch {
       name = "dont-hardcode-the-location-of-xsltproc.patch";
       url = "https://github.com/iputils/iputils/commit/d0ff83e87ea9064d9215a18e93076b85f0f9e828.patch";
       sha256 = "05wrwf0bfmax69bsgzh3b40n7rvyzw097j8z5ix0xsg0kciygjvx";
@@ -34,35 +42,36 @@ stdenv.mkDerivation rec {
   '';
 
   # Disable idn usage w/musl: https://github.com/iputils/iputils/pull/111
-  makeFlags = [ "USE_GNUTLS=no" ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl "USE_IDN=no";
+  makeFlags = optional stdenv.hostPlatform.isMusl "USE_IDN=no";
 
   nativeBuildInputs = [ libxslt.bin ];
-  buildInputs = [
-    libcap nettle
-  ] ++ stdenv.lib.optional (!stdenv.hostPlatform.isMusl) libidn2;
+  buildInputs = [ libcap nettle ]
+    ++ optional (!stdenv.hostPlatform.isMusl) libidn2
+    ++ optional withNinfod openssl; # TODO: Build with nettle
 
-  # ninfod probably could build on cross, but the Makefile doesn't pass --host etc to the sub configure...
-  buildFlags = "man all" + stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) " ninfod";
+  buildFlags = "man all" + optionalString withNinfod " ninfod";
 
-  installPhase =
-    ''
-      mkdir -p $out/bin
-      cp -p arping clockdiff ping rarpd rdisc tftpd tracepath traceroute6 $out/bin/
-      if [ -x ninfod/ninfod ]; then
-        cp -p ninfod/ninfod $out/bin
-      fi
+  installPhase = ''
+    mkdir -p $out/bin
+    mkdir -p $out/share/man/man8
 
-      mkdir -p $out/share/man/man8
-      cd doc
-      cp -p \
-        arping.8 clockdiff.8 ninfod.8 pg3.8 ping.8 rarpd.8 rdisc.8 tftpd.8 tracepath.8 traceroute6.8 \
-        $out/share/man/man8
-    '';
+    for tool in arping clockdiff ping rarpd rdisc tftpd tracepath traceroute6; do
+      cp $tool $out/bin/
+      cp doc/$tool.8 $out/share/man/man8/
+    done
+
+    # TODO: Requires kernel module pg3
+    cp ipg $out/bin/
+    cp doc/pg3.8 $out/share/man/man8/
+  '' + optionalString withNinfod ''
+    cp ninfod/ninfod $out/bin/
+    cp doc/ninfod.8 $out/share/man/man8/
+  '';
 
-  meta = with stdenv.lib; {
+  meta = {
     homepage = https://github.com/iputils/iputils;
     description = "A set of small useful utilities for Linux networking";
-    license = with licenses; [ gpl2Plus bsd3 ]; # TODO: AS-IS, SUN MICROSYSTEMS license
+    license = with licenses; [ gpl2Plus bsd3 sunAsIsLicense ];
     platforms = platforms.linux;
     maintainers = with maintainers; [ primeos lheckemann ];
   };