unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Josselin Poiret via Guix-patches via <guix-patches@gnu.org>
To: Josselin Poiret <dev@jpoiret.xyz>
Cc: 52492@debbugs.gnu.org
Subject: [bug#52492] [PATCH 6/7] gnu: xdg-desktop-portal-wlr: Add binary dependencies
Date: Tue, 14 Dec 2021 22:47:51 +0100	[thread overview]
Message-ID: <20211214214752.25096-6-dev@jpoiret.xyz> (raw)
In-Reply-To: <20211214214502.24913-1-dev@jpoiret.xyz>

* gnu/packages/patches/xdg-desktop-portal-wlr-harcoded-length.patch:
Add it.
* gnu/local.mk (dist_patch_DATA): Register it.
* gnu/packages/freedesktop.scm (xdg-desktop-portal-wlr): Add
dependencies on bash-minimal, grim and slurp, and hardcode the paths
in source.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/freedesktop.scm                  | 23 +++++++++++++--
 ...g-desktop-portal-wlr-harcoded-length.patch | 28 +++++++++++++++++++
 3 files changed, 50 insertions(+), 2 deletions(-)
 create mode 100644 gnu/packages/patches/xdg-desktop-portal-wlr-harcoded-length.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index a138e574d0..9bbcd42733 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1914,6 +1914,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/wpa-supplicant-CVE-2021-27803.patch	\
   %D%/packages/patches/wpa-supplicant-CVE-2021-30004.patch	\
   %D%/packages/patches/x265-arm-flags.patch			\
+  %D%/packages/patches/xdg-desktop-portal-wlr-harcoded-length.patch\
   %D%/packages/patches/xf86-video-ark-remove-mibstore.patch	\
   %D%/packages/patches/xf86-video-mach64-bool-to-boolean.patch	\
   %D%/packages/patches/xf86-video-mach64-glibc-2.20.patch	\
diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm
index e1827ffdad..1ed09dbf2c 100644
--- a/gnu/packages/freedesktop.scm
+++ b/gnu/packages/freedesktop.scm
@@ -2387,18 +2387,37 @@ (define-public xdg-desktop-portal-wlr
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "1ipg35gv8ja39ijwbyi96qlyq2y1fjdggl40s38rv68bsya8zry1"))))
+                "1ipg35gv8ja39ijwbyi96qlyq2y1fjdggl40s38rv68bsya8zry1"))
+              (patches (search-patches "xdg-desktop-portal-wlr-harcoded-length.patch"))))
     (build-system meson-build-system)
     (arguments
      `(#:configure-flags
        '("-Dsystemd=disabled"
-         "-Dsd-bus-provider=libelogind")))
+         "-Dsd-bus-provider=libelogind")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'hardcode-binaries
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let ((sh (search-input-file inputs "/bin/sh"))
+                   (grim (search-input-file inputs "/bin/grim"))
+                   (slurp (search-input-file inputs "/bin/slurp")))
+               (substitute* "src/screenshot/screenshot.c"
+                 (("grim") grim)
+                 (("slurp") slurp)
+                 (("execl\\(\"/bin/sh\", \"/bin/sh\"")
+                  (string-append "execl(\"" sh "\", \"" sh "\"")))
+               (substitute* "src/screencast/screencast.c"
+                 (("execvp\\(\"sh")
+                  (string-append "execvp(\"" sh)))))))))
     (native-inputs
      (list cmake pkg-config))
     (inputs (list elogind
+                  bash-minimal
+                  grim
                   iniparser
                   libinih
                   pipewire-0.3
+                  slurp
                   wayland
                   wayland-protocols))
     (home-page "https://github.com/emersion/xdg-desktop-portal-wlr")
diff --git a/gnu/packages/patches/xdg-desktop-portal-wlr-harcoded-length.patch b/gnu/packages/patches/xdg-desktop-portal-wlr-harcoded-length.patch
new file mode 100644
index 0000000000..b499a039e8
--- /dev/null
+++ b/gnu/packages/patches/xdg-desktop-portal-wlr-harcoded-length.patch
@@ -0,0 +1,28 @@
+From 3121eeb5e68bedd6e2398f35b9bd60b69709a47e Mon Sep 17 00:00:00 2001
+From: Josselin Poiret <dev@jpoiret.xyz>
+Date: Tue, 14 Dec 2021 18:49:54 +0100
+Subject: [PATCH] Replace hardcoded command length
+
+---
+ src/screenshot/screenshot.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/src/screenshot/screenshot.c b/src/screenshot/screenshot.c
+index 9df0ea7..5f27681 100644
+--- a/src/screenshot/screenshot.c
++++ b/src/screenshot/screenshot.c
+@@ -42,8 +42,9 @@ static bool exec_screenshooter_interactive(const char *path) {
+ 		perror("fork");
+ 		return false;
+ 	} else if (pid == 0) {
+-		char cmd[strlen(path) + 25];
+-		snprintf(cmd, sizeof(cmd), "grim -g \"$(slurp)\" -- %s", path);
++		const char cmd_fmt[] = "grim -g \"$(slurp)\" -- %s";
++		char cmd[strlen(path) + sizeof(cmd_fmt)];
++		snprintf(cmd, sizeof(cmd), cmd_fmt, path);
+ 		execl("/bin/sh", "/bin/sh", "-c", cmd, NULL);
+ 		perror("execl");
+ 		exit(127);
+-- 
+2.34.0
+
-- 
2.34.0





  parent reply	other threads:[~2021-12-14 21:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-14 21:45 [bug#52492] [PATCH 0/7] Improve screen sharing support under Wayland Josselin Poiret via Guix-patches via
2021-12-14 21:47 ` [bug#52492] [PATCH 1/7] gnu: pipewire-0.3: Use new input style Josselin Poiret via Guix-patches via
2021-12-19 12:23   ` [bug#52492] [PATCH 0/7] Improve screen sharing support under Wayland Mathieu Othacehe
2021-12-14 21:47 ` [bug#52492] [PATCH 2/7] gnu: pipewire-0.3: Update to 0.3.41 Josselin Poiret via Guix-patches via
2021-12-14 21:47 ` [bug#52492] [PATCH 3/7] gnu: Add wireplumber Josselin Poiret via Guix-patches via
2021-12-19 12:24   ` [bug#52492] [PATCH 0/7] Improve screen sharing support under Wayland Mathieu Othacehe
2021-12-14 21:47 ` [bug#52492] [PATCH 4/7] gnu: xdg-desktop-portal-wlr: Update to 0.5.0 Josselin Poiret via Guix-patches via
2021-12-14 21:47 ` [bug#52492] [PATCH 5/7] gnu: xdg-desktop-portal-wlr: Use new input style Josselin Poiret via Guix-patches via
2021-12-14 21:47 ` Josselin Poiret via Guix-patches via [this message]
2021-12-19 12:24   ` [bug#52492] [PATCH 0/7] Improve screen sharing support under Wayland Mathieu Othacehe
2021-12-14 21:47 ` [bug#52492] [PATCH 7/7] gnu: flameshot: Update to 0.10.2 Josselin Poiret via Guix-patches via
2021-12-19 12:22 ` bug#52492: [PATCH 0/7] Improve screen sharing support under Wayland Mathieu Othacehe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211214214752.25096-6-dev@jpoiret.xyz \
    --to=guix-patches@gnu.org \
    --cc=52492@debbugs.gnu.org \
    --cc=dev@jpoiret.xyz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).