unbound: add mingw32 hostPlatform build support

This commit is contained in:
Sean Link 2023-12-15 14:16:36 -07:00 committed by Weijia Wang
parent 629dd2dd4c
commit d81076b0c3

View file

@ -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;
};
})