nixpkgs/pkgs/development/libraries/udns/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.6 KiB
Nix

{ lib, stdenv, fetchurl }:
# this expression is mostly based on debian's packaging
# https://tracker.debian.org/media/packages/u/udns/rules-0.6-1
stdenv.mkDerivation rec {
pname = "udns";
version = "0.6";
configurePhase = "./configure --enable-ipv6";
buildPhase = "make staticlib sharedlib rblcheck_s dnsget_s";
src = fetchurl {
url = "http://www.corpit.ru/mjt/udns/${pname}-${version}.tar.gz";
sha256 = "sha256-aWotDVGNqYXZdaZeEdFm8/V829HUI3aguFMH9JYBxug=";
};
# udns uses a very custom build and hardcodes a .so name in a few places.
# Instead of fighting with it to apply the standard dylib script, change
# the right place in the Makefile itself.
postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace Makefile.in \
--replace --soname, -install_name,$out/lib/
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin
mkdir -p $out/include
mkdir -p $out/lib
mkdir -p $out/share/man/man1
mkdir -p $out/share/man/man3
cp dnsget_s $out/bin/dnsget
cp rblcheck_s $out/bin/rblcheck
cp udns.h $out/include/
cp libudns.a $out/lib/
cp libudns.so.0 $out/lib/
ln -rs $out/lib/libudns.so.0 $out/lib/libudns.so
cp dnsget.1 rblcheck.1 $out/share/man/man1
cp udns.3 $out/share/man/man3
runHook postInstall
'';
# keep man3
outputDevdoc = "out";
meta = with lib; {
homepage = "http://www.corpit.ru/mjt/udns.html";
description = "Async-capable DNS stub resolver library";
license = licenses.lgpl21Plus;
maintainers = [ maintainers.womfoo ];
platforms = platforms.unix;
};
}