2021-08-30 13:11:42 +02:00
|
|
|
project('upower', 'c',
|
2025-08-26 16:04:24 +08:00
|
|
|
version: '1.90.10',
|
2021-08-30 13:11:42 +02:00
|
|
|
license: 'GPLv2+',
|
|
|
|
|
default_options: [
|
|
|
|
|
'buildtype=debugoptimized',
|
|
|
|
|
'warning_level=1',
|
|
|
|
|
'c_std=gnu99',
|
|
|
|
|
],
|
2024-03-11 14:53:53 +01:00
|
|
|
meson_version: '>= 0.60.0')
|
2021-08-30 13:11:42 +02:00
|
|
|
|
2024-02-09 14:20:13 +08:00
|
|
|
soversion = 3
|
|
|
|
|
current = 1
|
2021-08-30 13:11:42 +02:00
|
|
|
revision = 0
|
|
|
|
|
libversion = '@0@.@1@.@2@'.format(soversion, current, revision)
|
|
|
|
|
|
|
|
|
|
gnome = import('gnome')
|
|
|
|
|
i18n = import('i18n')
|
|
|
|
|
|
|
|
|
|
cc = meson.get_compiler('c')
|
|
|
|
|
|
|
|
|
|
# TODO: Get rid of these by including config.h where needed
|
|
|
|
|
add_project_arguments([
|
|
|
|
|
'-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()),
|
|
|
|
|
'-DPACKAGE_VERSION="@0@"'.format(meson.project_version()),
|
|
|
|
|
], language: 'c')
|
|
|
|
|
|
|
|
|
|
cdata = configuration_data()
|
|
|
|
|
cdata.set_quoted('GETTEXT_PACKAGE', meson.project_name())
|
|
|
|
|
cdata.set_quoted('PACKAGE_VERSION', meson.project_version())
|
|
|
|
|
cdata.set_quoted('VERSION', meson.project_version())
|
|
|
|
|
cdata.set_quoted('PACKAGE_SYSCONF_DIR', get_option('sysconfdir'))
|
|
|
|
|
|
Add support for conf.d style dirs (UPower.conf.d)
This change adds the feature to read config from conf.d style
directories (UPower.conf.d), commonly supported by other tools, as an
extension of the main config file.
This is useful and convenient in several situations, for example:
- distributions can set different values from the defaults shipped
upstream without having to modify the main UPower.conf
- different packages or config-management tools can change config just
by adding, removing or modifying files in that directory
The main config file, e.g. '/etc/UPower/UPower.conf', will be
processed first, and then files in the UPower.conf.d dir, if existing.
The directory to use is derived automatically, e.g.
'/etc/UPower/UPower.conf.d/' if the main config file is
'/etc/UPower/UPower.conf'. Only files within that directory are
considered, and only those with valid config-group 'UPower' and with
the filename format: starting with '00-' to '99-', ending in '.conf'
and with alphanumeric characters, dash or underscore in between.
The candidate files within the given directory are sorted (with
g_strcmp0(), so the ordering will be as with strcmp()). The
configuration in the files being processed later will override
previous config, in particular the main config, but also the one from
previous files processed, if the Group and Key coincide.
Add also relevant integration test: 'test_conf_d_support'
2025-10-10 10:36:22 +02:00
|
|
|
glib_min_version = '2.76'
|
2021-08-30 13:11:42 +02:00
|
|
|
|
|
|
|
|
glib_version_def = 'GLIB_VERSION_@0@_@1@'.format(
|
|
|
|
|
glib_min_version.split('.')[0], glib_min_version.split('.')[1])
|
|
|
|
|
common_cflags = cc.get_supported_arguments([
|
|
|
|
|
'-DGLIB_VERSION_MIN_REQUIRED=' + glib_version_def,
|
|
|
|
|
'-DGLIB_VERSION_MAX_ALLOWED=' + glib_version_def,
|
|
|
|
|
])
|
|
|
|
|
add_project_arguments(common_cflags, language: 'c')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
glib_dep = dependency('glib-2.0', version: '>=' + glib_min_version)
|
|
|
|
|
gobject_dep = dependency('gobject-2.0', version: '>=' + glib_min_version)
|
|
|
|
|
gio_dep = dependency('gio-2.0', version: '>=' + glib_min_version)
|
|
|
|
|
gio_unix_dep = dependency('gio-unix-2.0', version: '>=' + glib_min_version)
|
2022-02-07 11:09:21 +01:00
|
|
|
m_dep = cc.find_library('m', required: true)
|
2021-08-30 13:11:42 +02:00
|
|
|
|
2024-08-12 15:43:25 +08:00
|
|
|
polkit = dependency('polkit-gobject-1', version: '>= 0.103',
|
|
|
|
|
required: get_option('polkit').disable_auto_if(host_machine.system() != 'linux'))
|
2024-08-07 22:03:12 +08:00
|
|
|
if polkit.found()
|
|
|
|
|
cdata.set('HAVE_POLKIT', '1')
|
|
|
|
|
if polkit.version().version_compare('>= 0.114')
|
|
|
|
|
cdata.set('HAVE_POLKIT_0_114', '1')
|
|
|
|
|
endif
|
|
|
|
|
cdata.set_quoted ('POLKIT_ACTIONDIR', polkit.get_variable(pkgconfig: 'actiondir'))
|
|
|
|
|
endif
|
|
|
|
|
|
2022-02-07 15:56:48 +01:00
|
|
|
xsltproc = find_program('xsltproc', disabler: true, required: get_option('gtk-doc') or get_option('man'))
|
2021-08-30 13:11:42 +02:00
|
|
|
|
|
|
|
|
# Resolve OS backend
|
|
|
|
|
os_backend = get_option('os_backend')
|
|
|
|
|
if os_backend == 'auto'
|
|
|
|
|
# Likely needs to be updated when options are added
|
|
|
|
|
if host_machine.system() in ['linux', 'freebsd', 'openbsd']
|
|
|
|
|
os_backend = host_machine.system()
|
|
|
|
|
else
|
|
|
|
|
os_backend = 'dummy'
|
|
|
|
|
endif
|
|
|
|
|
endif
|
|
|
|
|
cdata.set_quoted('BACKEND', os_backend)
|
|
|
|
|
|
|
|
|
|
# Backend specific dependencies
|
|
|
|
|
gudev_dep = dependency('', required: false)
|
|
|
|
|
idevice_dep = dependency('', required: false)
|
|
|
|
|
plist_dep = dependency('', required: false)
|
|
|
|
|
gobject_introspection = dependency('gobject-introspection-1.0', required: get_option('introspection'))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if os_backend == 'linux'
|
2023-07-04 16:48:53 +02:00
|
|
|
gudev_dep = dependency('gudev-1.0', version: '>= 238')
|
2021-08-30 13:11:42 +02:00
|
|
|
idevice_dep = dependency('libimobiledevice-1.0',
|
|
|
|
|
version : '>= 0.9.7',
|
|
|
|
|
required : get_option('idevice'))
|
|
|
|
|
|
|
|
|
|
if idevice_dep.found()
|
|
|
|
|
plist_dep = dependency('libplist-2.0', required: false)
|
|
|
|
|
if not plist_dep.found()
|
2021-09-13 12:32:14 +02:00
|
|
|
plist_dep = dependency('libplist', required: true)
|
2021-08-30 13:11:42 +02:00
|
|
|
endif
|
2021-09-10 21:46:44 -07:00
|
|
|
cdata.set10('HAVE_IDEVICE', true)
|
2021-08-30 13:11:42 +02:00
|
|
|
endif
|
|
|
|
|
|
2023-07-06 07:17:01 +02:00
|
|
|
udevrulesdir = get_option('udevrulesdir')
|
|
|
|
|
if udevrulesdir == 'auto'
|
2021-08-30 13:11:42 +02:00
|
|
|
udev_dep = dependency('udev', required: true)
|
2022-05-10 15:39:24 +02:00
|
|
|
udevrulesdir = udev_dep.get_variable(pkgconfig: 'udev_dir') / 'rules.d'
|
2023-07-06 07:17:01 +02:00
|
|
|
endif
|
2021-08-30 13:11:42 +02:00
|
|
|
|
2023-07-06 07:17:01 +02:00
|
|
|
udevhwdbdir = get_option('udevhwdbdir')
|
|
|
|
|
if udevhwdbdir == 'auto'
|
2022-03-28 15:43:16 +02:00
|
|
|
udev_dep = dependency('udev', required: true)
|
2022-05-10 15:39:24 +02:00
|
|
|
udevhwdbdir = udev_dep.get_variable(pkgconfig: 'udev_dir') / 'hwdb.d'
|
2023-07-06 07:17:01 +02:00
|
|
|
endif
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
historydir = get_option('historydir')
|
|
|
|
|
if historydir == ''
|
|
|
|
|
historydir = get_option('prefix') / get_option('localstatedir') / 'lib' / 'upower'
|
2022-03-28 15:43:16 +02:00
|
|
|
endif
|
|
|
|
|
|
2024-07-23 14:46:36 +08:00
|
|
|
statedir = get_option('statedir')
|
|
|
|
|
if statedir == ''
|
|
|
|
|
statedir = get_option('prefix') / get_option('localstatedir') / 'lib' / 'upower'
|
|
|
|
|
endif
|
|
|
|
|
|
2021-08-30 13:11:42 +02:00
|
|
|
dbusdir = get_option('datadir') / 'dbus-1'
|
|
|
|
|
systemdsystemunitdir = get_option('systemdsystemunitdir')
|
|
|
|
|
if systemdsystemunitdir == ''
|
|
|
|
|
systemd_dep = dependency('systemd')
|
2022-05-10 15:39:24 +02:00
|
|
|
systemdsystemunitdir = systemd_dep.get_variable(pkgconfig: 'systemdsystemunitdir')
|
2021-08-30 13:11:42 +02:00
|
|
|
endif
|
|
|
|
|
|
2024-08-08 16:08:01 +08:00
|
|
|
datadir = get_option('datadir')
|
|
|
|
|
if datadir == ''
|
|
|
|
|
datadir = join_paths(prefix, get_option('datadir'))
|
|
|
|
|
endif
|
|
|
|
|
|
2021-08-30 13:11:42 +02:00
|
|
|
# Generate configuration file
|
|
|
|
|
config_h = configure_file(output: 'config.h', configuration: cdata)
|
|
|
|
|
|
|
|
|
|
subdir('etc')
|
|
|
|
|
subdir('rules')
|
|
|
|
|
subdir('po')
|
|
|
|
|
subdir('dbus')
|
|
|
|
|
subdir('libupower-glib')
|
|
|
|
|
subdir('src')
|
|
|
|
|
subdir('tools')
|
|
|
|
|
subdir('doc')
|
2024-10-08 02:55:33 +02:00
|
|
|
subdir('data/zsh-completion')
|
2024-08-08 16:08:01 +08:00
|
|
|
subdir('policy')
|
2021-08-30 13:11:42 +02:00
|
|
|
|
|
|
|
|
pkgconfig = import('pkgconfig')
|
|
|
|
|
pkgconfig.generate(
|
|
|
|
|
name: 'upower-glib',
|
|
|
|
|
description: 'UPower is a system daemon for managing power devices',
|
|
|
|
|
version: meson.project_version(),
|
|
|
|
|
libraries: libupower_glib,
|
2024-08-07 22:03:12 +08:00
|
|
|
requires: [glib_dep, gobject_dep, polkit],
|
2021-08-30 13:11:42 +02:00
|
|
|
subdirs: 'libupower-glib',
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
output = []
|
|
|
|
|
output += 'UPower ' + meson.project_version()
|
|
|
|
|
output += 'System Paths'
|
|
|
|
|
output += ' prefix: ' + get_option('prefix')
|
|
|
|
|
output += ' libdir: ' + get_option('libdir')
|
|
|
|
|
output += ' libexecdir: ' + get_option('prefix') / get_option('libexecdir')
|
|
|
|
|
output += ' bindir: ' + get_option('prefix') / get_option('bindir')
|
2022-03-05 11:09:14 +01:00
|
|
|
output += ' sbindir: ' + get_option('prefix') / get_option('sbindir')
|
|
|
|
|
output += ' datadir: ' + get_option('prefix') / get_option('datadir')
|
2021-08-30 13:11:42 +02:00
|
|
|
output += ' sysconfdir: ' + get_option('sysconfdir')
|
|
|
|
|
output += ' localstatedir: ' + get_option('prefix') / get_option('localstatedir')
|
|
|
|
|
output += ' historydir: ' + historydir
|
|
|
|
|
|
|
|
|
|
output += '\nFeatures'
|
|
|
|
|
output += ' Backend: ' + os_backend
|
|
|
|
|
output += ' libimobiledevice support: ' + idevice_dep.found().to_string()
|
|
|
|
|
output += ' Building api docs: ' + get_option('gtk-doc').to_string()
|
|
|
|
|
output += ' Building man pages: ' + get_option('man').to_string()
|
|
|
|
|
|
|
|
|
|
message('\n'+'\n'.join(output)+'\n')
|