From 38c529f57aa50c1cdb36c1af0488dac363629b72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Hedin=20Br=C3=B8nner?= Date: Fri, 14 Sep 2018 13:50:04 +0200 Subject: [PATCH] glib: use absolute path for `gio-launch-desktop` glib tries to look up `gio-launch-desktop` in the path which obviously can fail. Specifically this now happens when launching gnome-shell. --- pkgs/development/libraries/glib/default.nix | 15 ++++++++++++++- .../glib/fix-gio-launch-desktop-path.patch | 11 +++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/libraries/glib/fix-gio-launch-desktop-path.patch diff --git a/pkgs/development/libraries/glib/default.nix b/pkgs/development/libraries/glib/default.nix index de56b6a5d10a..1eb50fc4f100 100644 --- a/pkgs/development/libraries/glib/default.nix +++ b/pkgs/development/libraries/glib/default.nix @@ -59,7 +59,11 @@ stdenv.mkDerivation rec { ++ optionals stdenv.hostPlatform.isMusl [ ./quark_init_on_demand.patch ./gobject_init_on_demand.patch - ] ++ [ ./schema-override-variable.patch ]; + ] ++ [ + ./schema-override-variable.patch + # Require substituteInPlace in postPatch + ./fix-gio-launch-desktop-path.patch + ]; outputs = [ "bin" "out" "dev" "devdoc" ]; outputBin = "dev"; @@ -88,6 +92,10 @@ stdenv.mkDerivation rec { postPatch = '' substituteInPlace meson.build --replace "install_dir : 'bin'," "install_dir : glib_bindir," + + # substitute fix-gio-launch-desktop-path.patch + substituteInPlace gio/gdesktopappinfo.c --replace "@bindir@" "$out/bin" + chmod +x gio/tests/gengiotypefuncs.py patchShebangs gio/tests/gengiotypefuncs.py patchShebangs glib/gen-unicode-tables.pl @@ -106,6 +114,11 @@ stdenv.mkDerivation rec { mv "$dev/bin/$app" "$bin/bin" done + # Add gio-launch-desktop to $out so we can refer to it from $dev + mkdir $out/bin + mv "$dev/bin/gio-launch-desktop" "$out/bin/" + ln -s "$out/bin/gio-launch-desktop" "$bin/bin/" + moveToOutput "share/glib-2.0" "$dev" substituteInPlace "$dev/bin/gdbus-codegen" --replace "$out" "$dev" sed -i "$dev/bin/glib-gettextize" -e "s|^gettext_dir=.*|gettext_dir=$dev/share/glib-2.0/gettext|" diff --git a/pkgs/development/libraries/glib/fix-gio-launch-desktop-path.patch b/pkgs/development/libraries/glib/fix-gio-launch-desktop-path.patch new file mode 100644 index 000000000000..4fdec2dd7e7d --- /dev/null +++ b/pkgs/development/libraries/glib/fix-gio-launch-desktop-path.patch @@ -0,0 +1,11 @@ +--- a/gio/gdesktopappinfo.c ++++ b/gio/gdesktopappinfo.c +@@ -2725,7 +2725,7 @@ g_desktop_app_info_launch_uris_with_spawn (GDesktopAppInfo *info, + + /* Fall back on usual searching in $PATH */ + if (tmp == NULL) +- tmp = "gio-launch-desktop"; ++ tmp = "@bindir@/gio-launch-desktop"; + g_once_init_leave (&gio_launch_desktop_path, tmp); + } +