From 9cb5a2d09086fc8a1f0704436302e431947b44c0 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Wed, 19 Jul 2023 14:05:54 +0200 Subject: build: Allow to use libmbim as subproject MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes it simpler to build ModemManager git Signed-off-by: Guido Günther --- .gitignore | 1 + meson.build | 11 ++++++++++- meson_options.txt | 1 + subprojects/libmbim.wrap | 5 +++++ 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 subprojects/libmbim.wrap diff --git a/.gitignore b/.gitignore index c5dd58fe..ecb82c0e 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ tags /.vscode /cscope.out +subprojects/libmbim diff --git a/meson.build b/meson.build index fa8b13a9..72d2ab22 100644 --- a/meson.build +++ b/meson.build @@ -259,7 +259,16 @@ config_h.set('WITH_BUILTIN_PLUGINS', enable_builtin_plugins) # MBIM support (enabled by default) enable_mbim = get_option('mbim') if enable_mbim - mbim_glib_dep = dependency('mbim-glib', version: '>= 1.32.0') + mbim_glib_dep = dependency('mbim-glib', version: '>= 1.32.0', + required: not get_option('subproject-fallback')) + if not mbim_glib_dep.found() and get_option('subproject-fallback') + mbim_glib_proj = subproject('libmbim', + default_options: ['man=false', + 'introspection=false', + 'bash_completion=false', + ]) + mbim_glib_dep = mbim_glib_proj.get_variable('libmbim_glib_dep') + endif endif config_h.set('WITH_MBIM', enable_mbim) diff --git a/meson_options.txt b/meson_options.txt index c0609fe8..6fbc0666 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -6,6 +6,7 @@ option('udevdir', type: 'string', value: '', description: 'udev base directory') option('examples', type: 'boolean', value: true, description: 'install examples') option('tests', type: 'boolean', value: true, description: 'enable tests') +option('subproject-fallback', type: 'boolean', value: false, description: 'allow to use subprojects') option('dbus_policy_dir', type: 'string', value: '', description: 'd-bus system policy directory') diff --git a/subprojects/libmbim.wrap b/subprojects/libmbim.wrap new file mode 100644 index 00000000..522bf8ed --- /dev/null +++ b/subprojects/libmbim.wrap @@ -0,0 +1,5 @@ +[wrap-git] +directory=libmbim +url=https://gitlab.freedesktop.org/mobile-broadband/libmbim.git +revision=main + -- cgit v1.2.3-70-g09d2 From c04f178ddaf7951ffafd59a61ce0ebf238af90bb Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Wed, 19 Jul 2023 14:05:54 +0200 Subject: build: Allow to use libqmi as subproject MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes it simpler to build ModemManager git Signed-off-by: Guido Günther --- .gitignore | 1 + meson.build | 20 ++++++++++++++++++-- subprojects/libqmi.wrap | 5 +++++ 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 subprojects/libqmi.wrap diff --git a/.gitignore b/.gitignore index ecb82c0e..b457b25c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ tags /.vscode /cscope.out subprojects/libmbim +subprojects/libqmi diff --git a/meson.build b/meson.build index 72d2ab22..fd094f7c 100644 --- a/meson.build +++ b/meson.build @@ -275,7 +275,18 @@ config_h.set('WITH_MBIM', enable_mbim) # QMI support (enabled by default) enable_qmi = get_option('qmi') if enable_qmi - qmi_glib_dep = dependency('qmi-glib', version: '>= 1.36.0') + qmi_glib_dep = dependency('qmi-glib', version: '>= 1.36.0', + required: not get_option('subproject-fallback')) + + if not qmi_glib_dep.found() and get_option('subproject-fallback') + qmi_glib_proj = subproject('libqmi', + default_options: ['man=false', + 'mbim_qmux=false', + 'introspection=false', + 'bash_completion=false', + ]) + qmi_glib_dep = qmi_glib_proj.get_variable('libqmi_glib_dep') + endif endif config_h.set('WITH_QMI', enable_qmi) @@ -283,7 +294,12 @@ config_h.set('WITH_QMI', enable_qmi) enable_qrtr = get_option('qrtr') if enable_qrtr assert(enable_qmi, 'QRTR support requires QMI enabled') - assert(qmi_glib_dep.get_pkgconfig_variable('qmi_qrtr_supported').to_int().is_odd(), 'Couldn\'t find QRTR support in qmi-glib.') + if qmi_glib_dep.type_name() == 'internal' + qmi_qrtr_supported = qmi_glib_proj.get_variable('enable_qrtr') + else + qmi_qrtr_supported = qmi_glib_dep.get_pkgconfig_variable('qmi_qrtr_supported') + endif + assert(qmi_qrtr_supported.to_int().is_odd(), 'Couldn\'t find QRTR support in qmi-glib.') qrtr_glib_dep = dependency('qrtr-glib', version: '>= 1.0.0') endif config_h.set('WITH_QRTR', enable_qrtr) diff --git a/subprojects/libqmi.wrap b/subprojects/libqmi.wrap new file mode 100644 index 00000000..2511ce47 --- /dev/null +++ b/subprojects/libqmi.wrap @@ -0,0 +1,5 @@ +[wrap-git] +directory=libqmi +url=https://gitlab.freedesktop.org/mobile-broadband/libqmi.git +revision=main + -- cgit v1.2.3-70-g09d2