mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-24 22:04:20 +00:00
e0464e4788
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" ```
29 lines
874 B
Nix
29 lines
874 B
Nix
{ lib, stdenv, fetchurl }:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "libasyncns";
|
|
version = "0.8";
|
|
|
|
src = fetchurl {
|
|
url = "http://0pointer.de/lennart/projects/libasyncns/${pname}-${version}.tar.gz";
|
|
sha256 = "0x5b6lcic4cd7q0bx00x93kvpyzl7n2abbgvqbrlzrfb8vknc6jg";
|
|
};
|
|
|
|
postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
|
|
substituteInPlace libasyncns/asyncns.c \
|
|
--replace '<arpa/nameser.h>' '<arpa/nameser_compat.h>'
|
|
'';
|
|
|
|
configureFlags = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
|
"ac_cv_func_malloc_0_nonnull=yes"
|
|
"ac_cv_func_realloc_0_nonnull=yes"
|
|
];
|
|
|
|
meta = with lib; {
|
|
homepage = "http://0pointer.de/lennart/projects/libasyncns/";
|
|
description = "C library for Linux/Unix for executing name service queries asynchronously";
|
|
license = licenses.lgpl21;
|
|
platforms = platforms.unix;
|
|
};
|
|
}
|