build,meson: Make feature options boolean

Different options are set as `feature`, also every possible plugin,
but this may cause confusion.

All options set as `feature` but plugins have been made `boolean` to
avoid further confusions.

`help2man` is also installed in the CI image because is required to
build different libraries.
This commit is contained in:
Iñigo Martínez
2021-11-05 12:45:56 +01:00
committed by Aleksander Morgado
parent 7a7bc2e444
commit ec2e5403f1
7 changed files with 69 additions and 53 deletions

View File

@@ -12,14 +12,14 @@ stages:
variables: variables:
FDO_UPSTREAM_REPO: mobile-broadband/ModemManager FDO_UPSTREAM_REPO: mobile-broadband/ModemManager
FDO_DISTRIBUTION_VERSION: '20.04' 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 FDO_DISTRIBUTION_PACKAGES: ca-certificates git gcc autoconf automake libtool
libgettextpo-dev libgirepository1.0-dev libglib2.0-dev libgettextpo-dev libgirepository1.0-dev libglib2.0-dev
libgudev-1.0-dev python3-dbus python3-gi autopoint libgudev-1.0-dev python3-dbus python3-gi autopoint
xsltproc dbus gettext gtk-doc-tools libglib2.0-doc xsltproc dbus gettext gtk-doc-tools libglib2.0-doc
gobject-introspection python-is-python3 libsystemd-dev gobject-introspection python-is-python3 libsystemd-dev
libpolkit-gobject-1-dev valac meson ninja-build libpolkit-gobject-1-dev valac meson ninja-build
libdbus-1-dev bash-completion udev policykit-1 libdbus-1-dev bash-completion udev policykit-1 help2man
build container: build container:
extends: extends:
@@ -46,7 +46,7 @@ build-no-qmi:
script: script:
- git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libmbim.git - git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libmbim.git
- pushd libmbim - pushd libmbim
- meson setup build --prefix=/usr -Dgtk_doc=false -Dintrospection=disabled -Dbash_completion=false - meson setup build --prefix=/usr -Dgtk_doc=false -Dintrospection=false -Dbash_completion=false
- ninja -C build - ninja -C build
- ninja -C build install - ninja -C build install
- popd - popd
@@ -69,13 +69,13 @@ build-qmi-qrtr-no-mbim:
script: script:
- git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libqrtr-glib.git - git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libqrtr-glib.git
- pushd libqrtr-glib - 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
- ninja -C build install - ninja -C build install
- popd - popd
- git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libqmi.git - git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libqmi.git
- pushd libqmi - pushd libqmi
- meson setup build --prefix=/usr -Dgtk_doc=false -Dintrospection=disabled -Dbash_completion=false -Dmbim_qmux=disabled -Dqrtr=enabled -Dcollection=basic - meson setup build --prefix=/usr -Dgtk_doc=false -Dintrospection=false -Dbash_completion=false -Dmbim_qmux=false -Dcollection=basic
- ninja -C build - ninja -C build
- ninja -C build install - ninja -C build install
- popd - popd
@@ -98,7 +98,7 @@ build-qmi-no-qrtr-no-mbim:
script: script:
- git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libqmi.git - git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libqmi.git
- pushd libqmi - pushd libqmi
- meson setup build --prefix=/usr -Dgtk_doc=false -Dintrospection=disabled -Dbash_completion=false -Dmbim_qmux=disabled -Dqrtr=disabled -Dcollection=basic - meson setup build --prefix=/usr -Dgtk_doc=false -Dintrospection=false -Dbash_completion=false -Dmbim_qmux=false -Dqrtr=false -Dcollection=basic
- ninja -C build - ninja -C build
- ninja -C build install - ninja -C build install
- popd - popd
@@ -138,7 +138,7 @@ build-qmi-newest-commands:
script: script:
- git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libqmi.git - git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libqmi.git
- pushd libqmi - pushd libqmi
- meson setup build --prefix=/usr -Dgtk_doc=false -Dintrospection=disabled -Dbash_completion=false -Dmbim_qmux=disabled -Dqrtr=disabled -Dcollection=basic - meson setup build --prefix=/usr -Dgtk_doc=false -Dintrospection=false -Dbash_completion=false -Dmbim_qmux=false -Dqrtr=false -Dcollection=basic
- ninja -C build - ninja -C build
- ninja -C build install - ninja -C build install
- popd - popd
@@ -158,19 +158,19 @@ build-single-plugins:
script: script:
- git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libmbim.git - git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libmbim.git
- pushd libmbim - pushd libmbim
- meson setup build --prefix=/usr -Dgtk_doc=false -Dintrospection=disabled -Dbash_completion=false - meson setup build --prefix=/usr -Dgtk_doc=false -Dintrospection=false -Dbash_completion=false
- ninja -C build - ninja -C build
- ninja -C build install - ninja -C build install
- popd - popd
- git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libqrtr-glib.git - git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libqrtr-glib.git
- pushd libqrtr-glib - 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
- ninja -C build install - ninja -C build install
- popd - popd
- git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libqmi.git - git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libqmi.git
- pushd libqmi - pushd libqmi
- meson setup build --prefix=/usr -Dgtk_doc=false -Dintrospection=disabled -Dbash_completion=false -Dmbim_qmux=enabled -Dqrtr=enabled -Dcollection=basic - meson setup build --prefix=/usr -Dgtk_doc=false -Dintrospection=false -Dbash_completion=false -Dcollection=basic
- ninja -C build - ninja -C build
- ninja -C build install - ninja -C build install
- popd - popd
@@ -195,19 +195,19 @@ build-default:
script: script:
- git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libmbim.git - git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libmbim.git
- pushd libmbim - pushd libmbim
- meson setup build --prefix=/usr -Dgtk_doc=false -Dintrospection=enabled -Dbash_completion=false - meson setup build --prefix=/usr -Dgtk_doc=false -Dbash_completion=false
- ninja -C build - ninja -C build
- ninja -C build install - ninja -C build install
- popd - popd
- git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libqrtr-glib.git - git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libqrtr-glib.git
- pushd libqrtr-glib - 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
- ninja -C build install - ninja -C build install
- popd - popd
- git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libqmi.git - git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libqmi.git
- pushd libqmi - pushd libqmi
- meson setup build --prefix=/usr -Dgtk_doc=false -Dintrospection=enabled -Dbash_completion=false -Dmbim_qmux=enabled -Dqrtr=enabled -Dcollection=basic - meson setup build --prefix=/usr -Dgtk_doc=false -Dbash_completion=false -Dcollection=basic
- ninja -C build - ninja -C build
- ninja -C build install - ninja -C build install
- popd - popd
@@ -249,23 +249,23 @@ build-meson-release:
script: script:
- git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libmbim.git - git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libmbim.git
- pushd libmbim - pushd libmbim
- meson setup build --prefix=/usr -Dgtk_doc=false -Dintrospection=enabled -Dbash_completion=false - meson setup build --prefix=/usr -Dgtk_doc=false -Dbash_completion=false
- ninja -C build - ninja -C build
- ninja -C build install - ninja -C build install
- popd - popd
- git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libqrtr-glib.git - git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libqrtr-glib.git
- pushd libqrtr-glib - 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
- ninja -C build install - ninja -C build install
- popd - popd
- git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libqmi.git - git clone --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libqmi.git
- pushd libqmi - pushd libqmi
- meson setup build --prefix=/usr -Dgtk_doc=false -Dintrospection=enabled -Dbash_completion=false -Dmbim_qmux=enabled -Dqrtr=enabled -Dcollection=basic - meson setup build --prefix=/usr -Dgtk_doc=false -Dbash_completion=false -Dcollection=basic
- ninja -C build - ninja -C build
- ninja -C build install - ninja -C build install
- popd - popd
- meson setup build --buildtype=release --prefix=/usr -Dwerror=true -Dgtk_doc=false -Dintrospection=enabled -Dqmi=enabled -Dmbim=enabled -Dqrtr=enabled -Dpolkit=strict -Dsystemd_suspend_resume=true -Dsystemdsystemunitdir=/lib/systemd/system - meson setup build --buildtype=release --prefix=/usr -Dwerror=true -Dgtk_doc=false -Dpolkit=strict -Dsystemdsystemunitdir=/lib/systemd/system
- ninja -C build - ninja -C build
- ninja -C build install - ninja -C build install
- ninja -C build uninstall - ninja -C build uninstall

