aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-wam/cef/files/chromium/0031-M118-fix-Add-a-way-to-set-different-lib-paths-host-a.patch
blob: fa4dfe60d1d98162a95e77bd631bb34f46bc13d7 (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
From e1bc5ea870e17afee145009194e6f2092dd1d3ff Mon Sep 17 00:00:00 2001
From: Roger Zanoni <rzanoni@igalia.com>
Date: Sun, 12 Nov 2023 19:41:07 -0300
Subject: [PATCH 31/33] [M118-fix] Add a way to set different lib paths host
 and target

meta-clang on AGL defines a simplified path structure for clang's
runtime libraries and a different lib naming convention.

Upstream-Status: Inappropriate
Signed-off-by: Roger Zanoni <rzanoni@igalia.com>
---
 build/config/clang/BUILD.gn  | 80 +++++++++++-------------------------
 build/config/clang/clang.gni |  3 ++
 2 files changed, 27 insertions(+), 56 deletions(-)

diff --git a/build/config/clang/BUILD.gn b/build/config/clang/BUILD.gn
index fe044e29e428b..33edce7aed9a2 100644
--- a/build/config/clang/BUILD.gn
+++ b/build/config/clang/BUILD.gn
@@ -3,6 +3,7 @@
 # found in the LICENSE file.
 
 import("//build/config/rust.gni")
+import("//v8/gni/snapshot_toolchain.gni")
 import("clang.gni")
 
 if (is_ios) {
@@ -95,66 +96,33 @@ template("clang_lib") {
     }
   } else {
     config(target_name) {
-      _dir = ""
+      if (current_toolchain == host_toolchain ||
+          current_toolchain == v8_snapshot_toolchain) {
+        _base_path = "$clang_base_path"
+        _cpu = host_cpu
+      } else {
+        _base_path = "$clang_base_path_target"
+        _cpu = target_cpu
+      }
+
+      if (_cpu == "x64") {
+        _suffix = "-x86_64"
+      } else if (_cpu == "x86") {
+        _suffix = "-i386"
+      } else if (_cpu == "arm64") {
+        _suffix = "-aarch64"
+      } else if (_cpu == "arm") {
+        _suffix = "-arm"
+      } else {
+        assert(false)  # Unhandled cpu type
+      }
+
+      _dir = "linux"
       _libname = invoker.libname
       _prefix = "lib"
-      _suffix = ""
       _ext = "a"
-      if (is_win) {
-        _dir = "windows"
-        _prefix = ""
-        _ext = "lib"
-        if (current_cpu == "x64") {
-          _suffix = "-x86_64"
-        } else if (current_cpu == "x86") {
-          _suffix = "-i386"
-        } else if (current_cpu == "arm64") {
-          _suffix = "-aarch64"
-        } else {
-          assert(false)  # Unhandled cpu type
-        }
-      } else if (is_apple) {
-        _dir = "darwin"
-      } else if (is_linux || is_chromeos) {
-        if (current_cpu == "x64") {
-          _dir = "x86_64-unknown-linux-gnu"
-        } else if (current_cpu == "x86") {
-          _dir = "i386-unknown-linux-gnu"
-        } else if (current_cpu == "arm") {
-          _dir = "armv7-unknown-linux-gnueabihf"
-        } else if (current_cpu == "arm64") {
-          _dir = "aarch64-unknown-linux-gnu"
-        } else {
-          assert(false)  # Unhandled cpu type
-        }
-      } else if (is_fuchsia) {
-        if (current_cpu == "x64") {
-          _dir = "x86_64-unknown-fuchsia"
-        } else if (current_cpu == "arm64") {
-          _dir = "aarch64-unknown-fuchsia"
-        } else {
-          assert(false)  # Unhandled cpu type
-        }
-      } else if (is_android) {
-        _dir = "linux"
-        if (current_cpu == "x64") {
-          _suffix = "-x86_64-android"
-        } else if (current_cpu == "x86") {
-          _suffix = "-i686-android"
-        } else if (current_cpu == "arm") {
-          _suffix = "-arm-android"
-        } else if (current_cpu == "arm64") {
-          _suffix = "-aarch64-android"
-        } else if (current_cpu == "riscv64") {
-          _suffix = "-riscv64-android"
-        } else {
-          assert(false)  # Unhandled cpu type
-        }
-      } else {
-        assert(false)  # Unhandled target platform
-      }
 
-      _clang_lib_dir = "$clang_base_path/lib/clang/$clang_version/lib"
+      _clang_lib_dir = "$_base_path/lib/clang/$clang_version/lib"
       _lib_file = "${_prefix}clang_rt.${_libname}${_suffix}.${_ext}"
       libs = [ "$_clang_lib_dir/$_dir/$_lib_file" ]
     }
diff --git a/build/config/clang/clang.gni b/build/config/clang/clang.gni
index 1a065b5e348b0..46fb56693b494 100644
--- a/build/config/clang/clang.gni
+++ b/build/config/clang/clang.gni
@@ -26,6 +26,9 @@ declare_args() {
       build_with_chromium && !is_official_build && is_linux && !is_castos
 
   clang_base_path = default_clang_base_path
+  
+  # used only for linking
+  clang_base_path_target = default_clang_base_path
 
   # Specifies whether or not bitcode should be embedded during compilation.
   # This is used for creating a MLGO corpus from Chromium in the non-ThinLTO case.
-- 
2.42.1