about summary refs log tree commit diff
path: root/pkgs/development/libraries/libqmi
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-04-18 19:55:39 +0000
committerAlyssa Ross <hi@alyssa.is>2023-04-20 13:25:03 +0000
commitfda9058affd73baa6379743da7a4b463b12849b4 (patch)
treee74489cbf28ca353535e9568dab5fcaaced7709e /pkgs/development/libraries/libqmi
parent325e7839c83db1e3c1af511c99075d6e6ad898c7 (diff)
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
Diffstat (limited to 'pkgs/development/libraries/libqmi')
-rw-r--r--pkgs/development/libraries/libqmi/default.nix27
1 files changed, 19 insertions, 8 deletions
diff --git a/pkgs/development/libraries/libqmi/default.nix b/pkgs/development/libraries/libqmi/default.nix
index 1a314563d4b87..e2c7fcea19530 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;