about summary refs log tree commit diff
path: root/pkgs/development/libraries/adns/default.nix
blob: eeb6c07bf11d09e19503217d2ae3aa0b6884465e (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{ stdenv, lib, fetchurl, gnum4, gitUpdater }:

stdenv.mkDerivation rec {
  pname = "adns";
  version = "1.6.1";

  src = fetchurl {
    urls = [
      "https://www.chiark.greenend.org.uk/~ian/adns/ftp/adns-${version}.tar.gz"
      "mirror://gnu/adns/adns-${version}.tar.gz"
    ];
    hash = "sha256-cTizeJt1Br1oP0UdT32FMHepGAO3s12G7GZ/D5zUAc0=";
  };

  nativeBuildInputs = [ gnum4 ];

  configureFlags = lib.optional stdenv.hostPlatform.isStatic "--disable-dynamic";

  preConfigure =
    lib.optionalString stdenv.hostPlatform.isDarwin "sed -i -e 's|-Wl,-soname=$(SHLIBSONAME)||' configure";

  # Autogenerated headers miss interdependencies in Makefile, fail parallel build:
  #  https://debbugs.gnu.org/cgi/bugreport.cgi?bug=51329
  enableParallelBuilding = false;

  # https://www.mail-archive.com/nix-dev@cs.uu.nl/msg01347.html for details.
  doCheck = false;

  postInstall = let suffix = lib.versions.majorMinor version;
  in lib.optionalString stdenv.hostPlatform.isDarwin ''
    install_name_tool -id $out/lib/libadns.so.${suffix} $out/lib/libadns.so.${suffix}
  '';

  # darwin executables fail, but I don't want to fail the 100-500 packages depending on this lib
  doInstallCheck = !stdenv.hostPlatform.isDarwin;
  installCheckPhase = ''
    set -eo pipefail

    for prog in $out/bin/*; do
      $prog --help > /dev/null && echo $(basename $prog) shows usage
    done
  '';

  passthru.updateScript = gitUpdater {
    url = "https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/githttp/adns.git";
    rev-prefix = "adns-";
  };

  meta = with lib; {
    homepage = "http://www.chiark.greenend.org.uk/~ian/adns/";
    description = "Asynchronous DNS Resolver Library";
    license = licenses.lgpl2;

    platforms = platforms.unix;
  };
}