Skip to content

Commit

Permalink
build: Improve variable names for NetworkManager options.
Browse files Browse the repository at this point in the history
This does not change the default build but is more descriptive
about what the option is doing.

ref: #12714
  • Loading branch information
mtwebster committed Feb 4, 2025
1 parent c451c0d commit 9e9bf8a
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 13 deletions.
4 changes: 4 additions & 0 deletions docs/reference/cinnamon/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion js/misc/config.js.in
Original file line number Diff line number Diff line change
Expand Up @@ -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@;
2 changes: 1 addition & 1 deletion js/ui/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
Expand Down
17 changes: 11 additions & 6 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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')
Expand All @@ -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')
Expand All @@ -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 <malloc.h>')
if have_mallinfo
Expand Down Expand Up @@ -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',
Expand All @@ -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;')
Expand Down
6 changes: 3 additions & 3 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -210,7 +210,7 @@ cinnamon_gir_includes = [
st_gir[0],
]

if have_networkmanager
if build_nm_agent
cinnamon_gir_includes += ['NM-1.0']
endif

Expand Down

0 comments on commit 9e9bf8a

Please sign in to comment.