diff --git a/CHANGELOG.md b/CHANGELOG.md index 795f1216..b38c9092 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - ui: Add Bulgarian translation (Thank you, @salif!) - webext: Try to read app ID from associated desktop entry (Thank you, @michaelbeaumont!) - ui: Basic recovery from failed attempts to use devices (e.g. flaky bluetooth) +- build: Make daemon, credentialsd-ui, demo client and web extension optional # 0.3.1 [2026-09-05] diff --git a/credentialsd-common/meson.build b/credentialsd-common/meson.build index b04134e7..b496d19a 100644 --- a/credentialsd-common/meson.build +++ b/credentialsd-common/meson.build @@ -2,7 +2,6 @@ # Not efficient, since the UI and daemon projects will build it separately, but leaving it this way for now. common_lib_name = 'credentialsd-common' -cargo = find_program('cargo', required: true) cargo_options = [ '--manifest-path', meson.project_source_root() / meson.current_source_dir() / 'Cargo.toml', @@ -15,4 +14,4 @@ if get_option('cargo_offline') == true cargo_options += ['--offline'] endif -subdir('src') \ No newline at end of file +subdir('src') diff --git a/credentialsd-ui/data/resources/ui/meson.build b/credentialsd-ui/data/resources/ui/meson.build index 53f9eb86..ce1c3257 100644 --- a/credentialsd-ui/data/resources/ui/meson.build +++ b/credentialsd-ui/data/resources/ui/meson.build @@ -1,5 +1,3 @@ -blueprint_compiler = find_program('blueprint-compiler', version: '>= 0.20.4') - blueprint_templates = custom_target( 'blueprints', input: files('window.blp'), @@ -11,4 +9,4 @@ blueprint_templates = custom_target( '--output', '@OUTPUT@', '@INPUT@', ], -) \ No newline at end of file +) diff --git a/credentialsd-ui/meson.build b/credentialsd-ui/meson.build index 2ac53d5f..0edeadf5 100644 --- a/credentialsd-ui/meson.build +++ b/credentialsd-ui/meson.build @@ -6,28 +6,19 @@ gui_build_dir = meson.current_build_dir() gui_source_dir = meson.current_source_dir() base_id = 'xyz.iinuwa.credentialsd.CredentialsUi' -dependency('dbus-1', version: '>= 1.6') -dependency('glib-2.0', version: '>= 2.66') -dependency('gio-2.0', version: '>= 2.66') -dependency('gtk4', version: '>= 4.6.2') +glib_dep = dependency('glib-2.0', version: '>= 2.66', required: true) +gio_dep = dependency('gio-2.0', version: '>= 2.66', required: true) +gtk_dep = dependency('gtk4', version: '>= 4.6.2', required: true) -glib_compile_resources = find_program('glib-compile-resources', required: true) -glib_compile_schemas = find_program('glib-compile-schemas', required: true) # Usually provided by gettext package msgfmt = find_program('msgfmt', required: false) xmllint = find_program('xmllint', required: false) +glib_compile_schemas = find_program('glib-compile-schemas', required: true) appstreamcli = find_program('appstreamcli', required: false) -cargo = find_program('cargo', required: true) - version = meson.project_version() -prefix = get_option('prefix') -bindir = prefix / get_option('bindir') -localedir = prefix / get_option('localedir') - -datadir = prefix / get_option('datadir') pkgdatadir = datadir / gui_executable_name iconsdir = datadir / 'icons' @@ -83,4 +74,4 @@ gnome.post_install( gtk_update_icon_cache: true, glib_compile_schemas: true, update_desktop_database: false, -) \ No newline at end of file +) diff --git a/credentialsd/meson.build b/credentialsd/meson.build index 855ee207..a2ec9a25 100644 --- a/credentialsd/meson.build +++ b/credentialsd/meson.build @@ -2,17 +2,13 @@ backend_executable_name = 'credentialsd' backend_build_dir = meson.current_build_dir() base_id = 'xyz.iinuwa.credentialsd.Credentialsd' -dependency('dbus-1', version: '>= 1.6') -dependency('glib-2.0', version: '>= 2.66') -dependency('gio-2.0', version: '>= 2.66') -dependency('gtk4', version: '>= 4.6.2') -dependency('ssl', 'openssl', version: '>= 3.0') -dependency('udev', version: '>= 249') - -cargo = find_program('cargo', required: true) - version = meson.project_version() +nfc_dep = dependency('libnfc', version: '>=1.8.0', required: true) +pcsclite_dep = dependency('libpcsclite', version: '>=2.0.3', required: true) +ssl_dep = dependency('ssl', 'openssl', version: '>= 3.0', required: true) +udev_dep = dependency('udev', version: '>= 249', required: true) + if get_option('profile') == 'development' profile = 'Devel' vcs_tag = run_command('git', 'rev-parse', '--short', 'HEAD', check: false).stdout().strip() @@ -56,4 +52,4 @@ if get_option('cargo_offline') == true endif subdir('src') -subdir('tests') \ No newline at end of file +subdir('tests') diff --git a/credentialsd/src/meson.build b/credentialsd/src/meson.build index 374d0ef7..bf1242b9 100644 --- a/credentialsd/src/meson.build +++ b/credentialsd/src/meson.build @@ -46,4 +46,4 @@ test( '--nocapture', ], protocol: 'exitcode', -) \ No newline at end of file +) diff --git a/dbus/meson.build b/dbus/meson.build index dff7d4bc..32009e48 100644 --- a/dbus/meson.build +++ b/dbus/meson.build @@ -1,19 +1,28 @@ -dbus_config = configuration_data() dbus_service_dir = datadir / 'dbus-1' / 'services' -dbus_config.set('DAEMON_EXECUTABLE', bindir / backend_executable_name) -dbus_config.set( - 'UI_EXECUTABLE', - bindir / gui_executable_name, -) -configure_file( - input: 'xyz.iinuwa.credentialsd.Credentials.service.in', - install_dir: dbus_service_dir, - output: 'xyz.iinuwa.credentialsd.Credentials.service', - configuration: dbus_config, -) -configure_file( - input: 'xyz.iinuwa.credentialsd.UiControl.service.in', - install_dir: dbus_service_dir, - output: 'xyz.iinuwa.credentialsd.UiControl.service', - configuration: dbus_config, -) + +if daemon_feat.allowed() + dbus_daemon_config = configuration_data() + dbus_daemon_config.set('DAEMON_EXECUTABLE', bindir / backend_executable_name) + + configure_file( + input: 'xyz.iinuwa.credentialsd.Credentials.service.in', + install_dir: dbus_service_dir, + output: 'xyz.iinuwa.credentialsd.Credentials.service', + configuration: dbus_daemon_config, + ) +endif + +if gui_feat.allowed() + dbus_ui_config = configuration_data() + dbus_ui_config.set( + 'UI_EXECUTABLE', + bindir / gui_executable_name, + ) + + configure_file( + input: 'xyz.iinuwa.credentialsd.UiControl.service.in', + install_dir: dbus_service_dir, + output: 'xyz.iinuwa.credentialsd.UiControl.service', + configuration: dbus_ui_config, + ) +endif diff --git a/demo_client/meson.build b/demo_client/meson.build index 747e3bb8..dcef5002 100644 --- a/demo_client/meson.build +++ b/demo_client/meson.build @@ -1,16 +1,9 @@ -dependency('dbus-1', version: '>= 1.6') -dependency('glib-2.0', version: '>= 2.66') -dependency('gio-2.0', version: '>= 2.66') -dependency('gtk4', version: '>= 4.6.2') - -glib_compile_resources = find_program('glib-compile-resources', required: true) - demo_blueprints = custom_target( 'demo-blueprints', input: files('window.blp'), output: 'ui', command: [ - find_program('blueprint-compiler', required: false), + blueprint_compiler, 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', @@ -46,8 +39,9 @@ gui_sources = files( custom_target( 'demo-gui', input: [gui_sources], - build_by_default: false, + # build if explicitly enabled, otherwise, the target must be selected + build_by_default: demo_client_feat.enabled(), output: '.', depends: [demo_resources], command: ['cp', '@INPUT@', '@OUTPUT@'], -) \ No newline at end of file +) diff --git a/doc/meson.build b/doc/meson.build index 3b1b10f1..f52b7e4e 100644 --- a/doc/meson.build +++ b/doc/meson.build @@ -1,4 +1,6 @@ -install_data( - 'xyz.iinuwa.credentialsd.Credentials.xml', - install_dir: datadir / 'credentialsd', -) \ No newline at end of file +if daemon_feat.allowed() + install_data( + 'xyz.iinuwa.credentialsd.Credentials.xml', + install_dir: datadir / 'credentialsd', + ) +endif diff --git a/meson.build b/meson.build index 534404a1..f61ca392 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project( 'credentialsd', 'rust', - version: '0.2.0', + version: '0.3.1', meson_version: '>= 1.5.0', license: 'LGPL-3.0-only', ) @@ -10,6 +10,7 @@ version = meson.project_version() prefix = get_option('prefix') bindir = prefix / get_option('bindir') +datadir = prefix / get_option('datadir') libdir = prefix / get_option('libdir') localedir = prefix / get_option('localedir') @@ -27,24 +28,64 @@ meson.add_dist_script( + version, meson.project_source_root(), ) +# Features +daemon_feat = get_option('feature_daemon') +demo_client_feat = get_option('feature_demo_client') +gui_feat = get_option('feature_gui') +webext_feat = get_option('feature_web_extension') + +# Dependencies +if daemon_feat.allowed() or gui_feat.allowed() + dbus_dep = dependency('dbus-1', version: '>= 1.6', required: true) +endif + +# Programs +if daemon_feat.allowed() or gui_feat.allowed() + cargo = find_program('cargo', required: true) +endif + +if gui_feat.allowed() or demo_client_feat.allowed() + glib_compile_resources = find_program('glib-compile-resources', required: true) +endif + +if gui_feat.allowed() or demo_client_feat.allowed() + blueprint_compiler = find_program('blueprint-compiler', version: '>= 0.20.4', required: true) +endif # Libs and executables -subdir('credentialsd-common') -subdir('credentialsd') -subdir('credentialsd-ui') +if daemon_feat.allowed() or gui_feat.allowed() + subdir('credentialsd-common') +endif + +if daemon_feat.allowed() + subdir('credentialsd') +endif + +if gui_feat.allowed() + subdir('credentialsd-ui') +endif # Data files -subdir('doc') -subdir('dbus') -subdir('portal') -subdir('systemd') -subdir('webext') +if daemon_feat.allowed() + subdir('doc') +endif + +if daemon_feat.allowed() or gui_feat.allowed() + subdir('dbus') +endif -subdir('demo_client') +if gui_feat.allowed() + subdir('portal') +endif -# Don't run blueprint-compiler tests +if daemon_feat.allowed() or gui_feat.allowed() + subdir('systemd') +endif -# add_test_setup('skip_subproject_tests', -# is_default: true, -# exclude_suites: ['blueprint-compiler'] -# ) \ No newline at end of file +if webext_feat.allowed() + subdir('webext') +endif + +if demo_client_feat.allowed() + subdir('demo_client') +endif diff --git a/meson.options b/meson.options index c10c493f..f2dd6813 100644 --- a/meson.options +++ b/meson.options @@ -1,3 +1,5 @@ +# Compile options + option( 'profile', type: 'combo', @@ -21,4 +23,33 @@ option( type: 'boolean', value: false, description: 'Whether to perform an offline build with Cargo. Defaults to false to download crates from registries.', -) \ No newline at end of file +) + +# Features +option( + 'feature_daemon', + type: 'feature', + value: 'auto', + description: 'Whether to build the credentialsd daemon' +) + +option( + 'feature_demo_client', + type: 'feature', + value: 'auto', + description: 'Whether to build the demo client' +) + +option( + 'feature_gui', + type: 'feature', + value: 'enabled', + description: 'Whether to build the credentialsd-ui GUI' +) + +option( + 'feature_web_extension', + type: 'feature', + value: 'enabled', + description: 'Whether to build the web extension' +) diff --git a/systemd/meson.build b/systemd/meson.build index 29844c82..acb716fa 100644 --- a/systemd/meson.build +++ b/systemd/meson.build @@ -1,21 +1,30 @@ -systemd_config = configuration_data() # HACK: Not using libdir option, since on some distros (Fedora), libdir is `lib64`, but systemd is always in `lib` # If you know of a better way to do this, let me know systemd_user_service_dir = prefix / 'lib' / 'systemd' / 'user' -systemd_config.set('DAEMON_EXECUTABLE', bindir / backend_executable_name) -systemd_config.set( - 'UI_EXECUTABLE', - bindir / gui_executable_name, -) -configure_file( - input: 'xyz.iinuwa.credentialsd.Credentials.service.in', - install_dir: systemd_user_service_dir, - output: 'xyz.iinuwa.credentialsd.Credentials.service', - configuration: systemd_config, -) -configure_file( - input: 'xyz.iinuwa.credentialsd.UiControl.service.in', - install_dir: systemd_user_service_dir, - output: 'xyz.iinuwa.credentialsd.UiControl.service', - configuration: systemd_config, -) + +if daemon_feat.allowed() + systemd_daemon_config = configuration_data() + systemd_daemon_config.set('DAEMON_EXECUTABLE', bindir / backend_executable_name) + + configure_file( + input: 'xyz.iinuwa.credentialsd.Credentials.service.in', + install_dir: systemd_user_service_dir, + output: 'xyz.iinuwa.credentialsd.Credentials.service', + configuration: systemd_daemon_config, + ) +endif + +if gui_feat.allowed() + systemd_ui_config = configuration_data() + systemd_ui_config.set( + 'UI_EXECUTABLE', + bindir / gui_executable_name, + ) + + configure_file( + input: 'xyz.iinuwa.credentialsd.UiControl.service.in', + install_dir: systemd_user_service_dir, + output: 'xyz.iinuwa.credentialsd.UiControl.service', + configuration: systemd_ui_config, + ) +endif