nixpkgs/pkgs/development/libraries/adns/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

57 lines
1.7 KiB
Nix

{ 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;
};
}