diff --git a/meson-gse/meson.build.m4 b/meson-gse/meson.build.m4 --- a/meson-gse/meson.build.m4 2022-03-13 02:03:28.000000000 +0300 +++ b/meson-gse/meson.build.m4 2022-07-03 10:19:07.080321000 +0300 @@ -63,6 +63,15 @@ gnome = import('gnome') i18n = import('i18n') +if get_option('local_install').auto() + gse_local_install = false + if get_option('prefix') == '/usr/local' + gse_local_install = run_command(find_program('id'), '-u').stdout().strip() != '0' + endif +else + gse_local_install = get_option('local_install').enabled() +endif + gse_lib_convenience = files('meson-gse/lib/convenience.js') gse_lib_logger = files('meson-gse/lib/logger.js') @@ -97,17 +106,28 @@ # End of extension-specific settings # Boilerplate -gse_run_command_obj = run_command('sh', '-c', 'echo $HOME') -if gse_run_command_obj.returncode() != 0 - error('HOME not found, exit=@0@'.format(gse_run_command_obj.returncode())) +if gse_local_install + gse_run_command_obj = run_command('sh', '-c', 'echo $HOME') + if gse_run_command_obj.returncode() != 0 + error('HOME not found, exit=@0@'.format(gse_run_command_obj.returncode())) + endif + prefix = gse_run_command_obj.stdout().strip() / '.local' +else + prefix = get_option('prefix') endif -home = gse_run_command_obj.stdout().strip() gse_uuid = meson.project_name() + '@$2' -gse_target_dir = home + '/.local/share/gnome-shell/extensions/' + gse_uuid -gse_target_dir_schemas = join_paths(gse_target_dir, 'schemas') -gse_target_locale_dir = join_paths(gse_target_dir, 'locale') -gse_target_dir_dbus_intf = join_paths(gse_target_dir, 'dbus-interfaces') +gse_target_dir = prefix + '/share/gnome-shell/extensions/' + gse_uuid + +if gse_local_install + gse_target_dir_schemas = join_paths(gse_target_dir, 'schemas') + gse_target_locale_dir = join_paths(gse_target_dir, 'locale') + gse_target_dir_dbus_intf = join_paths(gse_target_dir, 'dbus-interfaces') +else + gse_target_dir_schemas = prefix / get_option('datadir') / 'glib-2.0' / 'schemas' + gse_target_locale_dir = prefix / get_option('localedir') + gse_target_dir_dbus_intf = join_paths(gse_target_dir, 'dbus-interfaces') +endif meson_extra_scripts = 'meson-gse/meson-scripts'