summaryrefslogtreecommitdiffstats
path: root/patches/meson-0.56.0/0001-don-t-add-rpaths-for-build-directories-when-cross-co.patch
blob: ccf5bfc2ff09ce0d0df4e1ba98f22d404904a069 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From: Michael Olbrich <m.olbrich@pengutronix.de>
Date: Mon, 18 Mar 2019 10:42:15 +0100
Subject: [PATCH] don't add rpaths for build directories when cross-compiling

The binaries cannot be executed anyways, so this just increases the binary
size unnecessarily.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
---
 mesonbuild/linkers.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/mesonbuild/linkers.py b/mesonbuild/linkers.py
index 589945c511ff..59463bdfdcc5 100644
--- a/mesonbuild/linkers.py
+++ b/mesonbuild/linkers.py
@@ -605,7 +605,10 @@ class GnuLikeDynamicLinkerMixin:
         # Need to deduplicate rpaths, as macOS's install_name_tool
         # is *very* allergic to duplicate -delete_rpath arguments
         # when calling depfixer on installation.
-        all_paths = mesonlib.OrderedSet([os.path.join(origin_placeholder, p) for p in processed_rpaths])
+        if not env.is_cross_build():
+            all_paths = mesonlib.OrderedSet([os.path.join(origin_placeholder, p) for p in processed_rpaths])
+        else:
+            all_paths = mesonlib.OrderedSet()
         rpath_dirs_to_remove = set()
         for p in all_paths:
             rpath_dirs_to_remove.add(p.encode('utf8'))
@@ -633,7 +636,8 @@ class GnuLikeDynamicLinkerMixin:
                 paths = padding
             else:
                 paths = paths + ':' + padding
-        args.extend(self._apply_prefix('-rpath,' + paths))
+        if paths:
+            args.extend(self._apply_prefix('-rpath,' + paths))
 
         # TODO: should this actually be "for solaris/sunos"?
         if mesonlib.is_sunos():