summary refs log tree commit diff
path: root/pkgs/tools/networking/miniupnpc/default.nix
blob: e3a97d1b4a6d39eec68b1a3ad6c54f92e00d4f50 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{ lib
, stdenv
, fetchurl
, which
, cctools
}:

stdenv.mkDerivation rec {
  pname = "miniupnpc";
  version = "2.2.4";

  src = fetchurl {
    url = "https://miniupnp.tuxfamily.org/files/${pname}-${version}.tar.gz";
    sha256 = "0jrc84lkc7xb53rb8dbswxrxj21ndj1iiclmk3r9wkp6xm55w6j8";
  };

  nativeBuildInputs = lib.optionals stdenv.isDarwin [ which cctools ];

  patches = lib.optional stdenv.isFreeBSD ./freebsd.patch;

  doCheck = !stdenv.isFreeBSD;

  makeFlags = [ "PREFIX=$(out)" "INSTALLPREFIX=$(out)" ];

  postInstall = ''
    chmod +x "$out"/lib/libminiupnpc${stdenv.hostPlatform.extensions.sharedLibrary}
  '';

  meta = with lib; {
    homepage = "https://miniupnp.tuxfamily.org/";
    description = "A client that implements the UPnP Internet Gateway Device (IGD) specification";
    platforms = with platforms; linux ++ freebsd ++ darwin;
    license = licenses.bsd3;
  };
}