diff mbox series

[bug#51948] Acknowledgement ([PATCH] Meson needs proper wrapping)

Message ID 87mtm1a1wx.fsf@planete-kraus.eu
State Accepted
Headers show
Series [bug#51948] Acknowledgement ([PATCH] Meson needs proper wrapping) | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Vivien Kraus Nov. 18, 2021, 4 p.m. UTC
If I put the code in a new variable, we avoid a world rebuild, is it
better?

Vivien
diff mbox series

Patch

From f25082c0a695734aaada2d286ef1770de5f99c2b Mon Sep 17 00:00:00 2001
From: Vivien Kraus <vivien@planete-kraus.eu>
Date: Thu, 18 Nov 2021 15:17:52 +0100
Subject: [PATCH] gnu: meson: Extend the python path in the installed program.

* gnu/packages/build-tools.scm (meson-wrapped): New variable.
---
 gnu/packages/build-tools.scm | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/gnu/packages/build-tools.scm b/gnu/packages/build-tools.scm
index 849101c2a4..646e28e0c6 100644
--- a/gnu/packages/build-tools.scm
+++ b/gnu/packages/build-tools.scm
@@ -297,6 +297,31 @@  (define-public meson
 resembles Python.")
     (license license:asl2.0)))
 
+(define-public meson-wrapped
+  (package/inherit meson
+    (arguments
+     `(;; FIXME: Tests require many additional inputs and patching many
+       ;; hard-coded file system locations in "run_unittests.py".
+       #:tests? #f
+       #:phases (modify-phases %standard-phases
+                  ;; Meson calls the various executables in out/bin through the
+                  ;; Python interpreter, so we cannot use the shell wrapper.
+                  (replace 'wrap
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (let ((path (string-split (getenv "GUIX_PYTHONPATH") #\:)))
+                        (substitute* (string-append (assoc-ref outputs "out") "/bin/meson")
+                          (("# EASY-INSTALL-ENTRY-SCRIPT")
+                           (format #f "\
+import sys
+~a
+# EASY-INSTALL-ENTRY-SCRIPT"
+                                   (string-join
+                                    (map (lambda (path)
+                                           (format #f "sys.path.insert(0, '~a')"
+                                                   path))
+                                         (reverse path))
+                                    "\n"))))))))))))
+
 ;;; This older Meson variant is kept for now for gtkmm and others that may
 ;;; have problems with 0.60.
 (define-public meson-0.59
-- 
2.34.0