Merge request !1489 from 'deprecated-meson-option'

build: add -Ddeprecated=[true|false] to control deprecated symbols

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1489
This commit is contained in:
Dan Williams
2026-08-29 23:29:11 -05:00
3 changed files with 29 additions and 2 deletions
+1 -1
View File
@@ -208,7 +208,7 @@ build-no-deprecated:
- export BUILD_QRTR=false
- export BUILD_QMI=false
- *prepare_deps
- CFLAGS="-DMM_DISABLE_DEPRECATED" meson setup build --prefix=/usr -Dwerror=true -Dgtk_doc=false -Dqmi=false -Dqrtr=false -Dmbim=false
- meson setup build --prefix=/usr -Dwerror=true -Dgtk_doc=false -Dqmi=false -Dqrtr=false -Dmbim=false -Ddeprecated=false
- ninja -C build
- ninja -C build test
- ninja -C build install
+26 -1
View File
@@ -144,7 +144,24 @@ if get_option('buildtype').contains('debug')
])
endif
add_project_arguments(common_args + cc_args, language: 'c')
# Look for existing -DMM_DISABLE_DEPRECATED in CFLAGS
pymodule = import('python3')
python3 = pymodule.find_python()
res = run_command(python3, '-c', 'import os; print(os.environ["CFLAGS"])')
cflags_disable_deprecated = false
if res.returncode() == 0 and res.stdout().contains('-DMM_DISABLE_DEPRECATED')
cflags_disable_deprecated = true
endif
# Handle deprecation enable/disable
if get_option('deprecated')
cc_args += cc.get_supported_arguments('-Wno-deprecated-declarations')
else
if cflags_disable_deprecated == false
cc_args += '-DMM_DISABLE_DEPRECATED'
endif
cc_args += cc.get_supported_arguments('-Wdeprecated-declarations')
endif
glib_version = '2.56'
@@ -271,6 +288,9 @@ if enable_mbim
])
mbim_glib_dep = mbim_glib_proj.get_variable('libmbim_glib_dep')
endif
# MM should never use deprecated symbols from the libmibm
cc_args += '-DMBIM_DISABLE_DEPRECATED'
endif
config_h.set('WITH_MBIM', enable_mbim)
@@ -289,6 +309,9 @@ if enable_qmi
])
qmi_glib_dep = qmi_glib_proj.get_variable('libqmi_glib_dep')
endif
# MM should never use deprecated symbols from libqmi
cc_args += '-DQMI_DISABLE_DEPRECATED'
endif
config_h.set('WITH_QMI', enable_qmi)
@@ -306,6 +329,8 @@ if enable_qrtr
endif
config_h.set('WITH_QRTR', enable_qrtr)
add_project_arguments(common_args + cc_args, language: 'c')
# Distribution version string
dist_version = get_option('dist_version')
if dist_version != ''
+2
View File
@@ -17,6 +17,8 @@ option('systemd_journal', type: 'boolean', value: true, description: 'enable sys
option('polkit', type: 'combo', choices: ['strict', 'permissive', 'no'], value: 'strict', description: 'User auth-polkit configuration option.')
option('deprecated', type: 'boolean', value: true, description: 'build with deprecated symbols')
option('at_command_via_dbus', type: 'boolean', value: false, description: 'enable at commands via d-bus')
option('builtin_plugins', type: 'boolean', value: false, description: 'integrate all built plugins within the daemon binary')