1{ stdenv, fetchurl, fetchpatch, ncurses ? null, perl ? null, lib }:
2
3stdenv.mkDerivation rec {
4 pname = "liboping";
5 version = "1.10.0";
6
7 src = fetchurl {
8 url = "https://noping.cc/files/${pname}-${version}.tar.bz2";
9 sha256 = "1n2wkmvw6n80ybdwkjq8ka43z2x8mvxq49byv61b52iyz69slf7b";
10 };
11
12 patches = [
13 # Add support for ncurses-6.3. A backport of patch pending upstream
14 # inclusion: https://github.com/octo/liboping/pull/61
15 ./ncurses-6.3.patch
16
17 # Pull pending fix for format arguments mismatch:
18 # https://github.com/octo/liboping/pull/60
19 (fetchpatch {
20 name = "format-args.patch";
21 url = "https://github.com/octo/liboping/commit/7a50e33f2a686564aa43e4920141e6f64e042df1.patch";
22 sha256 = "118fl3k84m3iqwfp49g5qil4lw1gcznzmyxnfna0h7za2nm50cxw";
23 })
24 ];
25
26 env.NIX_CFLAGS_COMPILE = lib.optionalString
27 stdenv.cc.isGNU "-Wno-error=format-truncation";
28
29 buildInputs = [ ncurses perl ];
30
31 configureFlags = lib.optional (perl == null) "--with-perl-bindings=no";
32
33 meta = with lib; {
34 description = "C library to generate ICMP echo requests (a.k.a. ping packets)";
35 longDescription = ''
36 liboping is a C library to generate ICMP echo requests, better known as
37 "ping packets". It is intended for use in network monitoring applications
38 or applications that would otherwise need to fork ping(1) frequently.
39 Included is a sample application, called oping, which demonstrates the
40 library's abilities.
41 '';
42 homepage = "http://noping.cc/";
43 license = licenses.lgpl21;
44 platforms = platforms.unix;
45 maintainers = [ maintainers.bjornfor ];
46 };
47}