summaryrefslogtreecommitdiffstats
path: root/patches/meson-0.51.2/0002-don-t-add-rpaths-for-build-directories-when-cross-co.patch
blob: f2f531a662930dc5b1925d7fe1e82b7f48da2684 (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/compilers/compilers.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index b188788b915a..aafabd4f7a1b 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -1277,7 +1277,10 @@ class Compiler:
         # 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 = OrderedSet([os.path.join(origin_placeholder, p) for p in processed_rpaths])
+        if not self.is_cross:
+            all_paths = OrderedSet([os.path.join(origin_placeholder, p) for p in processed_rpaths])
+        else:
+            all_paths = OrderedSet()
         # Build_rpath is used as-is (it is usually absolute).
         if build_rpath != '':
             all_paths.add(build_rpath)
@@ -1304,7 +1307,8 @@ class Compiler:
                     paths = padding
                 else:
                     paths = paths + ':' + padding
-            args.append('-Wl,-rpath,' + paths)
+            if paths:
+                args.append('-Wl,-rpath,' + paths)
 
         if mesonlib.is_sunos():
             return args