Skip to content

Commit

Permalink
daemon: Add meson
Browse files Browse the repository at this point in the history
  • Loading branch information
A6GibKm authored and warusadura committed Oct 15, 2024
1 parent 47c840f commit 9ed8cc5
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 0 deletions.
15 changes: 15 additions & 0 deletions server/data/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
if systemduserunitdir != ''
configure_file(
input: 'oo7-daemon.service.in',
output: 'oo7-daemon.service',
configuration: libexecdir_conf,
install_dir: systemduserunitdir,
)
endif

configure_file(
input: 'org.freedesktop.secrets.service.in',
output: 'org.freedesktop.secrets.service',
configuration: libexecdir_conf,
install_dir: dbus_service_dir,
)
11 changes: 11 additions & 0 deletions server/data/oo7-daemon.service.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Unit]
Description=Secret service (oo7 implementation)

[Service]
Type=simple
StandardError=journal
ExecStart=@libexecdir@/oo7-daemon
Restart=on-failure

[Install]
WantedBy=default.target
3 changes: 3 additions & 0 deletions server/data/org.freedesktop.secrets.service.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[D-BUS Service]
Name=org.freedesktop.secrets
Exec=@libexecdir@/oo7-daemon
38 changes: 38 additions & 0 deletions server/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
project(
'oo7-daemon',
'rust',
version: '0.1.0',
meson_version: '>= 0.59.0',
)

is_devel = get_option('profile') == 'development'

prefix = get_option('prefix')
datadir = get_option('datadir')
dbus_service_dir = get_option('dbus_service_dir')
libexecdir = get_option('libexecdir')

build_systemd_service = get_option('systemd')
systemduserunitdir = get_option('systemduserunitdir')
if systemduserunitdir == ''
systemd = dependency('systemd', version: '>= 242', required: build_systemd_service)
if build_systemd_service.allowed() and systemd.found()
systemduserunitdir = systemd.get_variable(
pkgconfig: 'systemduserunitdir',
pkgconfig_define: ['prefix', prefix]
)
endif
endif

libexecdir_conf = configuration_data()
libexecdir_conf.set('libexecdir', prefix / libexecdir)

summary({
'prefix': prefix,
'datadir': datadir,
'libexecdir': libexecdir,
'dbus_service_dir': dbus_service_dir,
})

subdir('data')
subdir('src')
26 changes: 26 additions & 0 deletions server/meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
option('dbus_service_dir',
type: 'string',
description: 'Directory for D-Bus service files'
)

option('systemd',
type: 'feature',
value: 'auto',
description: 'Enable systemd support'
)

option('systemduserunitdir',
type: 'string',
description: 'Directory for systemd user service files'
)

option (
'profile',
type: 'combo',
choices: [
'default',
'development'
],
value: 'default',
description: 'The build profile. One of "default" or "development".'
)
28 changes: 28 additions & 0 deletions server/src/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
cargo = find_program('cargo')

cargo_options = []
cargo_options += [ '--target-dir', meson.project_build_root() / 'src' ]
if is_devel
rust_target = 'debug'
message('Building in debug mode')
else
cargo_options += [ '--release' ]
rust_target = 'release'
message('Building in release mode')
endif

cargo_build = custom_target(
'cargo-build',
build_by_default: true,
build_always_stale: true,
output: meson.project_name(),
console: true,
install: true,
install_dir: libexecdir,
command: [
cargo, 'build',
cargo_options,
'&&',
'cp', 'src' / rust_target / meson.project_name(), '@OUTPUT@',
]
)

0 comments on commit 9ed8cc5

Please sign in to comment.