[glib: 6/10] Install gio-launch-desktop in a non-PATH location




commit ae15c800ceeaa79f42cd1fa9f9ffabaab6658abf
Author: Simon McVittie <smcv collabora com>
Date:   Thu Jul 14 14:28:11 2022 +0100

    Install gio-launch-desktop in a non-PATH location
    
    This is an internal helper executable, which users shouldn't invoke
    directly (see glib#1633).
    
    When building for a single-architecture distribution, we can install
    it as ${libexecdir}/gio-launch-desktop.
    
    When building for a multiarch distribution, installing it into an
    architecture-specific location and packaging it alongside the GLib
    library avoids the problem discussed in glib#1633 where it would either
    cause a circular dependency between the GLib library and a common
    cross-architecture package (libglib2.0-bin in Debian), or require a
    separate package just to contain gio-launch-desktop, or cause different
    architectures' copies to overwrite each other.
    
    Signed-off-by: Simon McVittie <smcv collabora com>

 gio/gdesktopappinfo.c | 4 ++++
 gio/meson.build       | 2 ++
 meson.build           | 2 ++
 3 files changed, 8 insertions(+)
---
diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c
index 4813425aca..c46a8f09b3 100644
--- a/gio/gdesktopappinfo.c
+++ b/gio/gdesktopappinfo.c
@@ -2926,6 +2926,10 @@ g_desktop_app_info_launch_uris_with_spawn (GDesktopAppInfo            *info,
           if (!is_setuid)
             tmp = g_getenv ("GIO_LAUNCH_DESKTOP");
 
+          /* Allow build system to specify path to gio-launch-desktop */
+          if (tmp == NULL && g_file_test (GIO_LAUNCH_DESKTOP, G_FILE_TEST_IS_EXECUTABLE))
+            tmp = GIO_LAUNCH_DESKTOP;
+
           /* Fall back on usual searching in $PATH */
           if (tmp == NULL)
             tmp = "gio-launch-desktop";
diff --git a/gio/meson.build b/gio/meson.build
index 60ca579d1a..9557464e8e 100644
--- a/gio/meson.build
+++ b/gio/meson.build
@@ -1,6 +1,7 @@
 gio_c_args = [
   '-DG_LOG_DOMAIN="GLib-GIO"',
   '-DGIO_COMPILATION',
+  '-DGIO_LAUNCH_DESKTOP="@0@"'.format(glib_prefix / multiarch_libexecdir / 'gio-launch-desktop'),
   '-DGIO_MODULE_DIR="@0@"'.format(glib_giomodulesdir),
   '-DLOCALSTATEDIR="@0@"'.format(glib_localstatedir),
 ]
@@ -402,6 +403,7 @@ if host_system != 'windows'
 
     gio_launch_desktop = executable('gio-launch-desktop', 'gio-launch-desktop.c',
       install : true,
+      install_dir : multiarch_libexecdir,
       c_args : gio_c_args,
       # intl.lib is not compatible with SAFESEH
       link_args : noseh_link_args)
diff --git a/meson.build b/meson.build
index 3f28a71ee9..1d11226270 100644
--- a/meson.build
+++ b/meson.build
@@ -88,11 +88,13 @@ if get_option('multiarch')
   # to an architecture-dependent location, with a compatibility symlink
   # in the PATH.
   multiarch_bindir = get_option('libdir') / 'glib-2.0'
+  multiarch_libexecdir = multiarch_bindir
   pkgconfig_multiarch_bindir = '${libdir}/glib-2.0'
 else
   # For single-architecture distributions, just install them into the PATH
   # as was traditionally done.
   multiarch_bindir = get_option('bindir')
+  multiarch_libexecdir = get_option('libexecdir')
   pkgconfig_multiarch_bindir = '${bindir}'
 endif
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]