From 1877c81d00aadc0dc7f9c905729358b894081dfe Mon Sep 17 00:00:00 2001 From: Michael Gratton Date: Thu, 17 Jan 2019 11:08:26 +1100 Subject: [PATCH] Allow configuring the location of the web extension shared lib --- meson.build | 2 ++ src/client/application/geary-application.vala | 15 +++++++-------- src/meson.build | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/meson.build b/meson.build index ab69eb28..b3c34db0 100644 --- a/meson.build +++ b/meson.build @@ -27,6 +27,7 @@ locale_dir = join_paths(geary_prefix, get_option('localedir')) po_dir = join_paths(meson.source_root(), 'po') vapi_dir = join_paths(meson.source_root(), 'bindings', 'vapi') metadata_dir = join_paths(meson.source_root(), 'bindings', 'metadata') +web_extensions_dir = join_paths(libdir, 'geary', 'web-extensions') # Make sure Meson can find our custom VAPI's add_project_arguments([ @@ -128,6 +129,7 @@ conf.set_quoted('_BUILD_ROOT_DIR', meson.build_root()) conf.set_quoted('_SOURCE_ROOT_DIR', meson.source_root()) conf.set_quoted('_GSETTINGS_DIR', join_paths(meson.build_root(), 'desktop')) conf.set_quoted('_INSTALL_PREFIX', geary_prefix) +conf.set_quoted('_WEB_EXTENSIONS_DIR', web_extensions_dir) conf.set_quoted('LANGUAGE_SUPPORT_DIRECTORY', locale_dir) conf.set_quoted('ISO_CODE_639_XML', iso_639_xml) conf.set_quoted('ISO_CODE_3166_XML', iso_3166_xml) diff --git a/src/client/application/geary-application.vala b/src/client/application/geary-application.vala index e7ecc762..3d814cd2 100644 --- a/src/client/application/geary-application.vala +++ b/src/client/application/geary-application.vala @@ -7,6 +7,7 @@ // Defined by CMake build script. extern const string _INSTALL_PREFIX; extern const string _GSETTINGS_DIR; +extern const string _WEB_EXTENSIONS_DIR; extern const string _SOURCE_ROOT_DIR; extern const string _BUILD_ROOT_DIR; extern const string GETTEXT_PACKAGE; @@ -295,16 +296,14 @@ public class GearyApplication : Gtk.Application { /** * Returns the directory containing the application's WebExtension libs. * - * If the application is installed, this will be - * `$INSTALL_PREFIX/lib/geary/web-extension`, else it will be + * When running from the installation prefix, this will be based + * on the Meson `libdir` option, and can be set by invoking `meson + * configure` as appropriate. */ public File get_web_extensions_dir() { - File? dir = get_install_dir(); - if (dir != null) - dir = dir.get_child("lib").get_child("geary").get_child("web-extensions"); - else - dir = File.new_for_path(BUILD_ROOT_DIR).get_child("src"); - return dir; + return (get_install_dir() != null) + ? File.new_for_path(_WEB_EXTENSIONS_DIR) + : File.new_for_path(BUILD_ROOT_DIR).get_child("src"); } public File? get_desktop_file() { diff --git a/src/meson.build b/src/meson.build index c569a6a9..397d40cf 100644 --- a/src/meson.build +++ b/src/meson.build @@ -60,7 +60,7 @@ geary_web_process = library('geary-web-process', geary_engine_dep, ], install: true, - install_dir: join_paths(libdir, meson.project_name(), 'web-extensions'), + install_dir: web_extensions_dir ) # Now finally, make the geary executable