7 changed files with 275 additions and 248 deletions
@ -1,17 +1,17 @@
|
||||
if profile == 'Devel' |
||||
icon_id = base_id + '.Devel' |
||||
icon_id = base_id + '.Devel' |
||||
else |
||||
icon_id = base_id |
||||
icon_id = base_id |
||||
endif |
||||
|
||||
install_data( |
||||
'@0@.svg'.format(icon_id), |
||||
install_dir: iconsdir / 'hicolor' / 'scalable' / 'apps', |
||||
rename: '@0@.svg'.format(application_id) |
||||
'@0@.svg'.format(icon_id), |
||||
install_dir: iconsdir / 'hicolor' / 'scalable' / 'apps', |
||||
rename: '@0@.svg'.format(application_id), |
||||
) |
||||
|
||||
install_data( |
||||
'@0@-symbolic.svg'.format(base_id), |
||||
install_dir: iconsdir / 'hicolor' / 'symbolic' / 'apps', |
||||
rename: '@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), |
||||
) |
||||
|
||||
@ -1,3 +1,5 @@
|
||||
i18n.gettext(gettext_package, |
||||
args: ['--keyword=gettext_f', '--keyword=ngettext_f:1,2',], |
||||
preset: 'glib') |
||||
i18n.gettext( |
||||
gettext_package, |
||||
args: ['--keyword=gettext_f', '--keyword=ngettext_f:1,2'], |
||||
preset: 'glib', |
||||
) |
||||
|
||||
@ -1,149 +1,166 @@
|
||||
if not build_env_only |
||||
# Compile Blueprint resources |
||||
blp_files = [] |
||||
foreach line : fs.read('ui-blueprint-resources.in').splitlines() |
||||
if not line.startswith('#') and line.strip() != '' |
||||
blp_files += line |
||||
endif |
||||
endforeach |
||||
# Compile Blueprint resources |
||||
blp_files = [] |
||||
foreach line : fs.read('ui-blueprint-resources.in').splitlines() |
||||
if not line.startswith('#') and line.strip() != '' |
||||
blp_files += line |
||||
endif |
||||
endforeach |
||||
|
||||
blueprints = custom_target( |
||||
'blueprints', |
||||
input: blp_files, |
||||
output: '.', |
||||
command: [blueprint_compiler, 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'], |
||||
) |
||||
blueprints = custom_target( |
||||
'blueprints', |
||||
input: blp_files, |
||||
output: '.', |
||||
command: [ |
||||
blueprint_compiler, |
||||
'batch-compile', |
||||
'@OUTPUT@', |
||||
'@CURRENT_SOURCE_DIR@', |
||||
'@INPUT@', |
||||
], |
||||
) |
||||
|
||||
# Populate the GResource file for the compiled Blueprint files dynamically, |
||||
# using the same file list. |
||||
# These files are already added manually in the resources file because they |
||||
# need custom handling. |
||||
blp_exceptions = [ |
||||
'shortcuts-dialog.blp', # Must use the root prefix for auto-detection, it must not be under `/ui`. |
||||
] |
||||
# Populate the GResource file for the compiled Blueprint files dynamically, |
||||
# using the same file list. |
||||
# These files are already added manually in the resources file because they |
||||
# need custom handling. |
||||
blp_exceptions = [ |
||||
'shortcuts-dialog.blp', # Must use the root prefix for auto-detection, it must not be under `/ui`. |
||||
] |
||||
|
||||
ui_files_xml = '' |
||||
foreach file : blp_files |
||||
if not blp_exceptions.contains(file) |
||||
ui_files_xml += '\n <file compressed="true" preprocess="xml-stripblanks">' + file.replace('.blp', '.ui') + '</file>' |
||||
endif |
||||
endforeach |
||||
ui_files_xml = '' |
||||
foreach file : blp_files |
||||
if not blp_exceptions.contains(file) |
||||
ui_files_xml += '\n <file compressed="true" preprocess="xml-stripblanks">' + file.replace( |
||||
'.blp', |
||||
'.ui', |
||||
) + '</file>' |
||||
endif |
||||
endforeach |
||||
|
||||
ui_resources_xml = configure_file( |
||||
input: 'ui-resources.gresource.xml.in', |
||||
output: 'ui-resources.gresource.xml', |
||||
configuration: { 'UI_FILES': ui_files_xml } |
||||
) |
||||
ui_resources_xml = configure_file( |
||||
input: 'ui-resources.gresource.xml.in', |
||||
output: 'ui-resources.gresource.xml', |
||||
configuration: {'UI_FILES': ui_files_xml}, |
||||
) |
||||
|
||||
# Compile the UI files. |
||||
ui_resources = gnome.compile_resources( |
||||
'ui-resources', |
||||
ui_resources_xml, |
||||
gresource_bundle: true, |
||||
install: true, |
||||
install_dir: pkgdatadir, |
||||
dependencies: [blueprints, ui_resources_xml], |
||||
) |
||||
# Compile the UI files. |
||||
ui_resources = gnome.compile_resources( |
||||
'ui-resources', |
||||
ui_resources_xml, |
||||
gresource_bundle: true, |
||||
install: true, |
||||
install_dir: pkgdatadir, |
||||
dependencies: [blueprints, ui_resources_xml], |
||||
) |
||||
endif |
||||
|
||||
# Generate config.rs |
||||
global_conf = configuration_data() |
||||
global_conf.set_quoted('APP_ID', application_id) |
||||
global_conf.set('DISABLE_GLYCIN_SANDBOX', get_option('disable-glycin-sandbox').to_string()) |
||||
global_conf.set( |
||||
'DISABLE_GLYCIN_SANDBOX', |
||||
get_option('disable-glycin-sandbox').to_string(), |
||||
) |
||||
global_conf.set_quoted('GETTEXT_PACKAGE', gettext_package) |
||||
global_conf.set_quoted('LOCALEDIR', localedir) |
||||
global_conf.set_quoted('PKGDATADIR', pkgdatadir) |
||||
global_conf.set('PROFILE', profile) |
||||
global_conf.set_quoted('VERSION', full_version) |
||||
config = configure_file( |
||||
input: 'config.rs.in', |
||||
output: 'config.rs', |
||||
configuration: global_conf |
||||
input: 'config.rs.in', |
||||
output: 'config.rs', |
||||
configuration: global_conf, |
||||
) |
||||
run_command( |
||||
'cp', |
||||
meson.project_build_root() / 'src' / 'config.rs', |
||||
meson.project_source_root() / 'src' / 'config.rs', |
||||
check: true |
||||
'cp', |
||||
meson.project_build_root() / 'src' / 'config.rs', |
||||
meson.project_source_root() / 'src' / 'config.rs', |
||||
check: true, |
||||
) |
||||
|
||||
# Cargo settings |
||||
cargo_options = [ '--manifest-path', meson.project_source_root() / 'Cargo.toml' ] |
||||
cargo_options += [ '--target-dir', meson.project_build_root() / 'src' ] |
||||
cargo_options = ['--manifest-path', meson.project_source_root() / 'Cargo.toml'] |
||||
cargo_options += ['--target-dir', meson.project_build_root() / 'src'] |
||||
|
||||
if profile == 'Devel' |
||||
rust_target = 'debug' |
||||
message('Building in debug mode') |
||||
rust_target = 'debug' |
||||
message('Building in debug mode') |
||||
else |
||||
cargo_options += [ '--release' ] |
||||
rust_target = 'release' |
||||
message('Building in release mode') |
||||
cargo_options += ['--release'] |
||||
rust_target = 'release' |
||||
message('Building in release mode') |
||||
endif |
||||
|
||||
cargo_env = [ 'CARGO_HOME=' + meson.project_build_root() / 'cargo-home' ] |
||||
cargo_env = ['CARGO_HOME=' + meson.project_build_root() / 'cargo-home'] |
||||
|
||||
if not build_env_only |
||||
# Build binary with cargo |
||||
custom_target( |
||||
'cargo-build', |
||||
build_by_default: true, |
||||
build_always_stale: true, |
||||
output: meson.project_name(), |
||||
console: true, |
||||
install: true, |
||||
install_dir: bindir, |
||||
depends: [resources, ui_resources], |
||||
command: [ |
||||
'env', |
||||
cargo_env, |
||||
cargo, 'build', |
||||
cargo_options, |
||||
'&&', |
||||
'cp', 'src' / rust_target / meson.project_name(), '@OUTPUT@', |
||||
] |
||||
) |
||||
# Build binary with cargo |
||||
custom_target( |
||||
'cargo-build', |
||||
build_by_default: true, |
||||
build_always_stale: true, |
||||
output: meson.project_name(), |
||||
console: true, |
||||
install: true, |
||||
install_dir: bindir, |
||||
depends: [resources, ui_resources], |
||||
command: [ |
||||
'env', |
||||
cargo_env, |
||||
cargo, |
||||
'build', |
||||
cargo_options, |
||||
'&&', |
||||
'cp', |
||||
'src' / rust_target / meson.project_name(), |
||||
'@OUTPUT@', |
||||
], |
||||
) |
||||
endif |
||||
|
||||
# Build docs with rustdoc |
||||
rustdoc_flags = ' '.join([ |
||||
'-Zunstable-options', |
||||
'--enable-index-page', |
||||
'--extern-html-root-url=gio=https://gtk-rs.org/gtk-rs-core/stable/latest/docs/', |
||||
'--extern-html-root-url=glib=https://gtk-rs.org/gtk-rs-core/stable/latest/docs/', |
||||
'--extern-html-root-url=gsk4=https://gtk-rs.org/gtk4-rs/stable/latest/docs/', |
||||
'--extern-html-root-url=gdk4=https://gtk-rs.org/gtk4-rs/stable/latest/docs/', |
||||
'--extern-html-root-url=gtk4=https://gtk-rs.org/gtk4-rs/stable/latest/docs/', |
||||
'--extern-html-root-url=libadwaita=https://world.pages.gitlab.gnome.org/Rust/libadwaita-rs/stable/latest/docs/', |
||||
'--cfg=docsrs', |
||||
'-Dwarnings', |
||||
]) |
||||
doc_env = ['RUSTDOCFLAGS=' + rustdoc_flags ] |
||||
rustdoc_flags = ' '.join( |
||||
'-Zunstable-options', |
||||
'--enable-index-page', |
||||
'--extern-html-root-url=gio=https://gtk-rs.org/gtk-rs-core/stable/latest/docs/', |
||||
'--extern-html-root-url=glib=https://gtk-rs.org/gtk-rs-core/stable/latest/docs/', |
||||
'--extern-html-root-url=gsk4=https://gtk-rs.org/gtk4-rs/stable/latest/docs/', |
||||
'--extern-html-root-url=gdk4=https://gtk-rs.org/gtk4-rs/stable/latest/docs/', |
||||
'--extern-html-root-url=gtk4=https://gtk-rs.org/gtk4-rs/stable/latest/docs/', |
||||
'--extern-html-root-url=libadwaita=https://world.pages.gitlab.gnome.org/Rust/libadwaita-rs/stable/latest/docs/', |
||||
'--cfg=docsrs', |
||||
'-Dwarnings', |
||||
) |
||||
doc_env = ['RUSTDOCFLAGS=' + rustdoc_flags] |
||||
doc_deps = [ |
||||
'--package=ruma', |
||||
'--package=ruma-common', |
||||
'--package=ruma-client-api', |
||||
'--package=ruma-events', |
||||
'--package=matrix-sdk', |
||||
'--package=matrix-sdk-base', |
||||
'--package=matrix-sdk-common', |
||||
'--package=matrix-sdk-crypto', |
||||
'--package=matrix-sdk-qrcode', |
||||
'--package=matrix-sdk-sqlite', |
||||
'--package=matrix-sdk-store-encryption', |
||||
'--package=matrix-sdk-ui', |
||||
'--package=fractal', |
||||
'--package=ashpd', |
||||
'--package=ruma', |
||||
'--package=ruma-common', |
||||
'--package=ruma-client-api', |
||||
'--package=ruma-events', |
||||
'--package=matrix-sdk', |
||||
'--package=matrix-sdk-base', |
||||
'--package=matrix-sdk-common', |
||||
'--package=matrix-sdk-crypto', |
||||
'--package=matrix-sdk-qrcode', |
||||
'--package=matrix-sdk-sqlite', |
||||
'--package=matrix-sdk-store-encryption', |
||||
'--package=matrix-sdk-ui', |
||||
'--package=fractal', |
||||
'--package=ashpd', |
||||
] |
||||
|
||||
custom_target( |
||||
'cargo-doc', |
||||
build_by_default: false, |
||||
build_always_stale: true, |
||||
output: 'doc', |
||||
console: true, |
||||
command: [ |
||||
'env', cargo_env + doc_env, |
||||
cargo, 'doc', |
||||
cargo_options + doc_deps + ['--no-deps', '-Zrustdoc-map'] , |
||||
], |
||||
'cargo-doc', |
||||
build_by_default: false, |
||||
build_always_stale: true, |
||||
output: 'doc', |
||||
console: true, |
||||
command: [ |
||||
'env', |
||||
cargo_env + doc_env, |
||||
cargo, |
||||
'doc', |
||||
cargo_options + doc_deps + ['--no-deps', '-Zrustdoc-map'], |
||||
], |
||||
) |
||||
|
||||
Loading…
Reference in new issue