Debian Codegraph @

src/meson.build

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 # Configuration file
2 conf = configuration_data()
3 conf.set_quoted('NAME', name)
4 conf.set_quoted('PKGNAME', meson.project_name())
5 conf.set_quoted('APP_ID', app_id)
6 conf.set_quoted('PATH_ID', path_id)
7 conf.set_quoted('VERSION', meson.project_version())
8 conf.set_quoted('PROFILE', profile)
9 conf.set_quoted('VCS_TAG', vcs_tag)
10 conf.set_quoted('LOCALEDIR', localedir)
11 conf.set_quoted('DATADIR', datadir)
12
13 configure_file(
14 input: 'config.rs.in',
15 output: 'config.rs',
16 configuration: conf
17 )
18
19 run_command(
20 'cp',
21 join_paths(meson.project_build_root(), 'src', 'config.rs'),
22 join_paths(meson.project_source_root(), 'src', 'config.rs'),
23 check: true
24 )
25
26 # Setup cargo
27 cargo = find_program('cargo')
28 cargo_env = [ 'CARGO_HOME=' + meson.project_build_root() / 'cargo-home' ]
29 cargo_options = [ '--manifest-path', meson.project_source_root() / 'Cargo.toml' ]
30 cargo_options += [ '--target-dir', meson.project_build_root() / 'target' ]
31
32 if get_option('profile') == 'default'
33 cargo_options += [ '--release' ]
34 rust_target = 'release'
35 message('Building in release mode')
36 else
37 rust_target = 'debug'
38 message('Building in debug mode')
39 endif
40
41 cargo_release = custom_target(
42 'cargo-build',
43 build_by_default: true,
44 build_always_stale: true,
45 output: meson.project_name(),
46 console: true,
47 install: true,
48 install_dir: bindir,
49 command: [
50 'env',
51 cargo_env,
52 cargo, 'build',
53 cargo_options,
54 '&&',
55 'cp', 'target' / rust_target / meson.project_name(), '@OUTPUT@',
56 ]
57 )