Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at release-19.03 88 lines 3.0 kB view raw
1{ stdenv, fetchFromGitHub, fetchpatch 2, libxslt, docbook_xsl, docbook_xml_dtd_44 3, libcap, nettle, libidn2, openssl 4}: 5 6with stdenv.lib; 7 8let 9 time = "20180629"; 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 }; 17in stdenv.mkDerivation { 18 name = "iputils-${time}"; 19 20 src = fetchFromGitHub { 21 owner = "iputils"; 22 repo = "iputils"; 23 rev = "s${time}"; 24 sha256 = "19rpl48pjgmyqlm4h7sml5gy7yg4cxciadxcs24q1zj40c05jls0"; 25 }; 26 27 patches = [ 28 (fetchpatch { 29 name = "dont-hardcode-the-location-of-xsltproc.patch"; 30 url = "https://github.com/iputils/iputils/commit/d0ff83e87ea9064d9215a18e93076b85f0f9e828.patch"; 31 sha256 = "05wrwf0bfmax69bsgzh3b40n7rvyzw097j8z5ix0xsg0kciygjvx"; 32 }) 33 (fetchpatch { 34 name = "add-missing-idn-declarations.patch"; 35 url = "https://github.com/iputils/iputils/commit/5007d7067918fb3d950d34c01d059e5222db679a.patch"; 36 sha256 = "0dhgxdhjcbb2q6snm3mjp38l066knykmrx4k8rn167cizn7akpdx"; 37 }) 38 (fetchpatch { 39 name = "fix-ping-idn.patch"; 40 url = "https://github.com/iputils/iputils/commit/25899e849aa3abc1ad29ebf0b830262a859eaed5.patch"; 41 sha256 = "1bqjcdjjnc2j6indcli7s7gbbhkcaligvh94asixfrmjzkbn533n"; 42 }) 43 ]; 44 45 prePatch = '' 46 substituteInPlace doc/custom-man.xsl \ 47 --replace "http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl" "${docbook_xsl}/xml/xsl/docbook/manpages/docbook.xsl" 48 for xmlFile in doc/*.xml; do 49 substituteInPlace $xmlFile \ 50 --replace "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" "${docbook_xml_dtd_44}/xml/dtd/docbook/docbookx.dtd" 51 done 52 ''; 53 54 # Disable idn usage w/musl: https://github.com/iputils/iputils/pull/111 55 makeFlags = optional stdenv.hostPlatform.isMusl "USE_IDN=no"; 56 57 nativeBuildInputs = [ libxslt.bin ]; 58 buildInputs = [ libcap nettle ] 59 ++ optional (!stdenv.hostPlatform.isMusl) libidn2 60 ++ optional withNinfod openssl; # TODO: Build with nettle 61 62 buildFlags = "man all" + optionalString withNinfod " ninfod"; 63 64 installPhase = '' 65 mkdir -p $out/bin 66 mkdir -p $out/share/man/man8 67 68 for tool in arping clockdiff ping rarpd rdisc tftpd tracepath traceroute6; do 69 cp $tool $out/bin/ 70 cp doc/$tool.8 $out/share/man/man8/ 71 done 72 73 # TODO: Requires kernel module pg3 74 cp ipg $out/bin/ 75 cp doc/pg3.8 $out/share/man/man8/ 76 '' + optionalString withNinfod '' 77 cp ninfod/ninfod $out/bin/ 78 cp doc/ninfod.8 $out/share/man/man8/ 79 ''; 80 81 meta = { 82 homepage = https://github.com/iputils/iputils; 83 description = "A set of small useful utilities for Linux networking"; 84 license = with licenses; [ gpl2Plus bsd3 sunAsIsLicense ]; 85 platforms = platforms.linux; 86 maintainers = with maintainers; [ primeos lheckemann ]; 87 }; 88}