meson: prevent RPATH stripping
authorEric Le Bihan <eric.le.bihan.dev@free.fr>
Tue, 15 May 2018 19:51:54 +0000 (21:51 +0200)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Wed, 30 May 2018 20:19:20 +0000 (22:19 +0200)
By default, Meson strips RPATH from the executable it builds [1,2],
unless explicitly set via install_rpath.

This will make support/scripts/check-host-rpath fail when building the
host variant of a Meson-based package.

So add a patch to prevent RPATH from being stripped if install_rpath is
not set and notify user about it.

[1] https://github.com/mesonbuild/meson/issues/2567
[2] https://github.com/mesonbuild/meson/issues/314#issuecomment-157658562

Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
package/meson/0001-Only-fix-RPATH-if-install_rpath-is-not-empty.patch [new file with mode: 0644]

diff --git a/package/meson/0001-Only-fix-RPATH-if-install_rpath-is-not-empty.patch b/package/meson/0001-Only-fix-RPATH-if-install_rpath-is-not-empty.patch
new file mode 100644 (file)
index 0000000..03c1944
--- /dev/null
@@ -0,0 +1,32 @@
+From 53e4920038d5562b7b672fec8b9469fc02eef4ad Mon Sep 17 00:00:00 2001
+From: Eric Le Bihan <eric.le.bihan.dev@free.fr>
+Date: Thu, 10 May 2018 21:57:49 +0200
+Subject: [PATCH] Only fix RPATH if install_rpath is not empty
+
+Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
+---
+ mesonbuild/scripts/meson_install.py | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/mesonbuild/scripts/meson_install.py b/mesonbuild/scripts/meson_install.py
+index 013f2a00..f7ff1dcc 100644
+--- a/mesonbuild/scripts/meson_install.py
++++ b/mesonbuild/scripts/meson_install.py
+@@ -368,7 +368,13 @@ def install_targets(d):
+                     printed_symlink_error = True
+         if os.path.isfile(outname):
+             try:
+-                depfixer.fix_rpath(outname, install_rpath, False)
++                # Buildroot check-host-rpath script expects RPATH
++                # But if install_rpath is empty, it will stripped.
++                # So, preserve it in this case
++                if install_rpath:
++                    depfixer.fix_rpath(outname, install_rpath, False)
++                else:
++                    print("Skipping RPATH fixing")
+             except SystemExit as e:
+                 if isinstance(e.code, int) and e.code == 0:
+                     pass
+-- 
+2.14.3
+