summary refs log tree commit diff
path: root/pkgs/tools/networking/unbound
diff options
context:
space:
mode:
authorLászló Vaskó <laszlo.vasko@outlook.com>2021-08-05 23:32:19 +0200
committerLászló Vaskó <laszlo.vasko@outlook.com>2021-08-05 23:58:36 +0200
commitfcff510efb22b6cc8017c410df87fcfb3e8e4d8a (patch)
treebbd48c917082283639a4c3ce689fd3c41cfab8ce /pkgs/tools/networking/unbound
parent5fe5522a675df0d4792580be48da9e4485b291ee (diff)
downloadnixpkgs-fcff510efb22b6cc8017c410df87fcfb3e8e4d8a.tar
nixpkgs-fcff510efb22b6cc8017c410df87fcfb3e8e4d8a.tar.gz
nixpkgs-fcff510efb22b6cc8017c410df87fcfb3e8e4d8a.tar.bz2
nixpkgs-fcff510efb22b6cc8017c410df87fcfb3e8e4d8a.tar.lz
nixpkgs-fcff510efb22b6cc8017c410df87fcfb3e8e4d8a.tar.xz
nixpkgs-fcff510efb22b6cc8017c410df87fcfb3e8e4d8a.tar.zst
nixpkgs-fcff510efb22b6cc8017c410df87fcfb3e8e4d8a.zip
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
Diffstat (limited to 'pkgs/tools/networking/unbound')
-rw-r--r--pkgs/tools/networking/unbound/python.nix22
1 files changed, 14 insertions, 8 deletions
diff --git a/pkgs/tools/networking/unbound/python.nix b/pkgs/tools/networking/unbound/python.nix
index 19d70a71ee7..a453456dadd 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";