Debian Codegraph @

src/pins/template/meson.build

raw
1 #%# This controls build and test
2 #%#
3 #%# Feel free to peek into other tests to get an idea what can be done.
4 #%#
5 #%# Possibly you'll need some extra programs, probe for them.
6
7 #%# curl is just an example
8 curl = find_program('curl', required: false)
9 #%# dracut and initramfs_tools are needed for early userland
10 dracut = dependency('dracut', required: false)
11 initramfs_tools = find_program('update-initramfs', required: false)
12
13 if curl.found()
14 #%# BUild the programs
15 bins += join_paths(meson.current_source_dir(), 'clevis-decrypt-@pin@')
16 bins += join_paths(meson.current_source_dir(), 'clevis-encrypt-@pin@')
17 #%# and the manpage
18 mans += join_paths(meson.current_source_dir(), 'clevis-encrypt-@[email protected]')
19
20 #%# Set up a test environment
21 env = environment()
22 env.append('PATH',
23 join_paths(meson.source_root(), 'src'),
24 meson.current_source_dir(),
25 '/usr/libexec',
26 libexecdir,
27 separator: ':'
28 )
29
30 #%# Run the test.
31 test('pin-@pin@', find_program('./pin-@pin@'), env: env)
32 else
33 warning('Will not install @pin@ pin due to missing dependencies!')
34 endif
35
36 #%# dracut support
37 if dracut.found()
38 dracutdir = dracut.get_pkgconfig_variable('dracutmodulesdir') + '/50' + meson.project_name() + '-pin-@pin@'
39 #?# In general, substituation is not needed but it's better to
40 #?# stay flexible.
41 configure_file(
42 input: 'dracut.module-setup.sh.in',
43 output: 'module-setup.sh',
44 install_dir: dracutdir,
45 configuration: data,
46 )
47 else
48 warning('Will not install dracut module clevis-pin-@pin@ due to missing dependencies!')
49 endif
50
51 #%# initramfs support
52 if initramfs_tools.found()
53 initramfstools_dir = '/usr/share/initramfs-tools'
54 initramfs_hooks_dir = '/usr/share/initramfs-tools/hooks'
55 initramfs_data = configuration_data()
56 initramfs_data.merge_from(data)
57 initramfs_data.set('initramfstoolsdir', initramfstools_dir)
58 configure_file(
59 input: 'initramfs.in',
60 output: 'clevis-pin-@pin@',
61 install_dir: initramfs_hooks_dir,
62 configuration: initramfs_data,
63 )
64 else
65 warning('Will not install initramfs module clevis-pin-@pin@ due to missing dependencies!')
66 endif