Merge branch 'format-meson' into 'main'

Split out libfeedback.h and check more things in CI

See merge request Librem5/feedbackd!158
This commit is contained in:
Guido Günther
2025-03-05 11:40:25 +00:00
20 changed files with 591 additions and 468 deletions
+7 -2
View File
@@ -5,6 +5,9 @@
(c-basic-offset . 2)
(display-fill-column-indicator-column . 100)
))
(rust-mode . (
(indent-tabs-mode . nil)
))
(setq auto-mode-alist (cons '("\\.ui$" . nxml-mode) auto-mode-alist))
(nxml-mode . (
(indent-tabs-mode . nil)
@@ -13,8 +16,10 @@
(css-indent-offset . 2)
))
(js-mode . (
(indent-tabs-mode . nil)
(indent-tabs-mode . nil)
(js-indent-level . 2)
))
(meson-mode . (
(indent-tabs-mode . nil)
))
)
+8 -7
View File
@@ -4,32 +4,33 @@ root = true
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 100
[meson.build]
indent_size = 2
tab_size = 2
indent_style = space
[*.{c,h,h.in}]
[*.{c,h,c.in,h.in}]
indent_size = 2
tab_size = 2
indent_style = space
max_line_length = 80
[*.css]
indent_size = 2
tab_size = 2
indent_style = space
[*.xml]
indent_size = 2
tab_size = 2
indent_style = space
[*.json]
indent_size = 2
tab_size = 2
indent_style = space
[*.{xml,ui}]
indent_size = 2
tab_size = 2
indent_style = space
[NEWS]
max_line_length = 72
+18 -6
View File
@@ -1,12 +1,13 @@
---
include:
- remote: 'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/34039cd573a2df832d465bc9e4c5f543571f5241/templates/ci-fairy.yml'
- remote: 'https://gitlab.gnome.org/guidog/meta-phosh/-/raw/f3c92e90dcc0d65322888217429b75dd101bd0d3/ci/phosh-common-jobs.yml'
- remote: 'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/34039cd573a2df832d465bc9e4c5f543571f5241/templates/ci-fairy.yml'
- remote: 'https://gitlab.gnome.org/guidog/meta-phosh/-/raw/0ed15edd821f8afacbf7a9c0f2a6266873289115/ci/phosh-common-jobs.yml'
stages:
- build
- test
- style-checks
- package
- build
- test
- style-checks
- package
workflow:
rules:
@@ -96,12 +97,23 @@ test:native-debian-trixie:
variables:
- $PKG_ONLY == "1"
check-consistency:
<<: *tags
stage: test
extends: .phosh-check-consistency
format-check:
<<: *tags
stage: style-checks
extends: .phosh-format-check
allow_failure: true
check-meson:
<<: *tags
stage: style-checks
extends:
- .phosh-check-meson
package:deb-debian-trixie:arm64:
tags:
- librem5:arm64
+102
View File
@@ -0,0 +1,102 @@
#!/bin/bash
#
# Copyright (C) 2024 The Phosh developers
# SPDX-License-Identifier: GPL-3.0-or-later
# Author: Guido Günther <agx@sigxcpu.org>
#
# Check if NEWS, changelog, meson and metainfo are in sync
set -e
COLOR=
if [ -n "${TERM}" ] && [ "${TERM}" != "dumb" ]; then
COLOR=1
fi
function log
{
local level="${1}"
local fd=2
local use_color
shift
if [ -n "${COLOR}" ]; then
[ "${level}" == warn ] || [ "${level}" == error ] || fd=1
! [ -t "${fd}" ] || use_color=1
if [ -n "${use_color}" ]; then
case "${level}" in
warn)
tput setaf 1
;;
error)
tput bold; tput setaf 1
;;
info)
tput setaf 2
;;
esac
fi
fi
echo "$@"
[ -z "${use_color}" ] || tput sgr0
}
if [ -f debian/changelog ]; then
log info "Fetching version from d/changelog"
VERSION=$(dpkg-parsechangelog -SVersion)
elif [ -f meson.build ]; then
log info "Fetching version from meson build file"
VERSION=$(sed -n "s/.*version\s*:\s*'\([0-9].*\)'.*/\1/p" meson.build)
else
log error "E: Don't know how to get version information"
exit 1
fi
echo "I: Checking for '${VERSION}'"
# News
if ! head -1 NEWS | grep -E -qs "\s+${VERSION}\s*$"; then
log error "E: Version ${VERSION} not in NEWS file"
if [[ "${VERSION}" =~ (~|-)dev ]]; then
log info "I: Unreleased development version, no need to check NEWS"
else
exit 1
fi
else
log info "I: Found matching news entry"
fi
# meson.build
MESON_VERSION="${VERSION/\~/.}"
if [ -f meson.build ]; then
if ! grep -qs "version\s*:\s*'$MESON_VERSION'" meson.build; then
log error "E: Version ${MESON_VERSION} not in meson.build file"
exit 1
else
log info "I: Found matching meson version entry"
fi
else
log info "I: no meson project"
fi
# appstream info
METAINFO=$(ls data/*metainfo.xml.in* 2>/dev/null || true)
if [ -z "${METAINFO}" ]; then
log warn "W: No metainfo"
exit 0
fi
if ! grep -qs "$MESON_VERSION\"" "${METAINFO}"; then
log error "E: Version ${MESON_VERSION} not in metainfo ${METAINFO}"
if [[ "${VERSION}" =~ (~|-)(alpha|beta|dev|rc) ]]; then
log info "I: Not a stable release, no metainfo is fine"
else
exit 1
fi
else
log info "I: Found matching metainfo entry"
fi
+39
View File
@@ -0,0 +1,39 @@
#!/bin/bash
#
# Copyright (C) 2025 The Phosh developers
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# Author: Guido Günther <agx@sigxcpu.org>
ret=0
TMPDIR=$(mktemp -d)
# We check files individually so we can print the diff:
while IFS= read -r -d '' file; do
if ! meson format -e --check-only "$file"; then
echo
echo "Meson file '${file}' needs reformat:"
meson format -e "$file" > "${TMPDIR}/meson.build"
diff -u "$file" "${TMPDIR}/meson.build"
rm -f "${TMPDIR}/meson.build"
ret=1
fi
done < <(find . -name '*.build' -print0)
if [ -n "$TMPDIR" ]; then
rmdir "${TMPDIR}"
fi
if [ $ret -ne 0 ]; then
cat <<EOF
To reformat all files run:
meson format -e --recursive --inplace
EOF
fi
exit $ret
+5 -1
View File
@@ -1,11 +1,15 @@
#!/bin/bash
#
# Copyright (C) 2024 The Phosh developers
# SPDX-License-Identifier: GPL-3.0-or-later
# Author: Guido Günther <agx@sigxcpu.org>
cd po/ || exit 1
# barf on untranslated C files. Seems intltool
# can't be told to exit with non-zero exit status
# in this case
if intltool-update -m 2>&1 | grep -E -qs '/.*\.(c|ui)'; then
if intltool-update -m 2>&1 | grep -E -qs '/.*\.(c|ui|in)'; then
intltool-update -m
exit 1
fi
+3
View File
@@ -110,6 +110,8 @@ sp_cmt_cpp_start = add
#
# Add or remove space between #else or #endif and a trailing comment.
sp_endif_cmt = add
# Offset value that controls the indentation of the body of a multiline #define
pp_multiline_define_body_indent = 2
# Newlines at the start and end of the file.
nl_start_of_file = remove
@@ -143,3 +145,4 @@ sp_before_sparen = add
# Add spaces around assignments and arithmethic operators
sp_assign = add
sp_arith = add
+5
View File
@@ -297,6 +297,11 @@ busctl call --user org.sigxcpu.Feedback /org/sigxcpu/Feedback org.sigxcpu.Feedba
The API is exported as a separate interface `org.sigxcpu.Feedback.Haptic` which is only available when
a haptic device is found.
## Getting in Touch
- Issue tracker: <https://source.puri.sm/agx/feedbackd/-/issues>
- Matrix: <https://matrix.to/#/#phosh:sigxcpu.org>
## Documentation
- [Libfeedback API](https://honk.sigxcpu.org/projects/feedbackd/doc/)
+3 -14
View File
@@ -1,16 +1,5 @@
fbcli_sources = [
'fbcli.c',
]
fbcli_sources = ['fbcli.c']
fbcli_deps = [
libfeedback_dep,
gio,
gio_unix,
]
fbcli_deps = [libfeedback_dep, gio, gio_unix]
executable(
'fbcli',
fbcli_sources,
dependencies: fbcli_deps,
install: true,
)
executable('fbcli', fbcli_sources, dependencies: fbcli_deps, install: true)
+66 -70
View File
@@ -4,95 +4,91 @@ namespace = 'LfbGdbus'
generated_dbus_sources = []
dbus_interfaces = [
'org.sigxcpu.Feedback.xml',
'org.sigxcpu.Feedback.Haptic.xml',
]
dbus_interfaces = ['org.sigxcpu.Feedback.xml', 'org.sigxcpu.Feedback.Haptic.xml']
generated_dbus_sources += gnome.gdbus_codegen('lfb-gdbus',
sources : dbus_interfaces,
object_manager : false,
docbook : 'libfeedback',
interface_prefix : prefix,
install_header : true,
install_dir : join_paths(get_option('includedir'), libname),
namespace : namespace)
generated_dbus_sources += gnome.gdbus_codegen(
'lfb-gdbus',
sources: dbus_interfaces,
object_manager: false,
docbook: 'libfeedback',
interface_prefix: prefix,
install_header: true,
install_dir: join_paths(get_option('includedir'), libname),
namespace: namespace,
)
dbus_header_dir = meson.current_build_dir()
dbus_inc = include_directories('.')
install_data(dbus_interfaces, install_dir: ifacedir)
schemas = ['org.sigxcpu.feedbackd.gschema.xml']
compiled = gnome.compile_schemas(
build_by_default: true
)
compiled = gnome.compile_schemas(build_by_default: true)
compile_schemas = find_program('glib-compile-schemas', required: false)
if compile_schemas.found()
test('Validate schema file', compile_schemas,
args: ['--strict', '--dry-run', meson.current_source_dir()])
test(
'Validate schema file',
compile_schemas,
args: ['--strict', '--dry-run', meson.current_source_dir()],
)
endif
install_data(
schemas,
install_dir: 'share/glib-2.0/schemas'
)
install_data(schemas, install_dir: 'share/glib-2.0/schemas')
if get_option('daemon')
service_data = configuration_data()
service_data.set('libexecdir', libexecdir)
service_file = 'org.sigxcpu.Feedback.service'
service_data = configuration_data()
service_data.set('libexecdir', libexecdir)
service_file = 'org.sigxcpu.Feedback.service'
configure_file(
input : service_file + '.in',
output : service_file,
configuration : service_data,
install : true,
install_dir: servicedir,
)
configure_file(
input: service_file + '.in',
output: service_file,
configuration: service_data,
install: true,
install_dir: servicedir,
)
theme_json = ['default.json']
install_data(
theme_json,
install_dir: feedbackd_theme_dir,
)
theme_json = ['default.json']
install_data(theme_json, install_dir: feedbackd_theme_dir)
if json_glib_validate.found()
jsons = []
foreach theme : theme_json
jsons += (join_paths(meson.current_source_dir(), theme))
endforeach
custom_target('validate-json',
build_by_default: true,
input: theme_json,
output: 'json_validate_stamp',
command: [json_glib_validate.full_path()] + jsons)
endif
if get_option('udev')
install_data('90-feedbackd.rules', install_dir: udevdir)
endif
systemd_user_unit_dir = get_option('systemd_user_unit_dir')
systemd_dep = dependency('systemd', required: false)
if systemd_user_unit_dir == ''
if systemd_dep.found()
systemd_user_unit_dir = systemd_dep.get_variable('systemd_user_unit_dir')
else
systemd_user_unit_dir = prefix / libdir / 'systemd' / 'user'
if json_glib_validate.found()
jsons = []
foreach theme : theme_json
jsons += (join_paths(meson.current_source_dir(), theme))
endforeach
custom_target(
'validate-json',
build_by_default: true,
input: theme_json,
output: 'json_validate_stamp',
command: [json_glib_validate.full_path()] + jsons,
)
endif
endif
# Alert slider Systemd user service
alert_slider_unit = 'fbd-alert-slider.service'
configure_file(
input : alert_slider_unit + '.in',
output : alert_slider_unit,
configuration : service_data,
install : true,
install_dir : systemd_user_unit_dir,
)
if get_option('udev')
install_data('90-feedbackd.rules', install_dir: udevdir)
endif
endif # daemon
systemd_user_unit_dir = get_option('systemd_user_unit_dir')
systemd_dep = dependency('systemd', required: false)
if systemd_user_unit_dir == ''
if systemd_dep.found()
systemd_user_unit_dir = systemd_dep.get_variable('systemd_user_unit_dir')
else
systemd_user_unit_dir = prefix / libdir / 'systemd' / 'user'
endif
endif
# Alert slider Systemd user service
alert_slider_unit = 'fbd-alert-slider.service'
configure_file(
input: alert_slider_unit + '.in',
output: alert_slider_unit,
configuration: service_data,
install: true,
install_dir: systemd_user_unit_dir,
)
endif # daemon
+3 -4
View File
@@ -34,11 +34,11 @@ capping the noisiness for each limit:
1. The currently selected profile provides the (global) upper limit for noisiness
2. Per application settings impose another upper limit
1. Per application settings impose another upper limit
3. Per event noisiness is the last noisiness constraint
1. Per event noisiness is the last noisiness constraint
4. All feedback consistent with the resulting limit are selected
1. All feedback consistent with the resulting limit are selected
and run to provide the feedback to the user
With the above a feedback theme in YAML format could look like:
@@ -69,7 +69,6 @@ silent:
At the time of writing the theme format is daemon dependent. E.g. feedbackd
uses a format [similar to the above in JSON](https://source.puri.sm/Librem5/feedbackd/-/blob/main/data/default.json)
# Recommendations
- The silent theme should not produce any audible feedback. This includes
+50 -55
View File
@@ -1,78 +1,73 @@
if get_option('gtk_doc')
expand_content_md_files = [
'overview.md',
'build-howto.md',
'initialization.md',
'Event-naming-spec-0.0.0.md',
'Feedback-theme-spec-0.0.0.md',
]
expand_content_md_files = [
'overview.md',
'build-howto.md',
'initialization.md',
'Event-naming-spec-0.0.0.md',
'Feedback-theme-spec-0.0.0.md',
]
toml_data = configuration_data()
toml_data.set('VERSION', meson.project_version())
toml_data = configuration_data()
toml_data.set('VERSION', meson.project_version())
libfeedback_toml = configure_file(
input: 'libfeedback.toml.in',
output: 'libfeedback.toml',
configuration: toml_data
)
libfeedback_toml = configure_file(
input: 'libfeedback.toml.in',
output: 'libfeedback.toml',
configuration: toml_data,
)
dependency('gi-docgen', version: '>= 2021.1',
fallback: ['gi-docgen', 'dummy_dep'],
native: true,
required: get_option('gtk_doc'))
dependency(
'gi-docgen',
version: '>= 2021.1',
fallback: ['gi-docgen', 'dummy_dep'],
native: true,
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',
input: [ libfeedback_toml, libfeedback_gir[0] ],
output: 'libfeedback-0',
command: [
gidocgen,
'generate',
'--quiet',
'--add-include-path=@0@'.format(meson.current_build_dir() / '../src'),
'--config=@INPUT0@',
'--output-dir=@OUTPUT@',
'--no-namespace-dir',
'--content-dir=@0@'.format(meson.current_source_dir()),
'@INPUT1@',
],
depend_files: [ expand_content_md_files ],
build_by_default: true,
install: true,
install_dir: docs_dir,
)
custom_target(
'libfeedback-doc',
input: [libfeedback_toml, libfeedback_gir[0]],
output: 'libfeedback-0',
command: [
gidocgen,
'generate',
'--quiet',
'--fatal-warnings',
'--add-include-path=@0@'.format(meson.current_build_dir() / '../src'),
'--config=@INPUT0@',
'--output-dir=@OUTPUT@',
'--no-namespace-dir',
'--content-dir=@0@'.format(meson.current_source_dir()),
'@INPUT1@',
],
depend_files: [expand_content_md_files],
build_by_default: true,
install: true,
install_dir: docs_dir,
)
endif
if get_option('man')
manpages = [
['fbcli', 1],
['fbd-theme-validate', 1],
['feedbackd', 8],
['feedback-themes', 5],
]
manpages = [['fbcli', 1], ['fbd-theme-validate', 1], ['feedbackd', 8], ['feedback-themes', 5]]
rst2man = find_program('rst2man', 'rst2man.py', required: false)
rst2man_flags = [
'--syntax-highlight=none',
]
rst2man_flags = ['--syntax-highlight=none']
foreach manpage: manpages
foreach manpage : manpages
man_name = manpage[0]
man_section = manpage[1]
custom_target('man-@0@'.format(man_name),
custom_target(
'man-@0@'.format(man_name),
input: '@0@.rst'.format(man_name),
output: '@0@.@1@'.format(man_name, man_section),
command: [
rst2man,
rst2man_flags,
'@INPUT@',
],
command: [rst2man, rst2man_flags, '@INPUT@'],
capture: true,
install: true,
install_dir: get_option('mandir') / 'man@0@'.format(man_section),
@@ -1,9 +1,12 @@
/*
* Copyright (C) 2020 Purism SPC
* 2025 The Phosh Developers
*
* SPDX-License-Identifier: LGPL-2.1+
*
* Author: Guido Günther <agx@sigxcpu.org>
*/
#include "libfeedback.h"
#include "lfb-main.h"
#include "lfb-gdbus.h"
#include "lfb-priv.h"
+27
View File
@@ -0,0 +1,27 @@
/*
* Copyright (C) 2025 The Phosh Developers
*
* SPDX-License-Identifier: LGPL-2.1+
*/
#pragma once
#include "lfb-gdbus.h"
#include <glib.h>
#if !defined (__LIBFEEDBACK_H_INSIDE__) && !defined (LIBFEEDBACK_COMPILATION)
#error "Only <libfeedback.h> can be included directly."
#endif
G_BEGIN_DECLS
gboolean lfb_init (const gchar *app_id, GError **error);
void lfb_uninit (void);
void lfb_set_app_id (const char *app_id);
const char *lfb_get_app_id (void);
gboolean lfb_is_initted (void);
void lfb_set_feedback_profile (const char *profile);
const char *lfb_get_feedback_profile (void);
LfbGdbusFeedback *lfb_get_proxy (void);
G_END_DECLS
+2 -9
View File
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2020 Purism SPC
* 2025 The Phosh Developers
*
* SPDX-License-Identifier: LGPL-2.1+
*/
@@ -18,14 +19,6 @@ G_BEGIN_DECLS
#include "lfb-enums.h"
#include "lfb-event.h"
#include "lfb-gdbus.h"
gboolean lfb_init (const gchar *app_id, GError **error);
void lfb_uninit (void);
void lfb_set_app_id (const char *app_id);
const char *lfb_get_app_id (void);
gboolean lfb_is_initted (void);
void lfb_set_feedback_profile (const char *profile);
const char *lfb_get_feedback_profile (void);
LfbGdbusFeedback *lfb_get_proxy (void);
#include "lfb-main.h"
G_END_DECLS
+60 -60
View File
@@ -6,38 +6,36 @@ libfeedback_link_args = []
libfeedback_symbols_file = 'libfeedback.syms'
# Check linker flags
ld_version_script_arg = '-Wl,--version-script,@0@'.format(meson.current_source_dir() / libfeedback_symbols_file)
if cc.links('int main() { return 0; }', args : ld_version_script_arg, name : 'ld_supports_version_script')
ld_version_script_arg = '-Wl,--version-script,@0@'.format(
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]
endif
lfb_enum_headers = files([
'lfb-event.h',
])
lfb_enum_sources = gnome.mkenums_simple('lfb-enums',
sources : lfb_enum_headers,
install_header : true,
lfb_enum_headers = files('lfb-event.h')
lfb_enum_sources = gnome.mkenums_simple(
'lfb-enums',
sources: lfb_enum_headers,
install_header: true,
install_dir: libfeedback_header_dir,
)
libfeedback_headers = [
'libfeedback.h',
'lfb-event.h',
]
libfeedback_headers = ['libfeedback.h', 'lfb-event.h', 'lfb-main.h']
libfeedback_sources = [
generated_dbus_sources,
lfb_enum_sources,
libfeedback_headers,
'libfeedback.c',
'lfb-event.c',
'lfb-main.c',
]
libfeedback_deps = [
gio,
gio_unix,
glib,
]
libfeedback_deps = [gio, gio_unix, glib]
libfeedback_c_args = [
'-DG_LOG_DOMAIN="libfeedback"',
@@ -49,36 +47,36 @@ libtype = 'shared_library'
libfeedback = build_target(
'feedback-' + apiversion,
libfeedback_sources,
soversion : 0,
c_args : libfeedback_c_args,
dependencies : libfeedback_deps,
link_args : libfeedback_link_args,
install : true,
install_dir : libfeedback_libdir,
target_type : libtype,
soversion: 0,
c_args: libfeedback_c_args,
dependencies: libfeedback_deps,
link_args: libfeedback_link_args,
install: true,
install_dir: libfeedback_libdir,
target_type: libtype,
)
libfeedback_inc = include_directories('.')
libfeedback_dep = declare_dependency(
sources : [generated_dbus_sources, lfb_enum_sources[1]],
link_with : libfeedback,
sources: [generated_dbus_sources, lfb_enum_sources[1]],
link_with: libfeedback,
dependencies: libfeedback_deps,
include_directories : libfeedback_inc,
include_directories: libfeedback_inc,
)
install_headers(libfeedback_headers, subdir : libname)
install_headers(libfeedback_headers, subdir: libname)
pkgconfig = import('pkgconfig')
pkgconfig.generate(
libraries : [libfeedback],
subdirs : libname,
version : meson.project_version(),
name : 'Feedback',
filebase : 'libfeedback-@0@'.format(apiversion),
description : 'GNOME feedback library',
requires : 'gio-2.0',
install_dir : join_paths(libfeedback_libdir, 'pkgconfig'),
)
libraries: [libfeedback],
subdirs: libname,
version: meson.project_version(),
name: 'Feedback',
filebase: 'libfeedback-@0@'.format(apiversion),
description: 'GNOME feedback library',
requires: 'gio-2.0',
install_dir: join_paths(libfeedback_libdir, 'pkgconfig'),
)
if introspection
libfeedback_gir_extra_args = [
@@ -90,29 +88,31 @@ if introspection
'--warn-all',
]
libfeedback_gir = gnome.generate_gir(libfeedback,
sources : libfeedback_sources,
nsversion : apiversion,
namespace : 'Lfb',
export_packages : 'libfeedback-@0@'.format(apiversion),
symbol_prefix : 'lfb',
identifier_prefix : 'Lfb',
link_with : libfeedback,
includes : ['Gio-2.0'],
install : true,
install_dir_gir : girdir,
install_dir_typelib : typelibdir,
extra_args : libfeedback_gir_extra_args,
fatal_warnings : true,
)
libfeedback_gir = gnome.generate_gir(
libfeedback,
sources: libfeedback_sources,
nsversion: apiversion,
namespace: 'Lfb',
export_packages: 'libfeedback-@0@'.format(apiversion),
symbol_prefix: 'lfb',
identifier_prefix: 'Lfb',
link_with: libfeedback,
includes: ['Gio-2.0'],
install: true,
install_dir_gir: girdir,
install_dir_typelib: typelibdir,
extra_args: libfeedback_gir_extra_args,
fatal_warnings: true,
)
if get_option('vapi')
libfeedback_vapi = gnome.generate_vapi('libfeedback-' + apiversion,
sources : libfeedback_gir[0],
packages : ['gio-2.0'],
install : true,
install_dir : vapidir,
metadata_dirs : [meson.current_source_dir()],
)
libfeedback_vapi = gnome.generate_vapi(
'libfeedback-' + apiversion,
sources: libfeedback_gir[0],
packages: ['gio-2.0'],
install: true,
install_dir: vapidir,
metadata_dirs: [meson.current_source_dir()],
)
endif
endif
+36 -50
View File
@@ -1,33 +1,28 @@
project('feedbackd', 'c',
version : '0.7.0',
license : 'LGPLv3+',
meson_version : '>= 1.0.0',
default_options : [
'warning_level=1',
'buildtype=debugoptimized',
'c_std=gnu11',
],
project(
'feedbackd',
'c',
version: '0.7.0',
license: 'LGPLv3+',
meson_version: '>= 1.0.0',
default_options: ['warning_level=1', 'buildtype=debugoptimized', 'c_std=gnu11'],
)
gio = dependency('gio-2.0', version: '>=2.50.0')
gio_unix = dependency('gio-unix-2.0', version: '>=2.50.0')
glib = dependency('glib-2.0', version: '>=2.50.0')
udev = dependency('udev', required: false)
gio = dependency('gio-2.0', version: '>=2.50.0')
gio_unix = dependency('gio-unix-2.0', version: '>=2.50.0')
glib = dependency('glib-2.0', version: '>=2.50.0')
udev = dependency('udev', required: false)
if get_option('daemon')
gobject = dependency('gobject-2.0', version: '>=2.50.0')
gmobile = dependency('gmobile',
gobject = dependency('gobject-2.0', version: '>=2.50.0')
gmobile = dependency(
'gmobile',
version: '>= 0.1.0',
fallback: ['gmobile', 'gmobile_dep'],
default_options: [
'examples=false',
'introspection=false',
'gtk_doc=false',
'tests=false',
])
gsound = dependency('gsound')
gudev = dependency('gudev-1.0', version: '>=232')
json_glib = dependency('json-glib-1.0')
systemd_dep = dependency('systemd', required: false)
default_options: ['examples=false', 'introspection=false', 'gtk_doc=false', 'tests=false'],
)
gsound = dependency('gsound')
gudev = dependency('gudev-1.0', version: '>=232')
json_glib = dependency('json-glib-1.0')
systemd_dep = dependency('systemd', required: false)
endif
prefix = get_option('prefix')
@@ -51,10 +46,7 @@ endif
run_data = configuration_data()
run_data.set('ABS_BUILDDIR', meson.current_build_dir())
run_data.set('ABS_SRCDIR', meson.current_source_dir())
configure_file(
input: 'run.in',
output: 'run',
configuration: run_data)
configure_file(input: 'run.in', output: 'run', configuration: run_data)
gnome = import('gnome')
@@ -103,10 +95,7 @@ global_c_args = [
'-DFBD_VERSION="@0@"'.format(meson.project_version()),
]
add_project_arguments(
global_c_args + cc.get_supported_arguments(test_c_args),
language: 'c'
)
add_project_arguments(global_c_args + cc.get_supported_arguments(test_c_args), language: 'c')
introspection_feature = get_option('introspection')
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)
meson.add_install_script(
join_paths('build-aux', 'post_install.py'),
datadir
)
meson.add_install_script(join_paths('build-aux', 'post_install.py'), datadir)
subdir('data')
subdir('libfeedback')
@@ -129,18 +115,18 @@ subdir('tests')
subdir('doc')
summary = [
'',
'---------------',
'feedbackd @0@'.format(meson.project_version()),
'',
' Daemon: @0@'.format(get_option('daemon')),
' Udev rules: @0@'.format(get_option('udev')),
' Documentation: @0@'.format(get_option('gtk_doc')),
' Manual pages: @0@'.format(get_option('man')),
' Introspection: @0@'.format(introspection),
' Vapi: @0@'.format(get_option('vapi')),
' Tests: @0@'.format(get_option('tests')),
'---------------',
''
'',
'---------------',
'feedbackd @0@'.format(meson.project_version()),
'',
' Daemon: @0@'.format(get_option('daemon')),
' Udev rules: @0@'.format(get_option('udev')),
' Documentation: @0@'.format(get_option('gtk_doc')),
' Manual pages: @0@'.format(get_option('man')),
' Introspection: @0@'.format(introspection),
' Vapi: @0@'.format(get_option('vapi')),
' Tests: @0@'.format(get_option('tests')),
'---------------',
'',
]
message('\n'.join(summary))
+78 -96
View File
@@ -1,110 +1,92 @@
# Feedback daemon
if get_option('daemon')
fbd_enum_headers = files([
'fbd-event.h',
'fbd-feedback-led.h',
'fbd-feedback-vibra.h',
])
fbd_enum_sources = gnome.mkenums_simple('fbd-enums',
sources : fbd_enum_headers)
fbd_enum_headers = files('fbd-event.h', 'fbd-feedback-led.h', 'fbd-feedback-vibra.h')
fbd_enum_sources = gnome.mkenums_simple('fbd-enums', sources: fbd_enum_headers)
sources = [
generated_dbus_sources,
fbd_enum_sources,
'fbd-error.c',
'fbd-dev-vibra.c',
'fbd-dev-sound.c',
'fbd-dev-led.c',
'fbd-dev-led-flash.c',
'fbd-dev-led-multicolor.c',
'fbd-dev-led-qcom.c',
'fbd-dev-led-qcom-multicolor.c',
'fbd-dev-leds.c',
'fbd-event.c',
'fbd-feedback-base.c',
'fbd-feedback-dummy.c',
'fbd-feedback-led.c',
'fbd-feedback-manager.c',
'fbd-feedback-profile.c',
'fbd-feedback-sound.c',
'fbd-feedback-theme.c',
'fbd-feedback-vibra.c',
'fbd-feedback-vibra-pattern.c',
'fbd-feedback-vibra-periodic.c',
'fbd-feedback-vibra-rumble.c',
'fbd-haptic-manager.c',
'fbd-theme-expander.c',
'fbd-udev.c',
]
sources = [
generated_dbus_sources,
fbd_enum_sources,
'fbd-error.c',
'fbd-dev-vibra.c',
'fbd-dev-sound.c',
'fbd-dev-led.c',
'fbd-dev-led-flash.c',
'fbd-dev-led-multicolor.c',
'fbd-dev-led-qcom.c',
'fbd-dev-led-qcom-multicolor.c',
'fbd-dev-leds.c',
'fbd-event.c',
'fbd-feedback-base.c',
'fbd-feedback-dummy.c',
'fbd-feedback-led.c',
'fbd-feedback-manager.c',
'fbd-feedback-profile.c',
'fbd-feedback-sound.c',
'fbd-feedback-theme.c',
'fbd-feedback-vibra.c',
'fbd-feedback-vibra-pattern.c',
'fbd-feedback-vibra-periodic.c',
'fbd-feedback-vibra-rumble.c',
'fbd-haptic-manager.c',
'fbd-theme-expander.c',
'fbd-udev.c',
]
fbd_deps = [
gio,
gio_unix,
glib,
gmobile,
gobject,
gsound,
gudev,
json_glib,
]
fbd_deps = [gio, gio_unix, glib, gmobile, gobject, gsound, gudev, json_glib]
fbd_inc = [
include_directories('.'),
libfeedback_inc,
dbus_inc,
]
fbd_inc = [include_directories('.'), libfeedback_inc, dbus_inc]
fbd_lib = static_library(
'fbd',
sources,
include_directories : fbd_inc,
dependencies : fbd_deps,
c_args: '-DGMOBILE_USE_UNSTABLE_API',
install : false,
)
fbd_lib = static_library(
'fbd',
sources,
include_directories: fbd_inc,
dependencies: fbd_deps,
c_args: '-DGMOBILE_USE_UNSTABLE_API',
install: false,
)
fbd_dep = declare_dependency(
sources: [generated_dbus_sources, fbd_enum_sources],
include_directories : fbd_inc,
link_with : fbd_lib,
dependencies : fbd_deps,
)
fbd_dep = declare_dependency(
sources: [generated_dbus_sources, fbd_enum_sources],
include_directories: fbd_inc,
link_with: fbd_lib,
dependencies: fbd_deps,
)
executable(
'feedbackd',
sources : ['fbd.c', generated_dbus_sources[1]],
include_directories : fbd_inc,
dependencies : fbd_dep,
install : true,
install_dir: libexecdir,
)
executable(
'feedbackd',
sources: ['fbd.c', generated_dbus_sources[1]],
include_directories: fbd_inc,
dependencies: fbd_dep,
install: true,
install_dir: libexecdir,
)
executable(
'fbd-ledctrl',
sources : ['fbd-ledctrl.c'],
include_directories : fbd_inc,
dependencies : [glib],
install : true,
install_dir: libexecdir,
)
executable(
'fbd-ledctrl',
sources: ['fbd-ledctrl.c'],
include_directories: fbd_inc,
dependencies: [glib],
install: true,
install_dir: libexecdir,
)
executable(
'fbd-alert-slider',
sources : ['fbd-alert-slider.c'],
include_directories : fbd_inc,
dependencies : [glib, gio, gio_unix, gudev, libfeedback_dep],
install : true,
install_dir: libexecdir,
)
executable(
'fbd-alert-slider',
sources: ['fbd-alert-slider.c'],
include_directories: fbd_inc,
dependencies: [glib, gio, gio_unix, gudev, libfeedback_dep],
install: true,
install_dir: libexecdir,
)
executable(
'fbd-theme-validate',
sources : ['fbd-theme-validate.c'],
include_directories : fbd_inc,
dependencies : fbd_dep,
install : true,
install_dir: bindir,
)
executable(
'fbd-theme-validate',
sources: ['fbd-theme-validate.c'],
include_directories: fbd_inc,
dependencies: fbd_dep,
install: true,
install_dir: bindir,
)
endif
+74 -88
View File
@@ -1,104 +1,90 @@
if get_option('tests')
umockdev_dep = dependency('umockdev-1.0')
umockdev_dep = dependency('umockdev-1.0')
add_test_setup ('umockdev',
exe_wrapper: 'umockdev-wrapper',
is_default: true
)
add_test_setup('umockdev', exe_wrapper: 'umockdev-wrapper', is_default: true)
test_env = environment()
test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
test_env.set('G_DEBUG', 'gc-friendly,fatal-warnings')
test_env.set('GSETTINGS_BACKEND', 'memory')
test_env.set('GSETTINGS_SCHEMA_DIR', '@0@/data'.format(meson.project_build_root()))
test_env.set('PYTHONDONTWRITEBYTECODE', 'yes')
test_env.set('MALLOC_CHECK_', '2')
test_env.set('XDG_CONFIG_HOME', meson.current_source_dir() / 'data' / 'user-config')
test_env.set('XDG_CONFIG_DIRS', meson.current_source_dir())
test_env = environment()
test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
test_env.set('G_DEBUG', 'gc-friendly,fatal-warnings')
test_env.set('GSETTINGS_BACKEND', 'memory')
test_env.set('GSETTINGS_SCHEMA_DIR', '@0@/data'.format(meson.project_build_root()))
test_env.set('PYTHONDONTWRITEBYTECODE', 'yes')
test_env.set('MALLOC_CHECK_', '2')
test_env.set('XDG_CONFIG_HOME', meson.current_source_dir() / 'data' / 'user-config')
test_env.set('XDG_CONFIG_DIRS', meson.current_source_dir())
# Shared library Unit tests
# Shared library Unit tests
test_lfb_cflags = [
'-DTEST_APP_ID="org.sigxcpu.feedbackd_test"',
'-DLIBFEEDBACK_USE_UNSTABLE_API',
'-DTEST_DATA_DIR="@0@"'.format(join_paths(meson.current_source_dir(), 'data')),
]
test_lfb_link_args = [
'-fPIC',
]
test_lfb_deps = [
libfeedback_dep,
glib,
gio_unix,
]
lfb_tests = [
'lfb-event',
]
if get_option ('daemon')
# The integration test needs the daemon
lfb_tests += 'lfb-integration'
subdir('services')
endif
foreach test : lfb_tests
t = executable('test-@0@'.format(test),
['test-@0@.c'.format(test)],
c_args : test_lfb_cflags,
pie : true,
link_args : test_lfb_link_args,
dependencies : test_lfb_deps)
test(test, t, env: test_env)
endforeach
# Daemon Unit tests
if get_option('daemon')
test_env_fbd = test_env
test_env_fbd.set('XDG_DATA_DIRS', meson.current_source_dir() / 'data' / 'xdg-data')
test_fbd_cflags = [
test_lfb_cflags = [
'-DTEST_APP_ID="org.sigxcpu.feedbackd_test"',
'-DLIBFEEDBACK_USE_UNSTABLE_API',
'-DTEST_DATA_DIR="@0@"'.format(join_paths(meson.current_source_dir(), 'data')),
]
test_fbd_link_args = [
'-fPIC',
]
test_lfb_link_args = ['-fPIC']
test_fbd_deps = [
fbd_dep,
umockdev_dep,
]
test_lfb_deps = [libfeedback_dep, glib, gio_unix]
# HW independent tests
fbd_tests = [
'fbd-feedback-led',
'fbd-feedback-profile',
'fbd-feedback-theme',
'fbd-event',
'fbd-theme-expander',
'fbd-dev-led',
]
lfb_tests = ['lfb-event']
foreach test : fbd_tests
t = executable('test-@0@'.format(test),
['test-@0@.c'.format(test),
'testlib.c',
generated_dbus_sources[1]],
c_args : test_fbd_cflags,
pie : true,
link_args : test_fbd_link_args,
include_directories : fbd_inc,
dependencies : test_fbd_deps)
test(test, t, env : test_env_fbd)
endforeach
if get_option('daemon')
# The integration test needs the daemon
lfb_tests += 'lfb-integration'
subdir('services')
endif
endif # daemon
foreach test : lfb_tests
t = executable(
'test-@0@'.format(test),
['test-@0@.c'.format(test)],
c_args: test_lfb_cflags,
pie: true,
link_args: test_lfb_link_args,
dependencies: test_lfb_deps,
)
test(test, t, env: test_env)
endforeach
# Daemon Unit tests
if get_option('daemon')
test_env_fbd = test_env
test_env_fbd.set('XDG_DATA_DIRS', meson.current_source_dir() / 'data' / 'xdg-data')
test_fbd_cflags = [
'-DTEST_APP_ID="org.sigxcpu.feedbackd_test"',
'-DTEST_DATA_DIR="@0@"'.format(join_paths(meson.current_source_dir(), 'data')),
]
test_fbd_link_args = ['-fPIC']
test_fbd_deps = [fbd_dep, umockdev_dep]
# HW independent tests
fbd_tests = [
'fbd-feedback-led',
'fbd-feedback-profile',
'fbd-feedback-theme',
'fbd-event',
'fbd-theme-expander',
'fbd-dev-led',
]
foreach test : fbd_tests
t = executable(
'test-@0@'.format(test),
['test-@0@.c'.format(test), 'testlib.c', generated_dbus_sources[1]],
c_args: test_fbd_cflags,
pie: true,
link_args: test_fbd_link_args,
include_directories: fbd_inc,
dependencies: test_fbd_deps,
)
test(test, t, env: test_env_fbd)
endforeach
endif # daemon
endif
+1 -5
View File
@@ -2,8 +2,4 @@ service_file = 'org.sigxcpu.Feedback.service'
service_data = configuration_data()
service_data.set('ABS_BUILDDIR', meson.project_build_root())
configure_file(
input : service_file + '.in',
output : service_file,
configuration : service_data
)
configure_file(input: service_file + '.in', output: service_file, configuration: service_data)