From a8c02f9d19147a2a4e2894590253bd11265b33d0 Mon Sep 17 00:00:00 2001 From: oreo639 <31916379+Oreo639@users.noreply.github.com> Date: Sat, 9 Apr 2022 04:27:04 -0700 Subject: [PATCH] glib: support gnome-console --- .../glib/patches/gnome-console-support.patch | 62 +++++++++++++++++++ srcpkgs/glib/template | 2 +- 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/glib/patches/gnome-console-support.patch diff --git a/srcpkgs/glib/patches/gnome-console-support.patch b/srcpkgs/glib/patches/gnome-console-support.patch new file mode 100644 index 00000000000..b142aa0b751 --- /dev/null +++ b/srcpkgs/glib/patches/gnome-console-support.patch @@ -0,0 +1,62 @@ +Currently glib hardcodes a list of terminals and that list will not be expanding. +The hope being that it will eventually be replaced with some kind of api. +Until then, we might as well add gnome-console/kgx to the list + +See: https://gitlab.gnome.org/GNOME/gnome-build-meta/-/merge_requests/1404#note_1331262 +Source: https://github.com/NixOS/nixpkgs/commit/c987121acf5c87436a0b05ca75cd70bf38c452ca + +diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c +index 60d6debb2..a441bfec9 100644 +--- a/gio/gdesktopappinfo.c ++++ b/gio/gdesktopappinfo.c +@@ -2627,6 +2627,7 @@ prepend_terminal_to_vector (int *argc, + int i, j; + char **term_argv = NULL; + int term_argc = 0; ++ gboolean pass_cmd_as_single_arg = FALSE; + char *check; + char **the_argv; + +@@ -2672,6 +2673,11 @@ prepend_terminal_to_vector (int *argc, + } + else + { ++ if (check == NULL) { ++ check = g_find_program_in_path ("kgx"); ++ if (check != NULL) ++ pass_cmd_as_single_arg = TRUE; ++ } + if (check == NULL) + check = g_find_program_in_path ("tilix"); + if (check == NULL) +@@ -2697,14 +2703,27 @@ prepend_terminal_to_vector (int *argc, + } + } + +- real_argc = term_argc + *argc; ++ real_argc = term_argc + (pass_cmd_as_single_arg ? 1 : *argc); + real_argv = g_new (char *, real_argc + 1); + + for (i = 0; i < term_argc; i++) + real_argv[i] = term_argv[i]; + +- for (j = 0; j < *argc; j++, i++) +- real_argv[i] = (char *)the_argv[j]; ++ if (pass_cmd_as_single_arg) { ++ char **quoted_argv = g_new (char *, *argc + 1); ++ ++ for (j = 0; j < *argc; j++) { ++ quoted_argv[j] = g_shell_quote (the_argv[j]); ++ g_free (the_argv[j]); ++ } ++ quoted_argv[j] = NULL; ++ ++ real_argv[i++] = g_strjoinv (" ", quoted_argv); ++ g_strfreev (quoted_argv); ++ } else { ++ for (j = 0; j < *argc; j++, i++) ++ real_argv[i] = (char *)the_argv[j]; ++ } + + real_argv[i] = NULL; + diff --git a/srcpkgs/glib/template b/srcpkgs/glib/template index b69e5bbda63..8583a661651 100644 --- a/srcpkgs/glib/template +++ b/srcpkgs/glib/template @@ -1,7 +1,7 @@ # Template file for 'glib' pkgname=glib version=2.72.2 -revision=1 +revision=2 build_style=meson # static version is necessary for qemu-user-static; # also disable LTO, otherwise there are multiple failures when linking qemu