1{ lib, stdenv, fetchurl, openssl, perl, which, dns-root-data }:
2
3stdenv.mkDerivation rec {
4 pname = "ldns";
5 version = "1.8.3";
6
7 src = fetchurl {
8 url = "https://www.nlnetlabs.nl/downloads/ldns/${pname}-${version}.tar.gz";
9 sha256 = "sha256-w/ct0QNrKQfjpW5qz537LlUSVrPBu9l4eULe7rcOeGA=";
10 };
11
12 postPatch = ''
13 patchShebangs doc/doxyparse.pl
14 '';
15
16 outputs = [ "out" "dev" "man" "examples" ];
17
18 nativeBuildInputs = [ perl ];
19 buildInputs = [ openssl ];
20
21 configureFlags = [
22 "--with-ssl=${openssl.dev}"
23 "--with-trust-anchor=${dns-root-data}/root.key"
24 "--with-drill"
25 "--disable-gost"
26 "--with-examples"
27 ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
28 "ac_cv_func_malloc_0_nonnull=yes"
29 "ac_cv_func_realloc_0_nonnull=yes"
30 ];
31
32 nativeCheckInputs = [ which ];
33 doCheck = false; # fails. missing some files
34
35 postInstall = ''
36 # Only 'drill' stays in $out
37 # the rest are examples:
38 moveToOutput "bin/ldns*" "$examples"
39 # with exception of ldns-config, which goes to $dev:
40 moveToOutput "bin/ldns-config" "$dev"
41 '';
42
43 meta = with lib; {
44 description = "Library with the aim of simplifying DNS programming in C";
45 homepage = "http://www.nlnetlabs.nl/projects/ldns/";
46 license = licenses.bsd3;
47 maintainers = with maintainers; [ dtzWill ];
48 mainProgram = "drill";
49 platforms = platforms.unix;
50 };
51}