Update build system and Flatpak manifest

This commit is contained in:
Elias Projahn 2024-06-23 14:59:26 +02:00
parent 1788303bf3
commit b9c874ab8c
26 changed files with 317 additions and 160 deletions

View file

@ -1,35 +1,43 @@
pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
# Configuration file
conf = configuration_data()
conf.set_quoted('NAME', name)
conf.set_quoted('PKGNAME', meson.project_name())
conf.set_quoted('APP_ID', app_id)
conf.set_quoted('PATH_ID', path_id)
conf.set_quoted('VERSION', meson.project_version())
conf.set_quoted('GETTEXT_PACKAGE', 'musicus')
conf.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir')))
conf.set_quoted('PKGDATADIR', pkgdatadir)
conf.set_quoted('PROFILE', profile)
conf.set_quoted('LOCALEDIR', localedir)
conf.set_quoted('DATADIR', datadir)
configure_file(
input: 'config.rs.in',
output: 'config.rs',
configuration: conf
configuration: conf,
)
# Copy the config.rs output to the source directory.
run_command(
'cp',
join_paths(meson.project_build_root(), 'src', 'config.rs'),
join_paths(meson.project_source_root(), 'src', 'config.rs'),
meson.project_build_root() / 'src' / 'config.rs',
meson.project_source_root() / 'src' / 'config.rs',
check: true
)
# Cargo
cargo_bin = find_program('cargo')
cargo_opt = [ '--manifest-path', meson.project_source_root() / 'Cargo.toml' ]
cargo_opt += [ '--target-dir', meson.project_build_root() / 'src' ]
cargo_env = [ 'CARGO_HOME=' + meson.project_build_root() / 'cargo-home' ]
if get_option('buildtype') == 'release'
if get_option('profile') == 'release'
cargo_options += [ '--release' ]
rust_target = 'release'
message('Building in release mode')
else
rust_target = 'debug'
message('Building in debug mode')
endif
cargo_build = custom_target(
@ -39,10 +47,10 @@ cargo_build = custom_target(
output: meson.project_name(),
console: true,
install: true,
install_dir: get_option('bindir'),
install_dir: bindir,
command: [
'env', cargo_env,
cargo_bin, 'build',
cargo_opt, '&&', 'cp', 'src' / rust_target / meson.project_name(), '@OUTPUT@',
]
],
)