meson: Don't mangle profile and app id suffix
This commit is contained in:
parent
bf9392e8a2
commit
f6b7ae7567
8 changed files with 28 additions and 27 deletions
|
|
@ -15,7 +15,7 @@ flatpak:
|
||||||
variables:
|
variables:
|
||||||
# We are running tests manually
|
# We are running tests manually
|
||||||
RUN_TESTS: "0"
|
RUN_TESTS: "0"
|
||||||
CONFIG_OPTS: "-Dprofile=ci"
|
CONFIG_OPTS: "-Dprofile=release -Dapp_id_suffix=.Devel"
|
||||||
|
|
||||||
flatpak@aarch64:
|
flatpak@aarch64:
|
||||||
extends: ".flatpak@aarch64"
|
extends: ".flatpak@aarch64"
|
||||||
|
|
@ -23,7 +23,7 @@ flatpak@aarch64:
|
||||||
interruptible: true
|
interruptible: true
|
||||||
variables:
|
variables:
|
||||||
RUN_TESTS: "0"
|
RUN_TESTS: "0"
|
||||||
CONFIG_OPTS: "-Dprofile=ci"
|
CONFIG_OPTS: "-Dprofile=release -Dapp_id_suffix=.Devel"
|
||||||
|
|
||||||
cargo-fmt:
|
cargo-fmt:
|
||||||
image: "rust:slim"
|
image: "rust:slim"
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,8 @@
|
||||||
"name": "loupe",
|
"name": "loupe",
|
||||||
"buildsystem": "meson",
|
"buildsystem": "meson",
|
||||||
"config-opts": [
|
"config-opts": [
|
||||||
"-Dprofile=development"
|
"-Dprofile=dev",
|
||||||
|
"-Dapp_id_suffix=.Devel"
|
||||||
],
|
],
|
||||||
"sources": [
|
"sources": [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ gschema_conf = configuration_data()
|
||||||
gschema_conf.set('app-id', app_id)
|
gschema_conf.set('app-id', app_id)
|
||||||
gschema_conf.set('gettext-package', meson.project_name())
|
gschema_conf.set('gettext-package', meson.project_name())
|
||||||
configure_file(
|
configure_file(
|
||||||
input: '@0@.gschema.xml.in'.format(base_id),
|
input: 'org.gnome.Loupe.gschema.xml.in',
|
||||||
output: '@0@.gschema.xml'.format(app_id),
|
output: '@0@.gschema.xml'.format(app_id),
|
||||||
configuration: gschema_conf,
|
configuration: gschema_conf,
|
||||||
install: true,
|
install: true,
|
||||||
|
|
|
||||||
|
|
@ -24,11 +24,9 @@ gtk4_x11 = dependency('gtk4-x11', required: get_option('x11'))
|
||||||
cargo = find_program('cargo', required: true)
|
cargo = find_program('cargo', required: true)
|
||||||
glib_compile_schemas = find_program('glib-compile-schemas', required: true)
|
glib_compile_schemas = find_program('glib-compile-schemas', required: true)
|
||||||
|
|
||||||
profile = ''
|
|
||||||
version_suffix = ''
|
version_suffix = ''
|
||||||
|
|
||||||
if get_option('profile') != 'release'
|
if get_option('profile') != 'release'
|
||||||
profile = '.Devel'
|
|
||||||
vcs_tag = run_command('git', 'rev-parse', '--short', 'HEAD', check: false).stdout().strip()
|
vcs_tag = run_command('git', 'rev-parse', '--short', 'HEAD', check: false).stdout().strip()
|
||||||
if vcs_tag == ''
|
if vcs_tag == ''
|
||||||
version_suffix = '-devel'
|
version_suffix = '-devel'
|
||||||
|
|
@ -39,8 +37,8 @@ endif
|
||||||
|
|
||||||
prefix = get_option('prefix')
|
prefix = get_option('prefix')
|
||||||
|
|
||||||
base_id = 'org.gnome.Loupe'
|
app_id = 'org.gnome.Loupe@0@'.format(get_option('app_id_suffix'))
|
||||||
app_id = 'org.gnome.Loupe@0@'.format(profile)
|
profile = get_option('profile')
|
||||||
version = meson.project_version() + version_suffix
|
version = meson.project_version() + version_suffix
|
||||||
localedir = prefix / get_option('localedir')
|
localedir = prefix / get_option('localedir')
|
||||||
bindir = prefix / get_option('bindir')
|
bindir = prefix / get_option('bindir')
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,19 @@
|
||||||
option(
|
option(
|
||||||
'profile',
|
'profile',
|
||||||
type: 'combo',
|
type: 'combo',
|
||||||
description: 'The build profiles for the application. Use development or ci for the .Devel app ID. ci also produces optimized bundles.',
|
choices: ['release', 'dev'],
|
||||||
choices: [
|
|
||||||
'release',
|
|
||||||
'development',
|
|
||||||
'ci',
|
|
||||||
],
|
|
||||||
value: 'release',
|
value: 'release',
|
||||||
|
description: 'Cargo profile value.',
|
||||||
|
)
|
||||||
|
option(
|
||||||
|
'app_id_suffix',
|
||||||
|
type: 'combo',
|
||||||
|
choices: ['', '.Devel'],
|
||||||
|
value: '',
|
||||||
|
description: 'Value will be appended to the app id.',
|
||||||
)
|
)
|
||||||
option(
|
option(
|
||||||
'x11',
|
'x11',
|
||||||
type: 'feature',
|
type: 'feature',
|
||||||
description: 'Enable X11 specific features.',
|
description: 'Enable X11 specific features.',
|
||||||
)
|
)
|
||||||
|
|
@ -16,7 +16,6 @@
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
pub const APP_ID: &str = default_env(option_env!("APP_ID"), "org.gnome.Loupe.Devel");
|
pub const APP_ID: &str = default_env(option_env!("APP_ID"), "org.gnome.Loupe.Devel");
|
||||||
pub const PROFILE: &str = default_env(option_env!("PROFILE"), ".Devel");
|
|
||||||
pub const VERSION: &str = default_env(option_env!("VERSION"), "unknown");
|
pub const VERSION: &str = default_env(option_env!("VERSION"), "unknown");
|
||||||
pub const LOCALEDIR: &str = default_env(option_env!("LOCALEDIR"), "/usr/share/locale/");
|
pub const LOCALEDIR: &str = default_env(option_env!("LOCALEDIR"), "/usr/share/locale/");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,28 +3,26 @@ source_root = meson.project_source_root()
|
||||||
|
|
||||||
cargo_options = ['--manifest-path', source_root / 'Cargo.toml']
|
cargo_options = ['--manifest-path', source_root / 'Cargo.toml']
|
||||||
cargo_options += ['--target-dir', build_root / 'src']
|
cargo_options += ['--target-dir', build_root / 'src']
|
||||||
|
cargo_options += ['--profile', profile]
|
||||||
if get_option('profile') == 'development'
|
|
||||||
rust_target = 'debug'
|
|
||||||
message('Building in debug mode')
|
|
||||||
else
|
|
||||||
cargo_options += ['--release']
|
|
||||||
rust_target = 'release'
|
|
||||||
message('Building in release mode')
|
|
||||||
endif
|
|
||||||
|
|
||||||
if gtk4_x11.found()
|
if gtk4_x11.found()
|
||||||
cargo_options += ['--features', 'x11']
|
cargo_options += ['--features', 'x11']
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if profile == 'dev'
|
||||||
|
rust_target = 'debug'
|
||||||
|
elif profile == 'release'
|
||||||
|
rust_target = 'release'
|
||||||
|
endif
|
||||||
|
|
||||||
cargo_env = {
|
cargo_env = {
|
||||||
'CARGO_HOME': build_root / 'cargo-home',
|
'CARGO_HOME': build_root / 'cargo-home',
|
||||||
'APP_ID': app_id,
|
'APP_ID': app_id,
|
||||||
'PROFILE': profile,
|
|
||||||
'VERSION': version,
|
'VERSION': version,
|
||||||
'LOCALEDIR': localedir,
|
'LOCALEDIR': localedir,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Build binary
|
||||||
cargo_build = custom_target(
|
cargo_build = custom_target(
|
||||||
'cargo-build',
|
'cargo-build',
|
||||||
build_by_default: true,
|
build_by_default: true,
|
||||||
|
|
@ -39,6 +37,7 @@ cargo_build = custom_target(
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Copy binary
|
||||||
custom_target(
|
custom_target(
|
||||||
'cp-binary',
|
'cp-binary',
|
||||||
depends: cargo_build,
|
depends: cargo_build,
|
||||||
|
|
@ -67,6 +66,7 @@ custom_target(
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Run tests
|
||||||
test(
|
test(
|
||||||
'cargo-test',
|
'cargo-test',
|
||||||
cargo,
|
cargo,
|
||||||
|
|
|
||||||
|
|
@ -205,7 +205,7 @@ mod imp {
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
if config::PROFILE == ".Devel" {
|
if config::APP_ID.ends_with(".Devel") {
|
||||||
obj.add_css_class("devel");
|
obj.add_css_class("devel");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue