[arch-commits] Commit in mesa/trunk (PKGBUILD get-program-name-based-on-path.patch)

Evangelos Foutras foutrelis at archlinux.org
Fri Feb 8 02:48:57 UTC 2019


    Date: Friday, February 8, 2019 @ 02:48:56
  Author: foutrelis
Revision: 345631

upgpkg: mesa 18.3.3-2

Fix chromium executable detection in drirc.

Added:
  mesa/trunk/get-program-name-based-on-path.patch
Modified:
  mesa/trunk/PKGBUILD

--------------------------------------+
 PKGBUILD                             |    6 ++-
 get-program-name-based-on-path.patch |   58 +++++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+), 1 deletion(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2019-02-08 01:19:55 UTC (rev 345630)
+++ PKGBUILD	2019-02-08 02:48:56 UTC (rev 345631)
@@ -5,7 +5,7 @@
 pkgname=('opencl-mesa' 'vulkan-intel' 'vulkan-radeon' 'libva-mesa-driver' 'mesa-vdpau' 'mesa')
 pkgdesc="An open-source implementation of the OpenGL specification"
 pkgver=18.3.3
-pkgrel=1
+pkgrel=2
 arch=('x86_64')
 makedepends=('python-mako' 'libxml2' 'libx11' 'glproto' 'libdrm' 'dri2proto' 'dri3proto' 'presentproto' 
              'libxshmfence' 'libxxf86vm' 'libxdamage' 'libvdpau' 'libva' 'wayland' 'wayland-protocols'
@@ -14,9 +14,11 @@
 url="https://www.mesa3d.org/"
 license=('custom')
 source=(https://mesa.freedesktop.org/archive/mesa-${pkgver}.tar.xz{,.sig}
+        get-program-name-based-on-path.patch
         LICENSE)
 sha512sums=('cd6214b8bbeb3e3d187139ae1e949684f32f90152e1d7ba8d81222bd088770e28cff7ff165f2ccc41c068950561fe952420c6e54472f7204532a8d8700ff18bb'
             'SKIP'
+            '3c851ec0f1d8c1d918756c5b5315901d2a9c1de22624378bb2ba49ae8d7abc0b6c015a91c455f1d40d50532939f60db81cab0d7c9f832d41162c684582783fa6'
             'f9f0d0ccf166fe6cb684478b6f1e1ab1f2850431c06aa041738563eb1808a004e52cdec823c103c9e180f03ffc083e95974d291353f0220fe52ae6d4897fecc7')
 validpgpkeys=('8703B6700E7EE06D7A39B8D6EDAE37B02CEB490D'  # Emil Velikov <emil.l.velikov at gmail.com>
               '946D09B5E4C9845E63075FF1D961C596A7203456'  # Andres Gomez <tanty at igalia.com>
@@ -27,6 +29,8 @@
 prepare() {
   cd mesa-${pkgver}
 
+  # Needed in order to target Chromium in drirc (included upstream in Mesa 19)
+  patch -Np1 -i ../get-program-name-based-on-path.patch
 }
 
 build() {

Added: get-program-name-based-on-path.patch
===================================================================
--- get-program-name-based-on-path.patch	                        (rev 0)
+++ get-program-name-based-on-path.patch	2019-02-08 02:48:56 UTC (rev 345631)
@@ -0,0 +1,58 @@
+From 759b94038987bb983398cd4b1d2cb1c8f79817a9 Mon Sep 17 00:00:00 2001
+From: Nicholas Kazlauskas <nicholas.kazlauskas at amd.com>
+Date: Tue, 23 Oct 2018 11:38:48 -0400
+Subject: [PATCH] util: Get program name based on path when possible
+
+Some programs start with the path and command line arguments in
+argv[0] (program_invocation_name). Chromium is an example of
+an application using mesa that does this.
+
+This tries to query the real path for the symbolic link /proc/self/exe
+to find the program name instead. It only uses the realpath if it
+was a prefix of the invocation to avoid breaking wine programs.
+
+Cc: Timothy Arceri <tarceri at itsqueeze.com>
+Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas at amd.com>
+Reviewed-by: Eric Engestrom <eric.engestrom at intel.com>
+---
+ src/util/u_process.c | 23 ++++++++++++++++++++++-
+ 1 file changed, 22 insertions(+), 1 deletion(-)
+
+diff --git a/src/util/u_process.c b/src/util/u_process.c
+index 5e5927678d8..a1667e78074 100644
+--- a/src/util/u_process.c
++++ b/src/util/u_process.c
+@@ -41,8 +41,29 @@ static const char *
+ __getProgramName()
+ {
+    char * arg = strrchr(program_invocation_name, '/');
+-   if (arg)
++   if (arg) {
++      /* If the / character was found this is likely a linux path or
++       * an invocation path for a 64-bit wine program.
++       *
++       * However, some programs pass command line arguments into argv[0].
++       * Strip these arguments out by using the realpath only if it was
++       * a prefix of the invocation name.
++       */
++      static char *path;
++
++      if (!path)
++         path = realpath("/proc/self/exe", NULL);
++
++      if (path && strncmp(path, program_invocation_name, strlen(path)) == 0) {
++         /* This shouldn't be null because path is a a prefix,
++          * but check it anyway since path is static. */
++         char * name = strrchr(path, '/');
++         if (name)
++            return name + 1;
++      }
++
+       return arg+1;
++   }
+ 
+    /* If there was no '/' at all we likely have a windows like path from
+     * a wine application.
+-- 
+2.18.1
+



More information about the arch-commits mailing list