Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / libraries / libnatpmp / default.nix
blob49e89b97344bbda27d2c73752461b8c62e4dc08b
1 { lib
2 , stdenv
3 , fetchurl
4 , fetchpatch
5 , fixDarwinDylibNames
6 }:
8 stdenv.mkDerivation rec {
9   pname = "libnatpmp";
10   version = "20230423";
12   src = fetchurl {
13     url = "https://miniupnp.tuxfamily.org/files/${pname}-${version}.tar.gz";
14     hash = "sha256-BoTtLIQGQ351GaG9IOqDeA24cbOjpddSMRuj6Inb/HA=";
15   };
17   patches = [
18     # install natpmp_declspec.h too, else nothing that uses this library will build
19     (fetchpatch {
20       url = "https://github.com/miniupnp/libnatpmp/commit/5f4a7c65837a56e62c133db33c28cd1ea71db662.patch";
21       hash = "sha256-tvoGFmo5AzUgb40bIs/EzikE0ex1SFzE5peLXhktnbc=";
22     })
23   ];
25   makeFlags = [
26     "INSTALLPREFIX=$(out)"
27     "CC:=$(CC)"
28   ];
30   nativeBuildInputs = lib.optional stdenv.isDarwin fixDarwinDylibNames;
32   postFixup = ''
33     chmod +x $out/lib/*
34   '';
36   meta = with lib; {
37     description = "NAT-PMP client";
38     homepage = "http://miniupnp.free.fr/libnatpmp.html";
39     license = licenses.bsd3;
40     maintainers = with maintainers; [ orivej ];
41     mainProgram = "natpmpc";
42     platforms = platforms.all;
43   };