Merge pull request #146822 from risicle/ris-libasyncns-darwin-fix

libasyncns: fix build for darwin
This commit is contained in:
Dmitry Kalinkin 2021-11-20 23:41:44 -05:00 committed by GitHub
commit 296032dd5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 2 deletions

View file

@ -9,6 +9,11 @@ stdenv.mkDerivation rec {
sha256 = "0x5b6lcic4cd7q0bx00x93kvpyzl7n2abbgvqbrlzrfb8vknc6jg";
};
postPatch = lib.optionalString stdenv.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"

View file

@ -1,5 +1,10 @@
{ lib, buildPythonPackage, fetchurl
, libasyncns, pkg-config }:
{ lib
, stdenv
, buildPythonPackage
, fetchurl
, libasyncns
, pkg-config
}:
buildPythonPackage rec {
pname = "libasyncns-python";
@ -12,10 +17,17 @@ buildPythonPackage rec {
patches = [ ./libasyncns-fix-res-consts.patch ];
postPatch = lib.optionalString stdenv.isDarwin ''
substituteInPlace resquery.c \
--replace '<arpa/nameser.h>' '<arpa/nameser_compat.h>'
'';
buildInputs = [ libasyncns ];
nativeBuildInputs = [ pkg-config ];
doCheck = false; # requires network access
pythonImportsCheck = [ "libasyncns" ];
meta = with lib; {
description = "libasyncns-python is a python binding for the asynchronous name service query library";
license = licenses.lgpl21;