From fda9058affd73baa6379743da7a4b463b12849b4 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Tue, 18 Apr 2023 19:55:39 +0000 Subject: [PATCH] libqmi: widen cross support using emulation With emulation, we can now do gobject-introspection for a wide range of cross targets (but not all), so we can enable the corresponding options in those cases. The man pages still can't be cross-compiled, because they use help2man and Meson doesn't know how to inject the emulator[1]. [1]: https://gitlab.freedesktop.org/mobile-broadband/libqmi/-/issues/75 --- pkgs/development/libraries/libqmi/default.nix | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/pkgs/development/libraries/libqmi/default.nix b/pkgs/development/libraries/libqmi/default.nix index 1a314563d4b..e2c7fcea195 100644 --- a/pkgs/development/libraries/libqmi/default.nix +++ b/pkgs/development/libraries/libqmi/default.nix @@ -12,10 +12,14 @@ , help2man , glib , python3 +, mesonEmulatorHook , libgudev , bash-completion , libmbim , libqrtr-glib +, buildPackages +, withIntrospection ? stdenv.hostPlatform.emulatorAvailable buildPackages +, withMan ? stdenv.buildPlatform.canExecute stdenv.hostPlatform }: stdenv.mkDerivation rec { @@ -23,7 +27,7 @@ stdenv.mkDerivation rec { version = "1.32.2"; outputs = [ "out" "dev" ] - ++ lib.optionals (stdenv.buildPlatform == stdenv.hostPlatform) [ "devdoc" ]; + ++ lib.optional withIntrospection "devdoc"; src = fetchFromGitLab { domain = "gitlab.freedesktop.org"; @@ -46,31 +50,38 @@ stdenv.mkDerivation rec { meson ninja pkg-config - gobject-introspection python3 - ] ++ lib.optionals (stdenv.buildPlatform == stdenv.hostPlatform) [ + ] ++ lib.optionals withMan [ + help2man + ] ++ lib.optionals withIntrospection [ + gobject-introspection gtk-doc docbook-xsl-nons docbook_xml_dtd_43 - help2man + ] ++ lib.optionals (withIntrospection && !stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + mesonEmulatorHook ]; buildInputs = [ - libgudev bash-completion libmbim + ] ++ lib.optionals withIntrospection [ + libgudev ]; propagatedBuildInputs = [ glib + ] ++ lib.optionals withIntrospection [ libqrtr-glib ]; mesonFlags = [ "-Dudevdir=${placeholder "out"}/lib/udev" - (lib.mesonBool "gtk_doc" (stdenv.buildPlatform == stdenv.hostPlatform)) - (lib.mesonBool "introspection" (stdenv.buildPlatform == stdenv.hostPlatform)) - (lib.mesonBool "man" (stdenv.buildPlatform == stdenv.hostPlatform)) + (lib.mesonBool "gtk_doc" withIntrospection) + (lib.mesonBool "introspection" withIntrospection) + (lib.mesonBool "man" withMan) + (lib.mesonBool "qrtr" withIntrospection) + (lib.mesonBool "udev" withIntrospection) ]; doCheck = true;