From 9e9bf8a8dab3ad26cdde20e569ff4feaf39dbceb Mon Sep 17 00:00:00 2001 From: Michael Webster Date: Tue, 4 Feb 2025 12:25:10 -0500 Subject: [PATCH] build: Improve variable names for NetworkManager options. This does not change the default build but is more descriptive about what the option is doing. ref: https://github.com/linuxmint/cinnamon/pull/12714 --- docs/reference/cinnamon/meson.build | 4 ++++ js/misc/config.js.in | 2 +- js/ui/main.js | 2 +- meson.build | 17 +++++++++++------ meson_options.txt | 6 +++--- src/meson.build | 4 ++-- 6 files changed, 22 insertions(+), 13 deletions(-) diff --git a/docs/reference/cinnamon/meson.build b/docs/reference/cinnamon/meson.build index 0123077f0e..9040aa7088 100644 --- a/docs/reference/cinnamon/meson.build +++ b/docs/reference/cinnamon/meson.build @@ -7,6 +7,10 @@ ignore = [ sniffer_headers, ] +if not build_nm_agent + ignore += 'cinnamon-network-agent.h' +endif + if not get_option('build_recorder') ignore += 'cinnamon-recorder.h' endif diff --git a/js/misc/config.js.in b/js/misc/config.js.in index dd3c8aba80..68ed93cf1b 100644 --- a/js/misc/config.js.in +++ b/js/misc/config.js.in @@ -5,4 +5,4 @@ var PACKAGE_NAME = '@PACKAGE_NAME@'; /* The version of this package */ var PACKAGE_VERSION = '@PACKAGE_VERSION@'; /* 1 if networkmanager is available, 0 otherwise */ -var HAVE_NETWORKMANAGER = @HAVE_NETWORKMANAGER@; +var BUILT_NM_AGENT = @BUILT_NM_AGENT@; diff --git a/js/ui/main.js b/js/ui/main.js index b487c161b9..a50845b5e7 100644 --- a/js/ui/main.js +++ b/js/ui/main.js @@ -429,7 +429,7 @@ function start() { placesManager = new PlacesManager.PlacesManager(); // NM Agent - if (Config.HAVE_NETWORKMANAGER && global.settings.get_boolean("enable-nm-agent")) { + if (Config.BUILT_NM_AGENT && global.settings.get_boolean("enable-nm-agent")) { networkAgent = new NetworkAgent.NetworkAgent(); global.log('NetworkManager agent: enabled') } diff --git a/meson.build b/meson.build index cdd521dd52..e4f1a805ea 100644 --- a/meson.build +++ b/meson.build @@ -28,7 +28,7 @@ cmenu = dependency('libcinnamon-menu-3.0', version: '>= 4.8.0') cogl = dependency('muffin-cogl-0') cogl_path = dependency('muffin-cogl-path-0') dbus = dependency('dbus-1') -gcr = dependency('gcr-base-3', version:'>=3.7.5') +gcr = dependency('gcr-base-3', version: '>= 3.7.5') gdkx11 = dependency('gdk-x11-3.0') gi = dependency('gobject-introspection-1.0', version: '>= 0.9.2') polkit = dependency('polkit-agent-1', version: '>= 0.100') @@ -47,11 +47,12 @@ X11 = dependency('x11') xml = dependency('libxml-2.0') nm_deps = [] -have_networkmanager = not get_option('disable_networkmanager') -if have_networkmanager +build_nm_agent = get_option('build_nm_agent') +if build_nm_agent nm_deps += dependency('libnm', version: '>= 1.10.4') nm_deps += dependency('libsecret-1', version: '>= 0.18') endif +message('Building NetworkManager agent: @0@'.format(build_nm_agent)) if get_option('build_recorder') gstreamer = dependency('gstreamer-1.0') @@ -60,6 +61,8 @@ else gstreamer = dependency('', required: false) gstreamer_base = dependency('', required: false) endif +message('Building recorder: @0@'.format(get_option('build_recorder'))) + # on some systems we need to find the math lib to make sure it builds cc = meson.get_compiler('c') @@ -72,7 +75,7 @@ python = find_program('python3') cinnamon_conf = configuration_data() cinnamon_conf.set_quoted('VERSION', version) cinnamon_conf.set_quoted('GETTEXT_PACKAGE', meson.project_name().to_lower()) -cinnamon_conf.set('HAVE_NETWORKMANAGER', have_networkmanager) +cinnamon_conf.set('BUILT_NM_AGENT', build_nm_agent) have_mallinfo = cc.has_function('mallinfo', prefix: '#include ') if have_mallinfo @@ -147,7 +150,7 @@ install_subdir( config_js_conf = configuration_data() config_js_conf.set('PACKAGE_NAME', meson.project_name().to_lower()) config_js_conf.set('PACKAGE_VERSION', version) -config_js_conf.set10('HAVE_NETWORKMANAGER', have_networkmanager) +config_js_conf.set10('BUILT_NM_AGENT', build_nm_agent) configure_file( input: 'js/misc/config.js.in', @@ -163,7 +166,9 @@ install_subdir( ) session_conf = configuration_data() -if have_networkmanager +# If cinnamon is configured to use its internal NetworkManager agent, do *not* require nm-applet +# by the session manager. +if build_nm_agent session_conf.set('REQUIRED', '') else session_conf.set('REQUIRED', 'nm-applet;') diff --git a/meson_options.txt b/meson_options.txt index 321192d8c6..ad69ee9414 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -13,10 +13,10 @@ option('build_recorder', value: true, description: 'Build the cinnamon recorder into source' ) -option('disable_networkmanager', +option('build_nm_agent', type: 'boolean', - value: false, - description: 'Build without networkmanager' + value: true, + description: 'Enable internal networkmanager agent' ) option('py3modules_dir', type : 'string', diff --git a/src/meson.build b/src/meson.build index 75a944766d..b3acf9e879 100644 --- a/src/meson.build +++ b/src/meson.build @@ -115,7 +115,7 @@ libcinnamon_deps = [ libcinnamon_deps += nm_deps -if have_networkmanager +if build_nm_agent cinnamon_sources += [ 'cinnamon-network-agent.c', 'cinnamon-network-agent.h', @@ -210,7 +210,7 @@ cinnamon_gir_includes = [ st_gir[0], ] -if have_networkmanager +if build_nm_agent cinnamon_gir_includes += ['NM-1.0'] endif