build: Format meson files

This will make adding future files less noisy.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
This commit is contained in:
Guido Günther
2025-03-05 11:30:50 +00:00
committed by Guido Günther
parent fe17c6d5ee
commit 99cc84c646
8 changed files with 366 additions and 438 deletions
+3 -14
View File
@@ -1,16 +1,5 @@
fbcli_sources = [ fbcli_sources = ['fbcli.c']
'fbcli.c',
]
fbcli_deps = [ fbcli_deps = [libfeedback_dep, gio, gio_unix]
libfeedback_dep,
gio,
gio_unix,
]
executable( executable('fbcli', fbcli_sources, dependencies: fbcli_deps, install: true)
'fbcli',
fbcli_sources,
dependencies: fbcli_deps,
install: true,
)
+17 -21
View File
@@ -4,39 +4,36 @@ namespace = 'LfbGdbus'
generated_dbus_sources = [] generated_dbus_sources = []
dbus_interfaces = [ dbus_interfaces = ['org.sigxcpu.Feedback.xml', 'org.sigxcpu.Feedback.Haptic.xml']
'org.sigxcpu.Feedback.xml',
'org.sigxcpu.Feedback.Haptic.xml',
]
generated_dbus_sources += gnome.gdbus_codegen('lfb-gdbus', generated_dbus_sources += gnome.gdbus_codegen(
'lfb-gdbus',
sources: dbus_interfaces, sources: dbus_interfaces,
object_manager: false, object_manager: false,
docbook: 'libfeedback', docbook: 'libfeedback',
interface_prefix: prefix, interface_prefix: prefix,
install_header: true, install_header: true,
install_dir: join_paths(get_option('includedir'), libname), install_dir: join_paths(get_option('includedir'), libname),
namespace : namespace) namespace: namespace,
)
dbus_header_dir = meson.current_build_dir() dbus_header_dir = meson.current_build_dir()
dbus_inc = include_directories('.') dbus_inc = include_directories('.')
install_data(dbus_interfaces, install_dir: ifacedir) install_data(dbus_interfaces, install_dir: ifacedir)
schemas = ['org.sigxcpu.feedbackd.gschema.xml'] schemas = ['org.sigxcpu.feedbackd.gschema.xml']
compiled = gnome.compile_schemas( compiled = gnome.compile_schemas(build_by_default: true)
build_by_default: true
)
compile_schemas = find_program('glib-compile-schemas', required: false) compile_schemas = find_program('glib-compile-schemas', required: false)
if compile_schemas.found() if compile_schemas.found()
test('Validate schema file', compile_schemas, test(
args: ['--strict', '--dry-run', meson.current_source_dir()]) 'Validate schema file',
compile_schemas,
args: ['--strict', '--dry-run', meson.current_source_dir()],
)
endif endif
install_data( install_data(schemas, install_dir: 'share/glib-2.0/schemas')
schemas,
install_dir: 'share/glib-2.0/schemas'
)
if get_option('daemon') if get_option('daemon')
@@ -54,21 +51,20 @@ configure_file(
) )
theme_json = ['default.json'] theme_json = ['default.json']
install_data( install_data(theme_json, install_dir: feedbackd_theme_dir)
theme_json,
install_dir: feedbackd_theme_dir,
)
if json_glib_validate.found() if json_glib_validate.found()
jsons = [] jsons = []
foreach theme : theme_json foreach theme : theme_json
jsons += (join_paths(meson.current_source_dir(), theme)) jsons += (join_paths(meson.current_source_dir(), theme))
endforeach endforeach
custom_target('validate-json', custom_target(
'validate-json',
build_by_default: true, build_by_default: true,
input: theme_json, input: theme_json,
output: 'json_validate_stamp', output: 'json_validate_stamp',
command: [json_glib_validate.full_path()] + jsons) command: [json_glib_validate.full_path()] + jsons,
)
endif endif
if get_option('udev') if get_option('udev')
+13 -19
View File
@@ -14,19 +14,23 @@ toml_data.set('VERSION', meson.project_version())
libfeedback_toml = configure_file( libfeedback_toml = configure_file(
input: 'libfeedback.toml.in', input: 'libfeedback.toml.in',
output: 'libfeedback.toml', output: 'libfeedback.toml',
configuration: toml_data configuration: toml_data,
) )
dependency('gi-docgen', version: '>= 2021.1', dependency(
'gi-docgen',
version: '>= 2021.1',
fallback: ['gi-docgen', 'dummy_dep'], fallback: ['gi-docgen', 'dummy_dep'],
native: true, native: true,
required: get_option('gtk_doc')) required: get_option('gtk_doc'),
)
gidocgen = find_program('gi-docgen') gidocgen = find_program('gi-docgen')
docs_dir = datadir / 'doc' docs_dir = datadir / 'doc'
custom_target('libfeedback-doc', custom_target(
'libfeedback-doc',
input: [libfeedback_toml, libfeedback_gir[0]], input: [libfeedback_toml, libfeedback_gir[0]],
output: 'libfeedback-0', output: 'libfeedback-0',
command: [ command: [
@@ -49,30 +53,20 @@ custom_target('libfeedback-doc',
endif endif
if get_option('man') if get_option('man')
manpages = [ manpages = [['fbcli', 1], ['fbd-theme-validate', 1], ['feedbackd', 8], ['feedback-themes', 5]]
['fbcli', 1],
['fbd-theme-validate', 1],
['feedbackd', 8],
['feedback-themes', 5],
]
rst2man = find_program('rst2man', 'rst2man.py', required: false) rst2man = find_program('rst2man', 'rst2man.py', required: false)
rst2man_flags = [ rst2man_flags = ['--syntax-highlight=none']
'--syntax-highlight=none',
]
foreach manpage : manpages foreach manpage : manpages
man_name = manpage[0] man_name = manpage[0]
man_section = manpage[1] man_section = manpage[1]
custom_target('man-@0@'.format(man_name), custom_target(
'man-@0@'.format(man_name),
input: '@0@.rst'.format(man_name), input: '@0@.rst'.format(man_name),
output: '@0@.@1@'.format(man_name, man_section), output: '@0@.@1@'.format(man_name, man_section),
command: [ command: [rst2man, rst2man_flags, '@INPUT@'],
rst2man,
rst2man_flags,
'@INPUT@',
],
capture: true, capture: true,
install: true, install: true,
install_dir: get_option('mandir') / 'man@0@'.format(man_section), install_dir: get_option('mandir') / 'man@0@'.format(man_section),
+17 -18
View File
@@ -6,25 +6,26 @@ libfeedback_link_args = []
libfeedback_symbols_file = 'libfeedback.syms' libfeedback_symbols_file = 'libfeedback.syms'
# Check linker flags # Check linker flags
ld_version_script_arg = '-Wl,--version-script,@0@'.format(meson.current_source_dir() / libfeedback_symbols_file) ld_version_script_arg = '-Wl,--version-script,@0@'.format(
if cc.links('int main() { return 0; }', args : ld_version_script_arg, name : 'ld_supports_version_script') meson.current_source_dir() / libfeedback_symbols_file,
)
if cc.links(
'int main() { return 0; }',
args: ld_version_script_arg,
name: 'ld_supports_version_script',
)
libfeedback_link_args += [ld_version_script_arg] libfeedback_link_args += [ld_version_script_arg]
endif endif
lfb_enum_headers = files([ lfb_enum_headers = files('lfb-event.h')
'lfb-event.h', lfb_enum_sources = gnome.mkenums_simple(
]) 'lfb-enums',
lfb_enum_sources = gnome.mkenums_simple('lfb-enums',
sources: lfb_enum_headers, sources: lfb_enum_headers,
install_header: true, install_header: true,
install_dir: libfeedback_header_dir, install_dir: libfeedback_header_dir,
) )
libfeedback_headers = [ libfeedback_headers = ['libfeedback.h', 'lfb-event.h', 'lfb-main.h']
'libfeedback.h',
'lfb-event.h',
'lfb-main.h',
]
libfeedback_sources = [ libfeedback_sources = [
generated_dbus_sources, generated_dbus_sources,
@@ -34,11 +35,7 @@ libfeedback_sources = [
'lfb-main.c', 'lfb-main.c',
] ]
libfeedback_deps = [ libfeedback_deps = [gio, gio_unix, glib]
gio,
gio_unix,
glib,
]
libfeedback_c_args = [ libfeedback_c_args = [
'-DG_LOG_DOMAIN="libfeedback"', '-DG_LOG_DOMAIN="libfeedback"',
@@ -91,7 +88,8 @@ if introspection
'--warn-all', '--warn-all',
] ]
libfeedback_gir = gnome.generate_gir(libfeedback, libfeedback_gir = gnome.generate_gir(
libfeedback,
sources: libfeedback_sources, sources: libfeedback_sources,
nsversion: apiversion, nsversion: apiversion,
namespace: 'Lfb', namespace: 'Lfb',
@@ -108,7 +106,8 @@ if introspection
) )
if get_option('vapi') if get_option('vapi')
libfeedback_vapi = gnome.generate_vapi('libfeedback-' + apiversion, libfeedback_vapi = gnome.generate_vapi(
'libfeedback-' + apiversion,
sources: libfeedback_gir[0], sources: libfeedback_gir[0],
packages: ['gio-2.0'], packages: ['gio-2.0'],
install: true, install: true,
+12 -26
View File
@@ -1,12 +1,10 @@
project('feedbackd', 'c', project(
'feedbackd',
'c',
version: '0.7.0', version: '0.7.0',
license: 'LGPLv3+', license: 'LGPLv3+',
meson_version: '>= 1.0.0', meson_version: '>= 1.0.0',
default_options : [ default_options: ['warning_level=1', 'buildtype=debugoptimized', 'c_std=gnu11'],
'warning_level=1',
'buildtype=debugoptimized',
'c_std=gnu11',
],
) )
gio = dependency('gio-2.0', version: '>=2.50.0') gio = dependency('gio-2.0', version: '>=2.50.0')
@@ -15,15 +13,12 @@ glib = dependency('glib-2.0', version: '>=2.50.0')
udev = dependency('udev', required: false) udev = dependency('udev', required: false)
if get_option('daemon') if get_option('daemon')
gobject = dependency('gobject-2.0', version: '>=2.50.0') gobject = dependency('gobject-2.0', version: '>=2.50.0')
gmobile = dependency('gmobile', gmobile = dependency(
'gmobile',
version: '>= 0.1.0', version: '>= 0.1.0',
fallback: ['gmobile', 'gmobile_dep'], fallback: ['gmobile', 'gmobile_dep'],
default_options: [ default_options: ['examples=false', 'introspection=false', 'gtk_doc=false', 'tests=false'],
'examples=false', )
'introspection=false',
'gtk_doc=false',
'tests=false',
])
gsound = dependency('gsound') gsound = dependency('gsound')
gudev = dependency('gudev-1.0', version: '>=232') gudev = dependency('gudev-1.0', version: '>=232')
json_glib = dependency('json-glib-1.0') json_glib = dependency('json-glib-1.0')
@@ -51,10 +46,7 @@ endif
run_data = configuration_data() run_data = configuration_data()
run_data.set('ABS_BUILDDIR', meson.current_build_dir()) run_data.set('ABS_BUILDDIR', meson.current_build_dir())
run_data.set('ABS_SRCDIR', meson.current_source_dir()) run_data.set('ABS_SRCDIR', meson.current_source_dir())
configure_file( configure_file(input: 'run.in', output: 'run', configuration: run_data)
input: 'run.in',
output: 'run',
configuration: run_data)
gnome = import('gnome') gnome = import('gnome')
@@ -103,10 +95,7 @@ global_c_args = [
'-DFBD_VERSION="@0@"'.format(meson.project_version()), '-DFBD_VERSION="@0@"'.format(meson.project_version()),
] ]
add_project_arguments( add_project_arguments(global_c_args + cc.get_supported_arguments(test_c_args), language: 'c')
global_c_args + cc.get_supported_arguments(test_c_args),
language: 'c'
)
introspection_feature = get_option('introspection') introspection_feature = get_option('introspection')
introspection = introspection_feature.enabled() or introspection_feature.auto() introspection = introspection_feature.enabled() or introspection_feature.auto()
@@ -116,10 +105,7 @@ libname = 'libfeedback-' + apiversion
json_glib_validate = find_program('json-glib-validate', required: false) json_glib_validate = find_program('json-glib-validate', required: false)
meson.add_install_script( meson.add_install_script(join_paths('build-aux', 'post_install.py'), datadir)
join_paths('build-aux', 'post_install.py'),
datadir
)
subdir('data') subdir('data')
subdir('libfeedback') subdir('libfeedback')
@@ -141,6 +127,6 @@ summary = [
' Vapi: @0@'.format(get_option('vapi')), ' Vapi: @0@'.format(get_option('vapi')),
' Tests: @0@'.format(get_option('tests')), ' Tests: @0@'.format(get_option('tests')),
'---------------', '---------------',
'' '',
] ]
message('\n'.join(summary)) message('\n'.join(summary))
+4 -22
View File
@@ -1,13 +1,8 @@
# Feedback daemon # Feedback daemon
if get_option('daemon') if get_option('daemon')
fbd_enum_headers = files([ fbd_enum_headers = files('fbd-event.h', 'fbd-feedback-led.h', 'fbd-feedback-vibra.h')
'fbd-event.h', fbd_enum_sources = gnome.mkenums_simple('fbd-enums', sources: fbd_enum_headers)
'fbd-feedback-led.h',
'fbd-feedback-vibra.h',
])
fbd_enum_sources = gnome.mkenums_simple('fbd-enums',
sources : fbd_enum_headers)
sources = [ sources = [
generated_dbus_sources, generated_dbus_sources,
@@ -38,22 +33,9 @@ sources = [
'fbd-udev.c', 'fbd-udev.c',
] ]
fbd_deps = [ fbd_deps = [gio, gio_unix, glib, gmobile, gobject, gsound, gudev, json_glib]
gio,
gio_unix,
glib,
gmobile,
gobject,
gsound,
gudev,
json_glib,
]
fbd_inc = [ fbd_inc = [include_directories('.'), libfeedback_inc, dbus_inc]
include_directories('.'),
libfeedback_inc,
dbus_inc,
]
fbd_lib = static_library( fbd_lib = static_library(
'fbd', 'fbd',
+15 -29
View File
@@ -2,10 +2,7 @@ if get_option('tests')
umockdev_dep = dependency('umockdev-1.0') umockdev_dep = dependency('umockdev-1.0')
add_test_setup ('umockdev', add_test_setup('umockdev', exe_wrapper: 'umockdev-wrapper', is_default: true)
exe_wrapper: 'umockdev-wrapper',
is_default: true
)
test_env = environment() test_env = environment()
test_env.set('G_TEST_SRCDIR', meson.current_source_dir()) test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
@@ -26,19 +23,11 @@ test_lfb_cflags = [
'-DTEST_DATA_DIR="@0@"'.format(join_paths(meson.current_source_dir(), 'data')), '-DTEST_DATA_DIR="@0@"'.format(join_paths(meson.current_source_dir(), 'data')),
] ]
test_lfb_link_args = [ test_lfb_link_args = ['-fPIC']
'-fPIC',
]
test_lfb_deps = [ test_lfb_deps = [libfeedback_dep, glib, gio_unix]
libfeedback_dep,
glib,
gio_unix,
]
lfb_tests = [ lfb_tests = ['lfb-event']
'lfb-event',
]
if get_option('daemon') if get_option('daemon')
# The integration test needs the daemon # The integration test needs the daemon
@@ -47,12 +36,14 @@ if get_option ('daemon')
endif endif
foreach test : lfb_tests foreach test : lfb_tests
t = executable('test-@0@'.format(test), t = executable(
'test-@0@'.format(test),
['test-@0@.c'.format(test)], ['test-@0@.c'.format(test)],
c_args: test_lfb_cflags, c_args: test_lfb_cflags,
pie: true, pie: true,
link_args: test_lfb_link_args, link_args: test_lfb_link_args,
dependencies : test_lfb_deps) dependencies: test_lfb_deps,
)
test(test, t, env: test_env) test(test, t, env: test_env)
endforeach endforeach
@@ -67,14 +58,9 @@ test_fbd_cflags = [
'-DTEST_DATA_DIR="@0@"'.format(join_paths(meson.current_source_dir(), 'data')), '-DTEST_DATA_DIR="@0@"'.format(join_paths(meson.current_source_dir(), 'data')),
] ]
test_fbd_link_args = [ test_fbd_link_args = ['-fPIC']
'-fPIC',
]
test_fbd_deps = [ test_fbd_deps = [fbd_dep, umockdev_dep]
fbd_dep,
umockdev_dep,
]
# HW independent tests # HW independent tests
fbd_tests = [ fbd_tests = [
@@ -87,15 +73,15 @@ fbd_tests = [
] ]
foreach test : fbd_tests foreach test : fbd_tests
t = executable('test-@0@'.format(test), t = executable(
['test-@0@.c'.format(test), 'test-@0@'.format(test),
'testlib.c', ['test-@0@.c'.format(test), 'testlib.c', generated_dbus_sources[1]],
generated_dbus_sources[1]],
c_args: test_fbd_cflags, c_args: test_fbd_cflags,
pie: true, pie: true,
link_args: test_fbd_link_args, link_args: test_fbd_link_args,
include_directories: fbd_inc, include_directories: fbd_inc,
dependencies : test_fbd_deps) dependencies: test_fbd_deps,
)
test(test, t, env: test_env_fbd) test(test, t, env: test_env_fbd)
endforeach endforeach
+1 -5
View File
@@ -2,8 +2,4 @@ service_file = 'org.sigxcpu.Feedback.service'
service_data = configuration_data() service_data = configuration_data()
service_data.set('ABS_BUILDDIR', meson.project_build_root()) service_data.set('ABS_BUILDDIR', meson.project_build_root())
configure_file( configure_file(input: service_file + '.in', output: service_file, configuration: service_data)
input : service_file + '.in',
output : service_file,
configuration : service_data
)