Fix issues with the meson build
This commit is contained in:
parent
fbf4b8dfa5
commit
8e019361f4
|
@ -13,7 +13,7 @@
|
|||
"--socket=fallback-x11",
|
||||
"--socket=wayland",
|
||||
"--device=dri",
|
||||
"--env=RUST_LOG=gtk_rust_template=debug",
|
||||
"--env=RUST_LOG=lemoa=debug",
|
||||
"--env=G_MESSAGES_DEBUG=none",
|
||||
"--env=RUST_BACKTRACE=1"
|
||||
],
|
||||
|
@ -38,7 +38,7 @@
|
|||
{
|
||||
"name": "lemoa",
|
||||
"buildsystem": "meson",
|
||||
"run-tests": true,
|
||||
"builddir": true,
|
||||
"config-opts": [
|
||||
"-Dprofile=development"
|
||||
],
|
||||
|
@ -51,5 +51,3 @@
|
|||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
|
@ -15,12 +15,14 @@ configure_file(
|
|||
|
||||
# Scalable icon
|
||||
install_data(
|
||||
'@0@.svg'.format(application_id),
|
||||
'@0@.svg'.format(base_id),
|
||||
install_dir: iconsdir / 'hicolor' / 'scalable' / 'apps',
|
||||
rename: '@0@.svg'.format(application_id)
|
||||
)
|
||||
|
||||
# Symbolic icon
|
||||
install_data(
|
||||
'@0@-symbolic.svg'.format(application_id),
|
||||
'@0@-symbolic.svg'.format(base_id),
|
||||
install_dir: iconsdir / 'hicolor' / 'symbolic' / 'apps',
|
||||
rename: '@0@-symbolic.svg'.format(application_id)
|
||||
)
|
||||
|
|
26
meson.build
26
meson.build
|
@ -8,8 +8,10 @@ project(
|
|||
|
||||
gnome = import('gnome')
|
||||
|
||||
application_id = 'com.lemmygtk.lemoa'
|
||||
base_id = 'com.lemmygtk.lemoa'
|
||||
version = meson.project_version()
|
||||
|
||||
# Required packages
|
||||
dependency('glib-2.0', version: '>= 2.70')
|
||||
dependency('gio-2.0', version: '>= 2.70')
|
||||
dependency('gtk4', version: '>= 4.10.0')
|
||||
|
@ -19,16 +21,31 @@ glib_compile_schemas = find_program('glib-compile-schemas', required: true)
|
|||
desktop_file_validate = find_program('desktop-file-validate', required: false)
|
||||
cargo = find_program('cargo', required: true)
|
||||
|
||||
version = meson.project_version()
|
||||
|
||||
# Various directories needed for building
|
||||
prefix = get_option('prefix')
|
||||
bindir = prefix / get_option('bindir')
|
||||
|
||||
datadir = prefix / get_option('datadir')
|
||||
iconsdir = datadir / 'icons'
|
||||
applicationsdir = datadir / 'applications'
|
||||
pkgdatadir = datadir / meson.project_name()
|
||||
|
||||
# Add a version suffix for devel builds
|
||||
if get_option('profile') == 'development'
|
||||
profile = 'Devel'
|
||||
vcs_tag = run_command('git', 'rev-parse', '--short', 'HEAD', check: false).stdout().strip()
|
||||
if vcs_tag == ''
|
||||
version_suffix = '-devel'
|
||||
else
|
||||
version_suffix = '-@0@'.format(vcs_tag)
|
||||
endif
|
||||
application_id = '@0@.@1@'.format(base_id, profile)
|
||||
else
|
||||
profile = ''
|
||||
version_suffix = ''
|
||||
application_id = base_id
|
||||
endif
|
||||
|
||||
# Modules that need to be built
|
||||
subdir('src')
|
||||
subdir('data')
|
||||
|
||||
|
@ -37,4 +54,3 @@ gnome.post_install(
|
|||
glib_compile_schemas: true,
|
||||
update_desktop_database: true,
|
||||
)
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
option(
|
||||
'profile',
|
||||
type: 'combo',
|
||||
choices: [
|
||||
'default',
|
||||
'development'
|
||||
],
|
||||
value: 'default',
|
||||
description: 'The build profile for GTK Rust Template. One of "default" or "development".'
|
||||
)
|
|
@ -1,3 +1,3 @@
|
|||
pub const APP_ID: &str = "com.lemmy-gtk.lemoa";
|
||||
pub const APP_ID: &str = "com.lemmygtk.lemoa";
|
||||
pub const PKGDATADIR: &str = "/usr/local/share/lemoa";
|
||||
pub const VERSION: &str = "0.1.0";
|
||||
|
|
|
@ -2,14 +2,16 @@
|
|||
conf = configuration_data()
|
||||
conf.set_quoted('APP_ID', application_id)
|
||||
conf.set_quoted('PKGDATADIR', pkgdatadir)
|
||||
conf.set_quoted('VERSION', version)
|
||||
conf.set_quoted('VERSION', version + version_suffix)
|
||||
|
||||
# Update the application config info
|
||||
configure_file(
|
||||
input: 'config.rs.in',
|
||||
output: 'config.rs',
|
||||
configuration: conf
|
||||
)
|
||||
|
||||
# copy the config info into the project
|
||||
run_command(
|
||||
'cp',
|
||||
join_paths(meson.project_build_root(), 'src', 'config.rs'),
|
||||
|
@ -20,10 +22,21 @@ run_command(
|
|||
# Setup cargo
|
||||
cargo = find_program('cargo')
|
||||
cargo_env = [ 'CARGO_HOME=' + meson.project_build_root() / 'cargo-home' ]
|
||||
|
||||
cargo_options = [ '--manifest-path', meson.project_source_root() / 'Cargo.toml' ]
|
||||
cargo_options += [ '--target-dir', meson.project_build_root() / 'target' ]
|
||||
cargo_options += [ '--release' ]
|
||||
|
||||
# If the profile is development, build as debug, otherwise release
|
||||
if get_option('profile') == 'default'
|
||||
cargo_options += [ '--release' ]
|
||||
rust_target = 'release'
|
||||
message('Building in release mode')
|
||||
else
|
||||
rust_target = 'debug'
|
||||
message('Building in debug mode')
|
||||
endif
|
||||
|
||||
# Build the actual package
|
||||
cargo_release = custom_target(
|
||||
'cargo-build',
|
||||
build_by_default: true,
|
||||
|
@ -38,7 +51,6 @@ cargo_release = custom_target(
|
|||
cargo, 'build',
|
||||
cargo_options,
|
||||
'&&',
|
||||
'cp', 'target' / 'release' / meson.project_name(), '@OUTPUT@',
|
||||
'cp', 'target' / rust_target / meson.project_name(), '@OUTPUT@',
|
||||
]
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue