diff options
author | Iñigo Martínez <inigomartinez@gmail.com> | 2021-11-05 10:38:22 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2021-11-08 09:24:25 +0000 |
commit | 0b29792fa12fccb1b7f0c455225b646b82fdf24e (patch) | |
tree | 0ea47f6b8e2e12c3949aacc178684bc67a8d2611 | |
parent | 4210314cbd37142ceb5328ed14007b36338b3658 (diff) |
build: Make feature options boolean
Different options are set as `feature` but this may cause confusion.
They have been made `boolean`.
In order to always build man documentation, `help2man` is also
installed in the CI builds.
-rw-r--r-- | .gitlab-ci.yml | 38 | ||||
-rw-r--r-- | docs/man/meson.build | 2 | ||||
-rw-r--r-- | meson.build | 40 | ||||
-rw-r--r-- | meson_options.txt | 12 | ||||
-rw-r--r-- | src/libqmi-glib/generated/meson.build | 9 | ||||
-rw-r--r-- | src/libqmi-glib/meson.build | 3 | ||||
-rw-r--r-- | src/qmi-firmware-update/meson.build | 10 | ||||
-rw-r--r-- | src/qmicli/meson.build | 9 |
8 files changed, 71 insertions, 52 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 510b67c..5b593e6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,12 +12,12 @@ stages: variables: FDO_UPSTREAM_REPO: mobile-broadband/libqmi FDO_DISTRIBUTION_VERSION: '20.04' - FDO_DISTRIBUTION_TAG: '2021-10-03.1' + FDO_DISTRIBUTION_TAG: '2021-11-05.1' FDO_DISTRIBUTION_PACKAGES: ca-certificates git gcc autoconf automake libtool libgirepository1.0-dev libglib2.0-dev autopoint gtk-doc-tools python-is-python3 libglib2.0-doc libgudev-1.0-dev gobject-introspection valac - bash-completion meson ninja-build + bash-completion meson ninja-build help2man build container: extends: @@ -42,7 +42,7 @@ build-no-qrtr-no-mbim-no-rmnet-no-introspection: - tags - schedules script: - - meson setup build --prefix=/usr -Dwerror=true -Dgtk_doc=false -Dintrospection=disabled -Dmbim_qmux=disabled -Dqrtr=disabled -Drmnet=disabled + - meson setup build --prefix=/usr -Dwerror=true -Dgtk_doc=false -Dintrospection=false -Dmbim_qmux=false -Dqrtr=false -Drmnet=false - ninja -C build - ninja -C build install @@ -59,17 +59,17 @@ build-no-rmnet: script: - git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libmbim.git - pushd libmbim - - meson setup build --prefix=/usr -Dgtk_doc=false -Dintrospection=enabled + - meson setup build --prefix=/usr -Dgtk_doc=false - ninja -C build - ninja -C build install - popd - git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libqrtr-glib.git - pushd libqrtr-glib - - meson setup build --prefix=/usr -Dgtk_doc=false -Dintrospection=enabled + - meson setup build --prefix=/usr -Dgtk_doc=false - ninja -C build - ninja -C build install - popd - - meson setup build --prefix=/usr -Dwerror=true -Dgtk_doc=false -Dintrospection=enabled -Dmbim_qmux=enabled -Dqrtr=enabled -Drmnet=disabled + - meson setup build --prefix=/usr -Dwerror=true -Dgtk_doc=false -Drmnet=false - ninja -C build - ninja -C build install @@ -86,11 +86,11 @@ build-no-qrtr: script: - git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libmbim.git - pushd libmbim - - meson setup build --prefix=/usr -Dgtk_doc=false -Dintrospection=enabled + - meson setup build --prefix=/usr -Dgtk_doc=false - ninja -C build - ninja -C build install - popd - - meson setup build --prefix=/usr -Dwerror=true -Dgtk_doc=false -Dintrospection=enabled -Dmbim_qmux=enabled -Dqrtr=disabled -Drmnet=enabled + - meson setup build --prefix=/usr -Dwerror=true -Dgtk_doc=false -Dqrtr=false - ninja -C build - ninja -C build install @@ -107,11 +107,11 @@ build-no-qrtr-no-introspection: script: - git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libmbim.git - pushd libmbim - - meson setup build --prefix=/usr -Dgtk_doc=false -Dintrospection=disabled + - meson setup build --prefix=/usr -Dgtk_doc=false -Dintrospection=false - ninja -C build - ninja -C build install - popd - - meson setup build --prefix=/usr -Dwerror=true -Dgtk_doc=false -Dintrospection=disabled -Dmbim_qmux=enabled -Dqrtr=disabled -Drmnet=enabled + - meson setup build --prefix=/usr -Dwerror=true -Dgtk_doc=false -Dintrospection=false -Dqrtr=false - ninja -C build - ninja -C build install @@ -128,11 +128,11 @@ build-no-mbim: script: - git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libqrtr-glib.git - pushd libqrtr-glib - - meson setup build --prefix=/usr -Dgtk_doc=false -Dintrospection=enabled + - meson setup build --prefix=/usr -Dgtk_doc=false - ninja -C build - ninja -C build install - popd - - meson setup build --prefix=/usr -Dwerror=true -Dgtk_doc=false -Dintrospection=enabled -Dmbim_qmux=disabled -Dqrtr=enabled -Drmnet=enabled + - meson setup build --prefix=/usr -Dwerror=true -Dgtk_doc=false -Dmbim_qmux=false - ninja -C build - ninja -C build install @@ -149,11 +149,11 @@ build-no-mbim-no-introspection: script: - git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libqrtr-glib.git - pushd libqrtr-glib - - meson setup build --prefix=/usr -Dgtk_doc=false -Dintrospection=disabled + - meson setup build --prefix=/usr -Dgtk_doc=false -Dintrospection=false - ninja -C build - ninja -C build install - popd - - meson setup build --prefix=/usr -Dwerror=true -Dgtk_doc=false -Dintrospection=disabled -Dmbim_qmux=disabled -Dqrtr=enabled -Drmnet=enabled + - meson setup build --prefix=/usr -Dwerror=true -Dgtk_doc=false -Dintrospection=false -Dmbim_qmux=false - ninja -C build - ninja -C build install @@ -168,7 +168,7 @@ build-collection-minimal: - tags - schedules script: - - meson setup build --prefix=/usr -Dwerror=true -Dgtk_doc=false -Dintrospection=disabled -Dmbim_qmux=disabled -Dqrtr=disabled -Drmnet=disabled -Dcollection=minimal -Dfirmware_update=false + - meson setup build --prefix=/usr -Dwerror=true -Dgtk_doc=false -Dintrospection=false -Dmbim_qmux=false -Dqrtr=false -Drmnet=false -Dcollection=minimal -Dfirmware_update=false -Dudev=false - ninja -C build - ninja -C build install @@ -183,7 +183,7 @@ build-collection-basic: - tags - schedules script: - - meson setup build --prefix=/usr -Dwerror=true -Dgtk_doc=false -Dintrospection=disabled -Dmbim_qmux=disabled -Dqrtr=disabled -Drmnet=disabled -Dcollection=basic + - meson setup build --prefix=/usr -Dwerror=true -Dgtk_doc=false -Dintrospection=false -Dmbim_qmux=false -Dqrtr=false -Drmnet=false -Dcollection=basic - ninja -C build - ninja -C build install @@ -200,17 +200,17 @@ build-release: script: - git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libmbim.git - pushd libmbim - - meson setup build --buildtype=release --prefix=/usr -Dgtk_doc=false -Dintrospection=enabled + - meson setup build --buildtype=release --prefix=/usr -Dgtk_doc=false - ninja -C build - ninja -C build install - popd - git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libqrtr-glib.git - pushd libqrtr-glib - - meson setup build --buildtype=release --prefix=/usr -Dgtk_doc=false -Dintrospection=enabled + - meson setup build --buildtype=release --prefix=/usr -Dgtk_doc=false - ninja -C build - ninja -C build install - popd - - meson setup build --buildtype=release --prefix=/usr -Dwerror=true -Dgtk_doc=false -Dintrospection=enabled -Dmbim_qmux=enabled -Dqrtr=enabled -Drmnet=enabled + - meson setup build --buildtype=release --prefix=/usr -Dwerror=true -Dgtk_doc=false - ninja -C build - ninja -C build install - ninja -C build dist diff --git a/docs/man/meson.build b/docs/man/meson.build index 9139142..aca49f5 100644 --- a/docs/man/meson.build +++ b/docs/man/meson.build @@ -1,6 +1,8 @@ # SPDX-License-Identifier: GPL-2.0-or-later # Copyright (C) 2019 - 2021 Iñigo Martinez <inigomartinez@gmail.com> +help2man = find_program('help2man') + mans = [ ['qmicli', [help2man, '--output=@OUTPUT@', '--name=Control QMI devices', '--help-option="--help-all"', qmicli]], ['qmi-network', [help2man, '--output=@OUTPUT@', '--name=Simple network management of QMI devices', qmi_network]], diff --git a/meson.build b/meson.build index c731214..1aea413 100644 --- a/meson.build +++ b/meson.build @@ -151,8 +151,12 @@ enable_firmware_update = get_option('firmware_update') assert(not enable_firmware_update or qmi_collection_name != 'minimal', 'Cannot build qmi-firmware-update when \'minimal\' collection enabled, use at least the \'basic\' collection instead.') # udev support is optional, enabled by default -gudev_dep = dependency((enable_firmware_update ? 'gudev-1.0' : ''), version: '>= 232', required: get_option('udev')) -config_h.set('WITH_UDEV', gudev_dep.found()) +enable_udev = get_option('udev') +if enable_udev + assert(enable_firmware_update, 'Cannot build udev support without firmware_update support') + gudev_dep = dependency('gudev-1.0', version: '>= 232') +endif +config_h.set('WITH_UDEV', enable_udev) enable_bash_completion = get_option('bash_completion') if enable_bash_completion @@ -165,7 +169,7 @@ if enable_bash_completion endif # rmnet link management support -enable_rmnet = not get_option('rmnet').disabled() +enable_rmnet = get_option('rmnet') config_h.set('RMNET_SUPPORT_ENABLED', enable_rmnet) # runtime MM check is optional, enabled by default @@ -188,13 +192,17 @@ endif config_h.set('QMI_USERNAME_ENABLED', enable_qmi_username) # MBIM QMUX service support -mbim_glib_dep = dependency('mbim-glib', version: '>= 1.18.0', required: get_option('mbim_qmux')) -enable_mbim_qmux = mbim_glib_dep.found() +enable_mbim_qmux = get_option('mbim_qmux') +if enable_mbim_qmux + mbim_glib_dep = dependency('mbim-glib', version: '>= 1.18.0') +endif config_h.set('MBIM_QMUX_ENABLED', enable_mbim_qmux) # QRTR support -qrtr_glib_dep = dependency('qrtr-glib', version: '>= 1.0.0', required: get_option('qrtr')) -enable_qrtr = qrtr_glib_dep.found() +enable_qrtr = get_option('qrtr') +if enable_qrtr + qrtr_glib_dep = dependency('qrtr-glib', version: '>= 1.0.0') +endif config_h.set10('QMI_QRTR_SUPPORTED', enable_qrtr) version_conf = configuration_data() @@ -207,7 +215,10 @@ version_conf.set10('QMI_QRTR_SUPPORTED', enable_qrtr) version_conf.set10('QMI_RMNET_SUPPORTED', enable_rmnet) # introspection support -enable_gir = dependency('gobject-introspection-1.0', version: '>= 0.9.6', required: get_option('introspection')).found() +enable_gir = get_option('introspection') +if enable_gir + dependency('gobject-introspection-1.0', version: '>= 0.9.6') +endif test_env = { 'G_DEBUG': 'gc-friendly', @@ -223,13 +234,10 @@ if enable_gtk_doc subdir('docs/reference/libqmi-glib') endif -help2man = find_program( - 'help2man', -# When meson >= 0.59 is popular enough, replace with -# required: get_option('man').require(meson.can_run_host_binaries()) - required: get_option('man'), -) -subdir('docs/man', if_found: help2man) +enable_man = get_option('man') +if enable_man + subdir('docs/man') +endif configure_file( output: 'config.h', @@ -242,7 +250,7 @@ summary({ 'Documentation': enable_gtk_doc, 'bash completion': enable_bash_completion, 'gobject introspection': enable_gir, - 'man pages': help2man.found(), + 'man pages': enable_man, }, section: 'Build') summary({ diff --git a/meson_options.txt b/meson_options.txt index bee5daa..3f3a22b 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -5,17 +5,17 @@ option('collection', type: 'combo', choices: ['minimal', 'basic', 'full'], value option('firmware_update', type: 'boolean', value: true, description: 'enable compilation of `qmi-firmware-update') -option('mbim_qmux', type: 'feature', value: 'auto', description: 'enable support for QMI over MBIM QMUX service') +option('mbim_qmux', type: 'boolean', value: true, description: 'enable support for QMI over MBIM QMUX service') option('mm_runtime_check', type: 'boolean', value: true, description: 'build ModemManager runtime check support') option('qmi_username', type: 'string', value: '', description: 'user allowed to access QMI devices') -option('qrtr', type: 'feature', value: 'auto', description: 'enable support for QRTR protocol') -option('rmnet', type: 'feature', value: 'auto', description: 'enable support for RMNET link management') +option('qrtr', type: 'boolean', value: true, description: 'enable support for QRTR protocol') +option('rmnet', type: 'boolean', value: true, description: 'enable support for RMNET link management') -option('udev', type: 'feature', value: 'auto', description: 'build udev support') +option('udev', type: 'boolean', value: true, description: 'build udev support') option('udevdir', type: 'string', value: '', description: 'where udev base directory is') -option('introspection', type: 'feature', value: 'auto', description: 'build introspection support') +option('introspection', type: 'boolean', value: true, description: 'build introspection support') option('gtk_doc', type: 'boolean', value: false, description: 'use gtk-doc to build documentation') -option('man', type: 'feature', value: 'auto', description: 'build man pages using help2man') +option('man', type: 'boolean', value: true, description: 'build man pages using help2man') option('bash_completion', type: 'boolean', value: true, description: 'install bash completion files') diff --git a/src/libqmi-glib/generated/meson.build b/src/libqmi-glib/generated/meson.build index d5fc186..900bc40 100644 --- a/src/libqmi-glib/generated/meson.build +++ b/src/libqmi-glib/generated/meson.build @@ -227,10 +227,11 @@ c_flags = [ '-Wno-unused-function', ] -deps = [ - glib_deps, - qrtr_glib_dep, -] +deps = [glib_deps] + +if enable_qrtr + deps += qrtr_glib_dep +endif libqmi_glib_generated = static_library( 'qmi-glib-generated', diff --git a/src/libqmi-glib/meson.build b/src/libqmi-glib/meson.build index 556d883..ac91bd5 100644 --- a/src/libqmi-glib/meson.build +++ b/src/libqmi-glib/meson.build @@ -95,11 +95,12 @@ sources = files( deps = [ generated_dep, gio_unix_dep, - mbim_glib_dep, ] if enable_mbim_qmux sources += files('qmi-endpoint-mbim.c') + + deps += mbim_glib_dep endif if enable_qrtr diff --git a/src/qmi-firmware-update/meson.build b/src/qmi-firmware-update/meson.build index da47a41..707217b 100644 --- a/src/qmi-firmware-update/meson.build +++ b/src/qmi-firmware-update/meson.build @@ -84,12 +84,18 @@ sources += custom_target( ) deps = [ - gudev_dep, libfirehose_dep, libutils_dep, - mbim_glib_dep, ] +if enable_mbim_qmux + deps += mbim_glib_dep +endif + +if enable_udev + deps += gudev_dep +endif + qmi_firmware_update = executable( 'qmi-firmware-update', sources: sources, diff --git a/src/qmicli/meson.build b/src/qmicli/meson.build index 4b52fd3..c794524 100644 --- a/src/qmicli/meson.build +++ b/src/qmicli/meson.build @@ -35,10 +35,11 @@ sources = files( 'qmicli-wms.c', ) -deps = [ - libhelpers_dep, - mbim_glib_dep, -] +deps = [libhelpers_dep] + +if enable_mbim_qmux + deps += mbim_glib_dep +endif qmicli = executable( 'qmicli', |