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>
This commit is contained in:
Simon McVittie 2022-07-14 14:28:11 +01:00 committed by Philip Withnall
parent 8157668eac
commit ae15c800ce
3 changed files with 8 additions and 0 deletions

View File

@ -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";

View File

@ -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)

View File

@ -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