Subject: [bug#30761] [PATCH staging 4/9] build-system/meson: Add the output directory to RUNPATH.

From: Marius Bakke <[email-masked]>
Date: Fri, 9 Mar 2018 19:11:03 +0100

* guix/build/meson-build-system.scm (configure): Set LDFLAGS before invoking meson.
---
 guix/build/meson-build-system.scm | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/guix/build/meson-build-system.scm b/guix/build/meson-build-system.scm
index 2b92240c5..e8cb5440e 100644
--- a/guix/build/meson-build-system.scm
+++ b/guix/build/meson-build-system.scm
@@ -46,6 +46,15 @@
                  ,(string-append "--buildtype=" build-type)
                  ,@configure-flags
                  ,source-dir)))
+
+    ;; Meson lacks good facilities for dealing with RUNPATH, so we
+    ;; add the output "lib" directory here to avoid doing that in
+    ;; many users.  Related issues:
+    ;; * <https://github.com/mesonbuild/meson/issues/314>
+    ;; * <https://github.com/mesonbuild/meson/issues/3038>
+    ;; * <https://github.com/NixOS/nixpkgs/issues/31222>
+    (setenv "LDFLAGS" (string-append "-Wl,-rpath=" out "/lib"))
+
     (mkdir build-dir)
     (chdir build-dir)
     (zero? (apply system* "meson" args))))
-- 
2.16.2