1{
2 fetchFromGitHub,
3 automake,
4 autoconf,
5 which,
6 pkg-config,
7 libtool,
8 lib,
9 stdenv,
10 gnutls,
11 asciidoc,
12 doxygen,
13 withTLS ? true,
14 withDocs ? true,
15}:
16stdenv.mkDerivation rec {
17 pname = "libcoap";
18 version = "4.3.5";
19 src = fetchFromGitHub {
20 repo = "libcoap";
21 owner = "obgm";
22 rev = "v${version}";
23 fetchSubmodules = true;
24 hash = "sha256-QNrsR6VarZ2favvTZ9pMhVafwF2fOjYLKcyNqZyUl6s=";
25 };
26 nativeBuildInputs = [
27 automake
28 autoconf
29 which
30 libtool
31 pkg-config
32 ]
33 ++ lib.optional withTLS gnutls
34 ++ lib.optionals withDocs [
35 doxygen
36 asciidoc
37 ];
38 preConfigure = "./autogen.sh";
39 configureFlags = [
40 "--disable-shared"
41 ]
42 ++ lib.optional (!withDocs) "--disable-documentation"
43 ++ lib.optional withTLS "--enable-dtls";
44 meta = with lib; {
45 homepage = "https://github.com/obgm/libcoap";
46 description = "CoAP (RFC 7252) implementation in C";
47 platforms = platforms.unix;
48 license = licenses.bsd2;
49 maintainers = [ maintainers.kmein ];
50 };
51}