Merge pull request #132811 from vlaci/fix-pyunbound

pythonPackages.pyunbound: 1.9.3 -> 1.13.1 and fix build
This commit is contained in:
Jörg Thalheim 2021-08-06 06:19:38 +01:00 committed by GitHub
commit e4f36dc7c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,19 +4,21 @@ let
inherit (pythonPackages) python;
in stdenv.mkDerivation rec {
pname = "pyunbound";
version = "1.9.3";
version = "1.13.1";
src = fetchurl {
url = "http://unbound.net/downloads/unbound-${version}.tar.gz";
sha256 = "1ykdy62sgzv33ggkmzwx2h0ifm7hyyxyfkb4zckv7gz4f28xsm8v";
sha256 = "sha256-hQTZe4/FvYlzRcldEW4O4N34yP+ZWQqytL0TJ4yfULg=";
};
buildInputs = [ openssl expat libevent swig python ];
nativeBuildInputs = [ swig ];
patchPhase = ''substituteInPlace Makefile.in \
buildInputs = [ openssl expat libevent python ];
postPatch = ''substituteInPlace Makefile.in \
--replace "\$(DESTDIR)\$(PYTHON_SITE_PKG)" "$out/${python.sitePackages}" \
--replace "\$(LIBTOOL) --mode=install cp _unbound.la" "cp _unbound.la"
'';
'';
preConfigure = "export PYTHON_VERSION=${python.pythonVersion}";
@ -30,18 +32,22 @@ in stdenv.mkDerivation rec {
"--enable-pie"
"--enable-relro-now"
"--with-pyunbound"
"DESTDIR=$out PREFIX="
"DESTDIR=$out"
"PREFIX="
];
preInstall = ''
mkdir -p $out/${python.sitePackages} $out/etc/${pname}
cp .libs/_unbound.so .libs/libunbound.so* $out/${python.sitePackages}
substituteInPlace _unbound.la \
--replace "-L.libs $PWD/libunbound.la" "-L$out/${python.sitePackages}" \
--replace "libdir=\'$PWD/${python.sitePackages}\'" "libdir=\'$out/${python.sitePackages}\'"
--replace "-L.libs $PWD/libunbound.la" "-L$out/${python.sitePackages}"
'';
installFlags = [ "configfile=\${out}/etc/unbound/unbound.conf pyunbound-install lib" ];
installFlags = [
"configfile=\${out}/etc/unbound/unbound.conf"
"pyunbound-install"
"lib"
];
# All we want is the Unbound Python module
postInstall = ''
@ -51,8 +57,11 @@ in stdenv.mkDerivation rec {
$out/bin/unbound-anchor -l | tail --lines=+2 - > $out/etc/${pname}/root.key
# We don't need anything else
rm -fR $out/bin $out/share $out/include $out/etc/unbound
patchelf --replace-needed libunbound.so.2 $out/${python.sitePackages}/libunbound.so.2 $out/${python.sitePackages}/_unbound.so
'';
''
# patchelf is only available on Linux and no patching is needed on darwin
+ lib.optionalString stdenv.isLinux ''
patchelf --replace-needed libunbound.so.8 $out/${python.sitePackages}/libunbound.so.8 $out/${python.sitePackages}/_unbound.so
'';
meta = with lib; {
description = "Python library for Unbound, the validating, recursive, and caching DNS resolver";
@ -60,6 +69,5 @@ in stdenv.mkDerivation rec {
homepage = "http://www.unbound.net";
maintainers = with maintainers; [ leenaars ];
platforms = lib.platforms.unix;
broken = true;
};
}