From 92b4e8324556fef6350fa29daa64cdde6b9121ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Vask=C3=B3?= Date: Thu, 5 Aug 2021 21:15:02 +0200 Subject: [PATCH 1/4] pythonPackages.pyunbound: fix build `_unbound.so` references `libunbound.so.8` in its RPATH --- pkgs/tools/networking/unbound/python.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkgs/tools/networking/unbound/python.nix b/pkgs/tools/networking/unbound/python.nix index fcfd93be4d67..77c1e02c045c 100644 --- a/pkgs/tools/networking/unbound/python.nix +++ b/pkgs/tools/networking/unbound/python.nix @@ -51,7 +51,7 @@ 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 --replace-needed libunbound.so.8 $out/${python.sitePackages}/libunbound.so.8 $out/${python.sitePackages}/_unbound.so ''; meta = with lib; { @@ -60,6 +60,5 @@ in stdenv.mkDerivation rec { homepage = "http://www.unbound.net"; maintainers = with maintainers; [ leenaars ]; platforms = lib.platforms.unix; - broken = true; }; } From 5fe5522a675df0d4792580be48da9e4485b291ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Vask=C3=B3?= Date: Thu, 5 Aug 2021 21:20:55 +0200 Subject: [PATCH 2/4] pythonPackages.pyunbound: 1.9.3 -> 1.13.1 Updating to get it in-line with `unbound` --- pkgs/tools/networking/unbound/python.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/networking/unbound/python.nix b/pkgs/tools/networking/unbound/python.nix index 77c1e02c045c..19d70a71ee7a 100644 --- a/pkgs/tools/networking/unbound/python.nix +++ b/pkgs/tools/networking/unbound/python.nix @@ -4,11 +4,11 @@ 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 ]; From fcff510efb22b6cc8017c410df87fcfb3e8e4d8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Vask=C3=B3?= Date: Thu, 5 Aug 2021 23:32:19 +0200 Subject: [PATCH 3/4] pythonPackages.pyunbound: fixing `nixpkgs-hammering` suggestions - `swig` is a build tool so it likely goes to `nativeBuildInputs`, not `buildInputs` - `patchPhase` should not be overridden, use `postPatch` instead - `configureFlags` and `installFlags` cannot contain spaces, break-up arguments to reflect that they are indeed without spaces - `substituteStream()`: WARNING: pattern `libdir='/build/unbound-1.13.1/lib/python3.9/site-packages'` doesn't match anything in file `_unbound.la` Also checked with `strings`, the correct path is present in the binary --- pkgs/tools/networking/unbound/python.nix | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/pkgs/tools/networking/unbound/python.nix b/pkgs/tools/networking/unbound/python.nix index 19d70a71ee7a..a453456daddf 100644 --- a/pkgs/tools/networking/unbound/python.nix +++ b/pkgs/tools/networking/unbound/python.nix @@ -11,12 +11,14 @@ in stdenv.mkDerivation rec { 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 = '' @@ -52,7 +58,7 @@ in stdenv.mkDerivation rec { # We don't need anything else rm -fR $out/bin $out/share $out/include $out/etc/unbound 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"; From 86621f1fe25f6337cf34edafa4d031075a4c5a80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Vask=C3=B3?= Date: Fri, 6 Aug 2021 00:03:58 +0200 Subject: [PATCH 4/4] pythonPackages.pyunbound: `patchElf` only works on `linux` platform --- pkgs/tools/networking/unbound/python.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/tools/networking/unbound/python.nix b/pkgs/tools/networking/unbound/python.nix index a453456daddf..a141d85b7fce 100644 --- a/pkgs/tools/networking/unbound/python.nix +++ b/pkgs/tools/networking/unbound/python.nix @@ -57,6 +57,9 @@ 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 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 '';