60 lines
1.6 KiB
Meson
60 lines
1.6 KiB
Meson
|
# SPDX-FileCopyrightText: Matteo Settenvini <matteo.settenvini@montecristosoftware.eu>
|
||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||
|
|
||
|
if get_option('buildtype') == 'debug'
|
||
|
profile = 'dev'
|
||
|
target_subdir = 'debug'
|
||
|
else
|
||
|
profile = 'release'
|
||
|
target_subdir = 'release'
|
||
|
endif
|
||
|
|
||
|
dbus_iface_file = meson.project_source_root() / 'accounts-service/com.endlessm.ParentalControls.Dns.xml'
|
||
|
env = environment({
|
||
|
'DBUS_IFACE': dbus_iface_file,
|
||
|
})
|
||
|
|
||
|
cargo = find_program('cargo')
|
||
|
cargo_common_opts = [
|
||
|
'--manifest-path', meson.current_source_dir() / 'Cargo.toml',
|
||
|
'--workspace',
|
||
|
'--profile', profile,
|
||
|
'--target-dir', meson.current_build_dir() / 'target',
|
||
|
]
|
||
|
|
||
|
library = 'libnss_malcontent.so'
|
||
|
|
||
|
build_library = custom_target('cargo-nss_malcontent',
|
||
|
output: 'target' / target_subdir / library,
|
||
|
build_always_stale: true,
|
||
|
command: [cargo, 'build'] + cargo_common_opts,
|
||
|
console: true,
|
||
|
env: env,
|
||
|
)
|
||
|
|
||
|
custom_target('libnss_malcontent',
|
||
|
input: build_library,
|
||
|
output: library + '.2', # Required by NSS 3
|
||
|
build_by_default: true,
|
||
|
command: ['ln', '-f', '@INPUT@', '@OUTPUT@'],
|
||
|
env: env,
|
||
|
install: true,
|
||
|
install_dir: get_option('libdir'),
|
||
|
)
|
||
|
|
||
|
build_tests = custom_target('nss_malcontent-tests',
|
||
|
output: 'something-something-something',
|
||
|
build_always_stale: true,
|
||
|
build_by_default: true,
|
||
|
command: [cargo, 'test'] + cargo_common_opts + '--no-run',
|
||
|
console: true,
|
||
|
env: env
|
||
|
)
|
||
|
|
||
|
test('dns', cargo,
|
||
|
args: ['test'] + cargo_common_opts + ['--no-fail-fast', '--message-format', 'json'],
|
||
|
env: env,
|
||
|
depends: [build_tests],
|
||
|
protocol: 'rust',
|
||
|
)
|