View File

@@ -26,10 +26,11 @@ sources = files(
'mmcli-sms.c', 'mmcli-sms.c',
) )
deps = [ deps = [libmm_glib_dep]
gudev_dep,
libmm_glib_dep, if enable_udev
] deps += gudev_dep
endif
executable( executable(
'mmcli', 'mmcli',

View File

@@ -172,8 +172,10 @@ if enable_bash_completion
endif endif
# udev support (enabled by default) # udev support (enabled by default)
gudev_dep = dependency('gudev-1.0', version: '>= 232', required: get_option('udev')) enable_udev = get_option('udev')
enable_udev = gudev_dep.found() if enable_udev
gudev_dep = dependency('gudev-1.0', version: '>= 232')
endif
config_h.set('WITH_UDEV', enable_udev) config_h.set('WITH_UDEV', enable_udev)
# udev base directory # udev base directory
@@ -232,20 +234,26 @@ enable_at_command_via_dbus = get_option('at_command_via_dbus')
config_h.set('WITH_AT_COMMAND_VIA_DBUS', enable_at_command_via_dbus) config_h.set('WITH_AT_COMMAND_VIA_DBUS', enable_at_command_via_dbus)
# MBIM support (enabled by default) # MBIM support (enabled by default)
mbim_glib_dep = dependency('mbim-glib', version: '>= 1.27.3', required: get_option('mbim')) enable_mbim = get_option('mbim')
enable_mbim = mbim_glib_dep.found() if enable_mbim
mbim_glib_dep = dependency('mbim-glib', version: '>= 1.27.3')
endif
config_h.set('WITH_MBIM', enable_mbim) config_h.set('WITH_MBIM', enable_mbim)
# QMI support (enabled by default) # QMI support (enabled by default)
qmi_glib_dep = dependency('qmi-glib', version: '>= 1.31.1', required: get_option('qmi')) enable_qmi = get_option('qmi')
enable_qmi = qmi_glib_dep.found() if enable_qmi
qmi_glib_dep = dependency('qmi-glib', version: '>= 1.31.1')
endif
config_h.set('WITH_QMI', enable_qmi) config_h.set('WITH_QMI', enable_qmi)
# QRTR support (both as qrtr-glib and qmi-glib apis) # QRTR support (both as qrtr-glib and qmi-glib apis)
qrtr_glib_dep = dependency('qrtr-glib', version: '>= 1.0.0', required: get_option('qrtr')) enable_qrtr = get_option('qrtr')
enable_qrtr = qrtr_glib_dep.found() if enable_qrtr
assert(not enable_qrtr or enable_qmi, 'QRTR support requires QMI enabled') assert(enable_qmi, 'QRTR support requires QMI enabled')
assert(not enable_qrtr or qmi_glib_dep.get_pkgconfig_variable('qmi_qrtr_supported').to_int().is_odd(), 'Couldn\'t find QRTR support in qmi-glib.') assert(qmi_glib_dep.get_pkgconfig_variable('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) config_h.set('WITH_QRTR', enable_qrtr)
# Distribution version string # Distribution version string
@@ -257,7 +265,10 @@ endif
util_dep = cc.find_library('util') util_dep = cc.find_library('util')
# introspection support # 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
# vala support # vala support
enable_vapi = get_option('vapi') enable_vapi = get_option('vapi')

View File

@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-or-later # SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2021 Iñigo Martinez <inigomartinez@gmail.com> # Copyright (C) 2021 Iñigo Martinez <inigomartinez@gmail.com>
option('udev', type: 'feature', value: 'auto', description: 'enable udev support') option('udev', type: 'boolean', value: true, description: 'enable udev support')
option('udevdir', type: 'string', value: '', description: 'udev base directory') option('udevdir', type: 'string', value: '', description: 'udev base directory')
option('dbus_policy_dir', type: 'string', value: '', description: 'd-bus system policy directory') option('dbus_policy_dir', type: 'string', value: '', description: 'd-bus system policy directory')
@@ -14,9 +14,9 @@ option('polkit', type: 'combo', choices: ['strict', 'permissive', 'no'], value:
option('at_command_via_dbus', type: 'boolean', value: false, description: 'enable at commands vida d-bus') option('at_command_via_dbus', type: 'boolean', value: false, description: 'enable at commands vida d-bus')
option('mbim', type: 'feature', value: 'auto', description: 'enable MBIM support') option('mbim', type: 'boolean', value: true, description: 'enable MBIM support')
option('qmi', type: 'feature', value: 'auto', description: 'enable QMI support') option('qmi', type: 'boolean', value: true, description: 'enable QMI support')
option('qrtr', type: 'feature', value: 'auto', description: 'enable QRTR support') option('qrtr', type: 'boolean', value: true, description: 'enable QRTR support')
option('dist_version', type: 'string', value: '', description: 'define the custom version (like distribution package name and revision') option('dist_version', type: 'string', value: '', description: 'define the custom version (like distribution package name and revision')
@@ -86,7 +86,7 @@ option('plugin_x22x', type: 'feature', value: 'auto', description: 'enable x22x
# shared_icera # shared_icera
option('plugin_zte', type: 'feature', value: 'auto', description: 'enable zte plugin support') option('plugin_zte', type: 'feature', value: 'auto', description: 'enable zte plugin support')
option('introspection', type: 'feature', value: 'auto', description: 'build introspection support') option('introspection', type: 'boolean', value: true, description: 'build introspection support')
option('vapi', type: 'boolean', value: false, description: 'build vala bindings') option('vapi', type: 'boolean', value: false, description: 'build vala bindings')
option('man', type: 'boolean', value: true, description: 'build manual pages') option('man', type: 'boolean', value: true, description: 'build manual pages')

View File

@@ -43,11 +43,15 @@ plugins_incs = [
kerneldevice_inc, kerneldevice_inc,
] ]
plugins_deps = [ plugins_deps = [libmm_glib_dep]
libmm_glib_dep,
mbim_glib_dep, if enable_mbim
qmi_glib_dep, plugins_deps += mbim_glib_dep
] endif
if enable_qmi
plugins_deps += qmi_glib_dep
endif
# Common Foxconn modem support library (MBIM only) # Common Foxconn modem support library (MBIM only)
if plugins_shared['foxconn'] if plugins_shared['foxconn']

View File

@@ -45,20 +45,20 @@ incs = [
kerneldevice_inc, kerneldevice_inc,
] ]
deps = [ deps = [libmm_glib_dep]
libmm_glib_dep,
mbim_glib_dep,
qmi_glib_dep,
]
private_deps = [] private_deps = []
if enable_qmi if enable_qmi
sources += files('mm-modem-helpers-qmi.c') sources += files('mm-modem-helpers-qmi.c')
deps += qmi_glib_dep
endif endif
if enable_mbim if enable_mbim
sources += files('mm-modem-helpers-mbim.c') sources += files('mm-modem-helpers-mbim.c')
deps += mbim_glib_dep
endif endif
if enable_systemd_journal if enable_systemd_journal
@@ -87,18 +87,18 @@ sources = files(
'kerneldevice/mm-kernel-device-helpers.c', 'kerneldevice/mm-kernel-device-helpers.c',
) )
deps = [ deps = [libhelpers_dep]
gudev_dep,
libhelpers_dep,
qrtr_glib_dep,
]
if enable_qrtr if enable_qrtr
sources += files('kerneldevice/mm-kernel-device-qrtr.c') sources += files('kerneldevice/mm-kernel-device-qrtr.c')
deps += qrtr_glib_dep
endif endif
if enable_udev if enable_udev
sources += files('kerneldevice/mm-kernel-device-udev.c') sources += files('kerneldevice/mm-kernel-device-udev.c')
deps += gudev_dep
endif endif
libkerneldevice = static_library( libkerneldevice = static_library(

View File

@@ -8,7 +8,7 @@ test_units = {
'mmtty': libport_dep, 'mmtty': libport_dep,
} }
if gudev_dep.found() if enable_udev
test_units += {'lsudev': gudev_dep} test_units += {'lsudev': gudev_dep}
endif endif