From d81076b0c3226b26d36c6cd671ba789f89a1dc72 Mon Sep 17 00:00:00 2001 From: Sean Link Date: Fri, 15 Dec 2023 14:16:36 -0700 Subject: [PATCH] unbound: add mingw32 hostPlatform build support --- pkgs/tools/networking/unbound/default.nix | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pkgs/tools/networking/unbound/default.nix b/pkgs/tools/networking/unbound/default.nix index d71353658e56..d2e657e4e13f 100644 --- a/pkgs/tools/networking/unbound/default.nix +++ b/pkgs/tools/networking/unbound/default.nix @@ -41,6 +41,8 @@ # enable support for python plugins in unbound: note this is distinct from pyunbound # see https://unbound.docs.nlnetlabs.nl/en/latest/developer/python-modules.html , withPythonModule ? false +, withLto ? !stdenv.hostPlatform.isStatic && !stdenv.hostPlatform.isMinGW +, withMakeWrapper ? !stdenv.hostPlatform.isMinGW , libnghttp2 # for passthru.tests @@ -58,7 +60,9 @@ stdenv.mkDerivation (finalAttrs: { outputs = [ "out" "lib" "man" ]; # "dev" would only split ~20 kB - nativeBuildInputs = [ makeWrapper pkg-config ] + nativeBuildInputs = + lib.optionals withMakeWrapper [ makeWrapper ] + ++ [ pkg-config ] ++ lib.optionals withPythonModule [ swig ]; buildInputs = [ openssl nettle expat libevent ] @@ -78,7 +82,7 @@ stdenv.mkDerivation (finalAttrs: { "--with-rootkey-file=${dns-root-data}/root.key" "--enable-pie" "--enable-relro-now" - ] ++ lib.optionals stdenv.hostPlatform.isStatic [ + ] ++ lib.optionals (!withLto) [ "--disable-flto" ] ++ lib.optionals withSystemd [ "--enable-systemd" @@ -124,9 +128,10 @@ stdenv.mkDerivation (finalAttrs: { postInstall = '' make unbound-event-install + '' + lib.optionalString withMakeWrapper '' wrapProgram $out/bin/unbound-control-setup \ --prefix PATH : ${lib.makeBinPath [ openssl ]} - '' + lib.optionalString withPythonModule '' + '' + lib.optionalString (withMakeWrapper && withPythonModule) '' wrapProgram $out/bin/unbound \ --prefix PYTHONPATH : "$out/${python.sitePackages}" \ --argv0 $out/bin/unbound @@ -161,6 +166,6 @@ stdenv.mkDerivation (finalAttrs: { license = licenses.bsd3; homepage = "https://www.unbound.net"; maintainers = lib.teams.helsinki-systems.members; - platforms = platforms.unix; + platforms = platforms.unix ++ platforms.windows; }; })