From 5dddde89332bd718646811ab6e9685c89a5512be Mon Sep 17 00:00:00 2001 From: Leo Date: Mon, 29 Jan 2024 17:05:45 +0900 Subject: [PATCH] Modernize meson (#124) --- data/meson.build | 6 +++--- meson.build | 8 +++++--- meson/post_install.py | 19 ------------------- 3 files changed, 8 insertions(+), 25 deletions(-) delete mode 100644 meson/post_install.py diff --git a/data/meson.build b/data/meson.build index bab61fe8..f0fdf839 100644 --- a/data/meson.build +++ b/data/meson.build @@ -24,13 +24,13 @@ act_interfacesdir = act_dep.get_variable('interfacesdir', pkgconfig_define: ['da meson.add_install_script( symlink, - join_paths(dbus_interfaces_dir, 'io.elementary.SettingsDaemon.AccountsService.xml'), - join_paths(act_interfacesdir, 'io.elementary.SettingsDaemon.AccountsService.xml'), + dbus_interfaces_dir / 'io.elementary.SettingsDaemon.AccountsService.xml', + act_interfacesdir / 'io.elementary.SettingsDaemon.AccountsService.xml', ) install_data( 'io.elementary.settings-daemon.gschema.xml', - install_dir: join_paths(datadir, 'glib-2.0', 'schemas') + install_dir: datadir / 'glib-2.0' / 'schemas' ) i18n.merge_file( diff --git a/meson.build b/meson.build index 595df763..15c2bc71 100644 --- a/meson.build +++ b/meson.build @@ -2,9 +2,11 @@ project('io.elementary.settings-daemon', 'c', 'vala', version: '1.3.1', license: 'GPL3', - meson_version: '>=0.58.0' + meson_version: '>=0.59.0' ) +gnome = import('gnome') + fwupd_dep = dependency('fwupd') gio_dep = dependency ('gio-2.0') glib_dep = dependency('glib-2.0') @@ -45,11 +47,11 @@ config_dep = declare_dependency( include_directories: include_directories('.') ) -symlink = join_paths(meson.current_source_dir (), 'meson', 'create-symlink.sh') +symlink = meson.current_source_dir () / 'meson' / 'create-symlink.sh' subdir('data') subdir('po') subdir('src') subdir('settings-portal') -meson.add_install_script('meson/post_install.py') +gnome.post_install(glib_compile_schemas: true, gtk_update_icon_cache: true, update_desktop_database: true) diff --git a/meson/post_install.py b/meson/post_install.py deleted file mode 100644 index 3b485435..00000000 --- a/meson/post_install.py +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env python3 - -import os -import subprocess - -prefix = os.environ.get('MESON_INSTALL_PREFIX', '/usr/local') -datadir = os.path.join(prefix, 'share') - -# Packaging tools define DESTDIR and this isn't needed for them -if 'DESTDIR' not in os.environ: - print('Compiling gsettings schemas...') - subprocess.call(['glib-compile-schemas', os.path.join(datadir, 'glib-2.0', 'schemas')]) - - print('Updating icon cache...') - subprocess.call(['gtk-update-icon-cache', '-qtf', os.path.join(datadir, 'icons', 'hicolor')]) - - print('Updating desktop database...') - subprocess.call(['update-desktop-database', '-q', os.path.join(datadir, 'applications')]) -