Skip to content

Commit cfe1648

Browse files
A6GibKmwarusadura
authored andcommitted
daemon: Add meson
1 parent 2825d59 commit cfe1648

File tree

6 files changed

+121
-0
lines changed

6 files changed

+121
-0
lines changed

server/data/meson.build

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
if systemduserunitdir != ''
2+
configure_file(
3+
input: 'oo7-daemon.service.in',
4+
output: 'oo7-daemon.service',
5+
configuration: libexecdir_conf,
6+
install_dir: systemduserunitdir,
7+
)
8+
endif
9+
10+
configure_file(
11+
input: 'org.freedesktop.secrets.service.in',
12+
output: 'org.freedesktop.secrets.service',
13+
configuration: libexecdir_conf,
14+
install_dir: dbus_service_dir,
15+
)

server/data/oo7-daemon.service.in

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[Unit]
2+
Description=Secret service (oo7 implementation)
3+
4+
[Service]
5+
Type=simple
6+
StandardError=journal
7+
ExecStart=@libexecdir@/oo7-daemon
8+
Restart=on-failure
9+
10+
[Install]
11+
WantedBy=default.target
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[D-BUS Service]
2+
Name=org.freedesktop.secrets
3+
Exec=@libexecdir@/oo7-daemon

server/meson.build

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
project(
2+
'oo7-daemon',
3+
'rust',
4+
version: '0.1.0',
5+
meson_version: '>= 0.59.0',
6+
)
7+
8+
is_devel = get_option('profile') == 'development'
9+
10+
prefix = get_option('prefix')
11+
datadir = get_option('datadir')
12+
dbus_service_dir = get_option('dbus_service_dir')
13+
libexecdir = get_option('libexecdir')
14+
15+
build_systemd_service = get_option('systemd')
16+
systemduserunitdir = get_option('systemduserunitdir')
17+
if systemduserunitdir == ''
18+
systemd = dependency('systemd', version: '>= 242', required: build_systemd_service)
19+
if build_systemd_service.allowed() and systemd.found()
20+
systemduserunitdir = systemd.get_variable(
21+
pkgconfig: 'systemduserunitdir',
22+
pkgconfig_define: ['prefix', prefix]
23+
)
24+
endif
25+
endif
26+
27+
libexecdir_conf = configuration_data()
28+
libexecdir_conf.set('libexecdir', prefix / libexecdir)
29+
30+
summary({
31+
'prefix': prefix,
32+
'datadir': datadir,
33+
'libexecdir': libexecdir,
34+
'dbus_service_dir': dbus_service_dir,
35+
})
36+
37+
subdir('data')
38+
subdir('src')

server/meson_options.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
option('dbus_service_dir',
2+
type: 'string',
3+
description: 'Directory for D-Bus service files'
4+
)
5+
6+
option('systemd',
7+
type: 'feature',
8+
value: 'auto',
9+
description: 'Enable systemd support'
10+
)
11+
12+
option('systemduserunitdir',
13+
type: 'string',
14+
description: 'Directory for systemd user service files'
15+
)
16+
17+
option (
18+
'profile',
19+
type: 'combo',
20+
choices: [
21+
'default',
22+
'development'
23+
],
24+
value: 'default',
25+
description: 'The build profile. One of "default" or "development".'
26+
)

server/src/meson.build

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
cargo = find_program('cargo')
2+
3+
cargo_options = []
4+
cargo_options += [ '--target-dir', meson.project_build_root() / 'src' ]
5+
if is_devel
6+
rust_target = 'debug'
7+
message('Building in debug mode')
8+
else
9+
cargo_options += [ '--release' ]
10+
rust_target = 'release'
11+
message('Building in release mode')
12+
endif
13+
14+
cargo_build = custom_target(
15+
'cargo-build',
16+
build_by_default: true,
17+
build_always_stale: true,
18+
output: meson.project_name(),
19+
console: true,
20+
install: true,
21+
install_dir: libexecdir,
22+
command: [
23+
cargo, 'build',
24+
cargo_options,
25+
'&&',
26+
'cp', 'src' / rust_target / meson.project_name(), '@OUTPUT@',
27+
]
28+
)

0 commit comments

Comments
 (0)