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