aports/testing/showmethekey/dont-hardcode-bindir.patch

107 lines
3.7 KiB
Diff

Patch-Source: https://github.com/AlynxZhou/showmethekey/pull/7
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Fri, 11 Mar 2022 23:26:58 +0100
Subject: [PATCH] Don't hard-code 'bin' directory, use meson's bindir option
diff --git a/common/config-meson.h.in b/common/config-meson.h.in
index b259100..44430b4 100644
--- a/common/config-meson.h.in
+++ b/common/config-meson.h.in
@@ -3,6 +3,7 @@
#define INSTALL_PREFIX "@install_prefix@"
#define PROJECT_VERSION "@project_version@"
#define GETTEXT_PACKAGE "@gettext_package@"
+#define PACKAGE_BINDIR "@package_bindir@"
#define PACKAGE_LOCALEDIR "@package_localedir@"
#endif
diff --git a/dists/showmethekey.desktop b/dists/showmethekey.desktop.in
similarity index 79%
rename from dists/showmethekey.desktop
rename to dists/showmethekey.desktop.in
index b1401df..e67149f 100644
--- a/dists/showmethekey.desktop
+++ b/dists/showmethekey.desktop.in
@@ -4,8 +4,8 @@ Name=Show Me The Key
GenericName=Show Me The Key
Comment=Show keys you typed on screen.
Icon=showmethekey
-Exec=showmethekey-gtk
-TryExec=/usr/bin/showmethekey-gtk
+Exec=@install_prefix@/@package_bindir@/showmethekey-gtk
+TryExec=@install_prefix@/@package_bindir@/showmethekey-gtk
StartupNotify=false
Terminal=false
Categories=Utility;Accessibility;
diff --git a/meson.build b/meson.build
index 345de0c..2a43345 100644
--- a/meson.build
+++ b/meson.build
@@ -18,6 +18,7 @@ conf_data = configuration_data()
conf_data.set('install_prefix', get_option('prefix'))
conf_data.set('project_version', meson.project_version())
conf_data.set('gettext_package', meson.project_name())
+conf_data.set('package_bindir', get_option('bindir'))
conf_data.set('package_localedir', get_option('localedir'))
configure_file(
@@ -26,6 +27,12 @@ configure_file(
configuration: conf_data
)
+desktop_file = configure_file(
+ input: 'dists/showmethekey.desktop.in',
+ output: 'showmethekey.desktop',
+ configuration: conf_data
+)
+
subdir('showmethekey-cli')
subdir('showmethekey-gtk')
@@ -43,7 +50,7 @@ install_data(
install_dir: get_option('prefix') / get_option('datadir') / 'icons' / 'hicolor' / 'scalable' / 'apps'
)
install_data(
- 'dists' / 'showmethekey.desktop',
+ desktop_file,
install_dir: get_option('prefix') / get_option('datadir') / 'applications'
)
install_data(
diff --git a/showmethekey-cli/meson.build b/showmethekey-cli/meson.build
index 81117e4..948723b 100644
--- a/showmethekey-cli/meson.build
+++ b/showmethekey-cli/meson.build
@@ -19,5 +19,5 @@ executable(
dependencies: cli_dependencies,
include_directories: cli_include_directories,
install: true,
- install_dir: get_option('prefix') / 'bin'
+ install_dir: get_option('prefix') / get_option('bindir')
)
diff --git a/showmethekey-gtk/meson.build b/showmethekey-gtk/meson.build
index e77fb6e..cf5ffed 100644
--- a/showmethekey-gtk/meson.build
+++ b/showmethekey-gtk/meson.build
@@ -51,7 +51,7 @@ executable(
dependencies: gtk_dependencies,
include_directories: gtk_include_directories,
install: true,
- install_dir: get_option('prefix') / 'bin'
+ install_dir: get_option('prefix') / get_option('bindir')
)
subdir('po')
diff --git a/showmethekey-gtk/smtk-keys-emitter.c b/showmethekey-gtk/smtk-keys-emitter.c
index ad367f4..06bfcb6 100644
--- a/showmethekey-gtk/smtk-keys-emitter.c
+++ b/showmethekey-gtk/smtk-keys-emitter.c
@@ -361,7 +361,7 @@ void smtk_keys_emitter_start_async(SmtkKeysEmitter *emitter, GError **error)
emitter->cli = g_subprocess_new(
G_SUBPROCESS_FLAGS_STDIN_PIPE | G_SUBPROCESS_FLAGS_STDOUT_PIPE |
G_SUBPROCESS_FLAGS_STDERR_PIPE,
- error, "pkexec", INSTALL_PREFIX "/bin/showmethekey-cli", NULL);
+ error, "pkexec", INSTALL_PREFIX "/" PACKAGE_BINDIR "/showmethekey-cli", NULL);
// emitter->error is already set, just return.
if (emitter->cli == NULL)
return;