From 6f024f8dd380c1a4f3205ba8ab4e08462dfa44bb Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Wed, 25 Jan 2023 15:00:41 +0000 Subject: [PATCH] libvirt-glib: fix cross --- .../libraries/libvirt-glib/default.nix | 33 ++++++++++++++----- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/pkgs/development/libraries/libvirt-glib/default.nix b/pkgs/development/libraries/libvirt-glib/default.nix index 8f84cd0eab80..566a1c1b83fa 100644 --- a/pkgs/development/libraries/libvirt-glib/default.nix +++ b/pkgs/development/libraries/libvirt-glib/default.nix @@ -5,21 +5,23 @@ , meson , ninja , pkg-config -, gobject-introspection , gettext -, gtk-doc -, docbook-xsl-nons , vala , libcap_ng , libvirt , libxml2 +, withIntrospection ? stdenv.hostPlatform == stdenv.buildPlatform +, gobject-introspection +, withDocs ? stdenv.hostPlatform == stdenv.buildPlatform +, gtk-doc +, docbook-xsl-nons }: stdenv.mkDerivation rec { pname = "libvirt-glib"; version = "4.0.0"; - outputs = [ "out" "dev" "devdoc" ]; + outputs = [ "out" "dev" ] ++ lib.optional withDocs "devdoc"; src = fetchurl { url = "https://libvirt.org/sources/glib/${pname}-${version}.tar.xz"; @@ -39,22 +41,35 @@ stdenv.mkDerivation rec { ninja pkg-config gettext - gtk-doc - docbook-xsl-nons vala gobject-introspection + ] ++ lib.optionals withIntrospection [ + gobject-introspection + ] ++ lib.optionals withDocs [ + gtk-doc + docbook-xsl-nons ]; - buildInputs = (lib.optionals stdenv.isLinux [ - libcap_ng - ]) ++ [ + buildInputs = [ libvirt libxml2 + ] ++ lib.optionals stdenv.isLinux [ + libcap_ng + ] ++ lib.optionals withIntrospection [ gobject-introspection ]; strictDeps = true; + # The build system won't let us build with docs or introspection + # unless we're building natively, but will still do a mandatory + # check for the dependencies for those things unless we explicitly + # disable the options. + mesonFlags = [ + (lib.mesonEnable "docs" withDocs) + (lib.mesonEnable "introspection" withIntrospection) + ]; + # https://gitlab.com/libvirt/libvirt-glib/-/issues/4 NIX_CFLAGS_COMPILE = [ "-Wno-error=pointer-sign" ];