diff --git a/.gitlab-ci/check.yml b/.gitlab-ci/check.yml
index fab145a1..6a4b0a36 100644
--- a/.gitlab-ci/check.yml
+++ b/.gitlab-ci/check.yml
@@ -25,3 +25,5 @@ flatpak-checks:
- echo "cargo clippy -- -D warnings" | flatpak-builder --disable-rofiles-fuse --build-shell=${FLATPAK_MODULE} flatpak_app ${MANIFEST_PATH}
# Lint the Blueprint files
- echo "blueprint-compiler format ../src" | flatpak-builder --disable-rofiles-fuse --build-shell=${FLATPAK_MODULE} flatpak_app ${MANIFEST_PATH}
+ # Lint the Meson files
+ - echo "meson format -qr" | flatpak-builder --disable-rofiles-fuse --build-shell=${FLATPAK_MODULE} flatpak_app ${MANIFEST_PATH}
diff --git a/data/icons/meson.build b/data/icons/meson.build
index 9e5b7439..3f9a9ac0 100644
--- a/data/icons/meson.build
+++ b/data/icons/meson.build
@@ -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),
)
diff --git a/data/meson.build b/data/meson.build
index 180521f4..23da265a 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -4,68 +4,65 @@ subdir('icons')
desktop_conf = configuration_data()
desktop_conf.set('icon', application_id)
desktop_file = i18n.merge_file(
- type: 'desktop',
- input: configure_file(
- input: '@0@.desktop.in.in'.format(base_id),
- output: '@BASENAME@',
- configuration: desktop_conf
- ),
- output: '@0@.desktop'.format(application_id),
- po_dir: podir,
- install: true,
- install_dir: datadir / 'applications'
+ type: 'desktop',
+ input: configure_file(
+ input: '@0@.desktop.in.in'.format(base_id),
+ output: '@BASENAME@',
+ configuration: desktop_conf,
+ ),
+ output: '@0@.desktop'.format(application_id),
+ po_dir: podir,
+ install: true,
+ install_dir: datadir / 'applications',
)
# Validate Desktop file
if desktop_file_validate.found()
- test(
- 'validate-desktop',
- desktop_file_validate,
- args: [
- desktop_file.full_path()
- ]
- )
+ test(
+ 'validate-desktop',
+ desktop_file_validate,
+ args: [desktop_file.full_path()],
+ )
endif
# Appdata
if profile == 'Devel'
- appstream_version = major_version
- if pre_release_version != ''
- appstream_version += '~' + pre_release_version
- endif
- appstream_version += '-' + devel_version
+ appstream_version = major_version
+ if pre_release_version != ''
+ appstream_version += '~' + pre_release_version
+ endif
+ appstream_version += '-' + devel_version
- development_release = '''
+ development_release = '''
Development release.
'''.format(appstream_version, release_date)
else
- development_release = ''
+ development_release = ''
endif
appdata_conf = configuration_data()
appdata_conf.set('app-id', application_id)
appdata_conf.set('gettext-package', gettext_package)
appdata_conf.set('development-release', development_release)
appdata_file = i18n.merge_file(
- input: configure_file(
- input: '@0@.metainfo.xml.in.in'.format(base_id),
- output: '@BASENAME@',
- configuration: appdata_conf
- ),
- output: '@0@.metainfo.xml'.format(application_id),
- po_dir: podir,
- install: true,
- install_dir: datadir / 'metainfo'
+ input: configure_file(
+ input: '@0@.metainfo.xml.in.in'.format(base_id),
+ output: '@BASENAME@',
+ configuration: appdata_conf,
+ ),
+ output: '@0@.metainfo.xml'.format(application_id),
+ po_dir: podir,
+ install: true,
+ install_dir: datadir / 'metainfo',
)
# Validate Appdata
if appstreamcli.found()
- test(
- 'validate-appdata', appstreamcli,
- args: [
- 'validate', '--no-net', appdata_file.full_path()
- ]
- )
+ test(
+ 'validate-appdata',
+ appstreamcli,
+ args: ['validate', '--no-net', appdata_file.full_path()],
+ )
endif
# GSchema
@@ -74,20 +71,19 @@ gschema_conf.set('app-id', application_id)
gschema_conf.set('profile', profile)
gschema_conf.set('gettext-package', gettext_package)
configure_file(
- input: '@0@.gschema.xml.in'.format(base_id),
- output: '@0@.gschema.xml'.format(application_id),
- configuration: gschema_conf,
- install: true,
- install_dir: datadir / 'glib-2.0' / 'schemas'
+ input: '@0@.gschema.xml.in'.format(base_id),
+ output: '@0@.gschema.xml'.format(application_id),
+ configuration: gschema_conf,
+ install: true,
+ install_dir: datadir / 'glib-2.0' / 'schemas',
)
# Validate GSchema
if glib_compile_schemas.found()
- test(
- 'validate-gschema', glib_compile_schemas,
- args: [
- '--strict', '--dry-run', meson.current_source_dir()
- ]
- )
+ test(
+ 'validate-gschema',
+ glib_compile_schemas,
+ args: ['--strict', '--dry-run', meson.current_source_dir()],
+ )
endif
# D-Bus service file
@@ -95,11 +91,11 @@ service_conf = configuration_data()
service_conf.set('application_id', application_id)
service_conf.set('bindir', bindir)
configure_file(
- input: 'org.gnome.Fractal.service.in',
- output: '@0@.service'.format(application_id),
- configuration: service_conf,
- install: true,
- install_dir: datadir / 'dbus-1/services',
+ input: 'org.gnome.Fractal.service.in',
+ output: '@0@.service'.format(application_id),
+ configuration: service_conf,
+ install: true,
+ install_dir: datadir / 'dbus-1/services',
)
subdir('resources')
diff --git a/data/resources/meson.build b/data/resources/meson.build
index add7f6c7..1782ee2d 100644
--- a/data/resources/meson.build
+++ b/data/resources/meson.build
@@ -3,43 +3,41 @@
sass_bin = find_program('grass', required: false)
sass_options = []
if not sass_bin.found()
- # Require SASS as we need at least one compiler.
- sass_bin = find_program('sass')
+ # Require SASS as we need at least one compiler.
+ sass_bin = find_program('sass')
- if sass_bin.found()
- # these options are not supported by grass.
- sass_options += ['--no-error-css', '--no-source-map']
- endif
+ if sass_bin.found()
+ # these options are not supported by grass.
+ sass_options += ['--no-error-css', '--no-source-map']
+ endif
endif
# Keep ordered alphabetically.
-scss_deps = files([
- 'stylesheet/_common.scss',
- 'stylesheet/_components.scss',
- 'stylesheet/_login.scss',
- 'stylesheet/_room_details.scss',
- 'stylesheet/_room_history.scss',
- 'stylesheet/_session_view.scss',
- 'stylesheet/_vendor.scss',
-])
+scss_deps = files(
+ 'stylesheet/_common.scss',
+ 'stylesheet/_components.scss',
+ 'stylesheet/_login.scss',
+ 'stylesheet/_room_details.scss',
+ 'stylesheet/_room_history.scss',
+ 'stylesheet/_session_view.scss',
+ 'stylesheet/_vendor.scss',
+)
stylesheet = custom_target(
- 'stylesheet',
- input: 'style.scss',
- output: 'style.css',
- command: [
- sass_bin, sass_options, '@INPUT@', '@OUTPUT@',
- ],
- depend_files: scss_deps,
+ 'stylesheet',
+ input: 'style.scss',
+ output: 'style.css',
+ command: [sass_bin, sass_options, '@INPUT@', '@OUTPUT@'],
+ depend_files: scss_deps,
)
# Resources
resources = gnome.compile_resources(
- 'resources',
- 'resources.gresource.xml',
- gresource_bundle: true,
- install: true,
- install_dir: pkgdatadir,
- dependencies: stylesheet,
+ 'resources',
+ 'resources.gresource.xml',
+ gresource_bundle: true,
+ install: true,
+ install_dir: pkgdatadir,
+ dependencies: stylesheet,
)
diff --git a/meson.build b/meson.build
index b4e711f9..f17dc740 100644
--- a/meson.build
+++ b/meson.build
@@ -1,8 +1,10 @@
-project('fractal',
- 'rust',
- version: '12.1',
- license: 'GPL-3.0-or-later',
- meson_version: '>= 1.2')
+project(
+ 'fractal',
+ 'rust',
+ version: '12.1',
+ license: 'GPL-3.0-or-later',
+ meson_version: '>= 1.2',
+)
fs = import('fs')
gnome = import('gnome')
@@ -16,12 +18,12 @@ pre_release_version = ''
version = major_version
if pre_release_version != ''
- version += '.' + pre_release_version
+ version += '.' + pre_release_version
endif
full_version = version
-dependency('glib-2.0', version: '>= 2.82') # update when changing gtk version
-dependency('gio-2.0', version: '>= 2.82') # always same version as glib
+dependency('glib-2.0', version: '>= 2.82') # update when changing gtk version
+dependency('gio-2.0', version: '>= 2.82') # always same version as glib
dependency('gtk4', version: '>= 4.19.3')
dependency('libadwaita-1', version: '>= 1.8.beta')
@@ -43,8 +45,8 @@ dependency('lcms2', version: '>=2.12.0')
# Linux-only dependencies
if build_machine.system() == 'linux'
- # Required by glycin crate
- dependency('libseccomp', version: '>= 2.5.0')
+ # Required by glycin crate
+ dependency('libseccomp', version: '>= 2.5.0')
endif
# When the `build-env` profile is used, we only want to set up the build
@@ -59,14 +61,24 @@ rustc_version = run_command('rustc', '--version', check: true).stdout().strip()
message(rustc_version)
if not build_env_only
- glib_compile_resources = find_program('glib-compile-resources', required: true)
- glib_compile_schemas = find_program('glib-compile-schemas', required: true)
- desktop_file_validate = find_program('desktop-file-validate', required: false)
- appstreamcli = find_program('appstreamcli', required: false)
-
- blueprint_compiler = find_program('blueprint-compiler', required: true)
- blueprint_compiler_version = run_command('blueprint-compiler', '--version', check: true).stdout().strip()
- message('blueprint-compiler ' + blueprint_compiler_version)
+ glib_compile_resources = find_program(
+ 'glib-compile-resources',
+ required: true,
+ )
+ glib_compile_schemas = find_program('glib-compile-schemas', required: true)
+ desktop_file_validate = find_program(
+ 'desktop-file-validate',
+ required: false,
+ )
+ appstreamcli = find_program('appstreamcli', required: false)
+
+ blueprint_compiler = find_program('blueprint-compiler', required: true)
+ blueprint_compiler_version = run_command(
+ 'blueprint-compiler',
+ '--version',
+ check: true,
+ ).stdout().strip()
+ message('blueprint-compiler ' + blueprint_compiler_version)
endif
prefix = get_option('prefix')
@@ -80,42 +92,42 @@ podir = meson.project_source_root() / 'po'
gettext_package = meson.project_name()
if get_option('profile') == 'development' or build_env_only
- profile = 'Devel'
- application_id += '.Devel'
+ profile = 'Devel'
+ application_id += '.Devel'
elif get_option('profile') == 'hack'
- profile = 'Devel'
- application_id += '.Hack'
+ profile = 'Devel'
+ application_id += '.Hack'
elif get_option('profile') == 'beta'
- profile = 'Beta'
+ profile = 'Beta'
else
- profile = 'Stable'
+ profile = 'Stable'
endif
if profile == 'Devel'
- vcs_tag = run_command('git', 'rev-parse', '--short', 'HEAD').stdout().strip()
- if vcs_tag == ''
- devel_version = profile.to_lower()
- else
- devel_version = vcs_tag
- endif
- full_version += '-' + devel_version
-
- release_date = run_command('git', 'show', '-s', '--format=%cI').stdout().strip()
-
- # Setup pre-commit hook for ensuring coding style is always consistent
- message('Setting up git pre-commit hook…')
- run_command('cp', '-f', 'hooks/pre-commit.hook', '.git/hooks/pre-commit')
+ vcs_tag = run_command('git', 'rev-parse', '--short', 'HEAD').stdout().strip()
+ if vcs_tag == ''
+ devel_version = profile.to_lower()
+ else
+ devel_version = vcs_tag
+ endif
+ full_version += '-' + devel_version
+
+ release_date = run_command('git', 'show', '-s', '--format=%cI').stdout().strip()
+
+ # Setup pre-commit hook for ensuring coding style is always consistent
+ message('Setting up git pre-commit hook…')
+ run_command('cp', '-f', 'hooks/pre-commit.hook', '.git/hooks/pre-commit')
endif
if not build_env_only
- subdir('data')
- subdir('po')
+ subdir('data')
+ subdir('po')
endif
subdir('src')
gnome.post_install(
- gtk_update_icon_cache: true,
- glib_compile_schemas: true,
- update_desktop_database: true,
+ gtk_update_icon_cache: true,
+ glib_compile_schemas: true,
+ update_desktop_database: true,
)
diff --git a/po/meson.build b/po/meson.build
index 4a226d45..822c5f17 100644
--- a/po/meson.build
+++ b/po/meson.build
@@ -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',
+)
diff --git a/src/meson.build b/src/meson.build
index 8e9f9e28..ac7b7b30 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -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.replace('.blp', '.ui') + ''
- endif
- endforeach
+ ui_files_xml = ''
+ foreach file : blp_files
+ if not blp_exceptions.contains(file)
+ ui_files_xml += '\n ' + file.replace(
+ '.blp',
+ '.ui',
+ ) + ''
+ 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'],
+ ],
)