diff options
Diffstat (limited to 'meta/recipes-devtools/meson/meson/0007-mesonbuild-allow-multiple-cross-file-options.patch')
-rw-r--r-- | meta/recipes-devtools/meson/meson/0007-mesonbuild-allow-multiple-cross-file-options.patch | 185 |
1 files changed, 0 insertions, 185 deletions
diff --git a/meta/recipes-devtools/meson/meson/0007-mesonbuild-allow-multiple-cross-file-options.patch b/meta/recipes-devtools/meson/meson/0007-mesonbuild-allow-multiple-cross-file-options.patch deleted file mode 100644 index 6c2949c0e8..0000000000 --- a/meta/recipes-devtools/meson/meson/0007-mesonbuild-allow-multiple-cross-file-options.patch +++ /dev/null | |||
@@ -1,185 +0,0 @@ | |||
1 | From 07ae4f949b8402cff178dd12c210d9a726ffe2da Mon Sep 17 00:00:00 2001 | ||
2 | From: Ross Burton <ross.burton@intel.com> | ||
3 | Date: Mon, 18 Mar 2019 17:27:57 +0000 | ||
4 | Subject: [PATCH] mesonbuild: allow multiple --cross-file options | ||
5 | |||
6 | Just like --native-file, allow multiple --cross-file options. This is mostly | ||
7 | unifying the logic between cross_files and config_files. | ||
8 | |||
9 | Upstream-Status: Backport [will be in 0.50.1] | ||
10 | Signed-off-by: Ross Burton <ross.burton@intel.com> | ||
11 | |||
12 | --- | ||
13 | .../markdown/snippets/multiple-cross-files.md | 3 ++ | ||
14 | mesonbuild/backend/backends.py | 3 +- | ||
15 | mesonbuild/coredata.py | 52 +++---------------- | ||
16 | mesonbuild/environment.py | 5 +- | ||
17 | mesonbuild/msetup.py | 4 +- | ||
18 | mesonbuild/munstable_coredata.py | 5 +- | ||
19 | 6 files changed, 20 insertions(+), 52 deletions(-) | ||
20 | create mode 100644 docs/markdown/snippets/multiple-cross-files.md | ||
21 | |||
22 | diff --git a/docs/markdown/snippets/multiple-cross-files.md b/docs/markdown/snippets/multiple-cross-files.md | ||
23 | new file mode 100644 | ||
24 | index 0000000..de229be | ||
25 | --- /dev/null | ||
26 | +++ b/docs/markdown/snippets/multiple-cross-files.md | ||
27 | @@ -0,0 +1,3 @@ | ||
28 | +## Multipe cross files can be specified | ||
29 | + | ||
30 | +`--cross-file` can be passed multiple times, with the configuration files overlaying the same way as `--native-file`. | ||
31 | diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py | ||
32 | index 4d35d22..5b270d3 100644 | ||
33 | --- a/mesonbuild/backend/backends.py | ||
34 | +++ b/mesonbuild/backend/backends.py | ||
35 | @@ -788,8 +788,7 @@ class Backend: | ||
36 | deps = [os.path.join(self.build_to_src, df) | ||
37 | for df in self.interpreter.get_build_def_files()] | ||
38 | if self.environment.is_cross_build(): | ||
39 | - deps.append(os.path.join(self.build_to_src, | ||
40 | - self.environment.coredata.cross_file)) | ||
41 | + deps.extend(self.environment.coredata.cross_files) | ||
42 | deps.append('meson-private/coredata.dat') | ||
43 | if os.path.exists(os.path.join(self.environment.get_source_dir(), 'meson_options.txt')): | ||
44 | deps.append(os.path.join(self.build_to_src, 'meson_options.txt')) | ||
45 | diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py | ||
46 | index 066ad30..d80e9a0 100644 | ||
47 | --- a/mesonbuild/coredata.py | ||
48 | +++ b/mesonbuild/coredata.py | ||
49 | @@ -265,7 +265,7 @@ class CoreData: | ||
50 | self.compiler_options = PerMachine({}, {}, {}) | ||
51 | self.base_options = {} | ||
52 | self.external_preprocess_args = PerMachine({}, {}, {}) # CPPFLAGS only | ||
53 | - self.cross_file = self.__load_cross_file(options.cross_file) | ||
54 | + self.cross_files = self.__load_config_files(options.cross_file) | ||
55 | self.compilers = OrderedDict() | ||
56 | self.cross_compilers = OrderedDict() | ||
57 | self.deps = OrderedDict() | ||
58 | @@ -276,57 +276,19 @@ class CoreData: | ||
59 | |||
60 | @staticmethod | ||
61 | def __load_config_files(filenames): | ||
62 | + # Need to try and make the passed filenames absolute because when the | ||
63 | + # files are parsed later we'll have chdir()d. | ||
64 | if not filenames: | ||
65 | return [] | ||
66 | filenames = [os.path.abspath(os.path.expanduser(os.path.expanduser(f))) | ||
67 | for f in filenames] | ||
68 | return filenames | ||
69 | |||
70 | - @staticmethod | ||
71 | - def __load_cross_file(filename): | ||
72 | - """Try to load the cross file. | ||
73 | - | ||
74 | - If the filename is None return None. If the filename is an absolute | ||
75 | - (after resolving variables and ~), return that absolute path. Next, | ||
76 | - check if the file is relative to the current source dir. If the path | ||
77 | - still isn't resolved do the following: | ||
78 | - Windows: | ||
79 | - - Error | ||
80 | - *: | ||
81 | - - $XDG_DATA_HOME/meson/cross (or ~/.local/share/meson/cross if | ||
82 | - undefined) | ||
83 | - - $XDG_DATA_DIRS/meson/cross (or | ||
84 | - /usr/local/share/meson/cross:/usr/share/meson/cross if undefined) | ||
85 | - - Error | ||
86 | - | ||
87 | - Non-Windows follows the Linux path and will honor XDG_* if set. This | ||
88 | - simplifies the implementation somewhat. | ||
89 | - """ | ||
90 | - if filename is None: | ||
91 | - return None | ||
92 | - filename = os.path.expanduser(os.path.expandvars(filename)) | ||
93 | - if os.path.isabs(filename): | ||
94 | - return filename | ||
95 | - path_to_try = os.path.abspath(filename) | ||
96 | - if os.path.isfile(path_to_try): | ||
97 | - return path_to_try | ||
98 | - if sys.platform != 'win32': | ||
99 | - paths = [ | ||
100 | - os.environ.get('XDG_DATA_HOME', os.path.expanduser('~/.local/share')), | ||
101 | - ] + os.environ.get('XDG_DATA_DIRS', '/usr/local/share:/usr/share').split(':') | ||
102 | - for path in paths: | ||
103 | - path_to_try = os.path.join(path, 'meson', 'cross', filename) | ||
104 | - if os.path.isfile(path_to_try): | ||
105 | - return path_to_try | ||
106 | - raise MesonException('Cannot find specified cross file: ' + filename) | ||
107 | - | ||
108 | - raise MesonException('Cannot find specified cross file: ' + filename) | ||
109 | - | ||
110 | def libdir_cross_fixup(self): | ||
111 | # By default set libdir to "lib" when cross compiling since | ||
112 | # getting the "system default" is always wrong on multiarch | ||
113 | # platforms as it gets a value like lib/x86_64-linux-gnu. | ||
114 | - if self.cross_file is not None: | ||
115 | + if self.cross_files: | ||
116 | self.builtins['libdir'].value = 'lib' | ||
117 | |||
118 | def sanitize_prefix(self, prefix): | ||
119 | @@ -642,8 +604,8 @@ def read_cmd_line_file(build_dir, options): | ||
120 | options.cmd_line_options = d | ||
121 | |||
122 | properties = config['properties'] | ||
123 | - if options.cross_file is None: | ||
124 | - options.cross_file = properties.get('cross_file', None) | ||
125 | + if not options.cross_file: | ||
126 | + options.cross_file = ast.literal_eval(properties.get('cross_file', '[]')) | ||
127 | if not options.native_file: | ||
128 | # This will be a string in the form: "['first', 'second', ...]", use | ||
129 | # literal_eval to get it into the list of strings. | ||
130 | @@ -654,7 +616,7 @@ def write_cmd_line_file(build_dir, options): | ||
131 | config = CmdLineFileParser() | ||
132 | |||
133 | properties = {} | ||
134 | - if options.cross_file is not None: | ||
135 | + if options.cross_file: | ||
136 | properties['cross_file'] = options.cross_file | ||
137 | if options.native_file: | ||
138 | properties['native_file'] = options.native_file | ||
139 | diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py | ||
140 | index c25ef33..4c1c5ac 100644 | ||
141 | --- a/mesonbuild/environment.py | ||
142 | +++ b/mesonbuild/environment.py | ||
143 | @@ -394,8 +394,9 @@ class Environment: | ||
144 | self.binaries.build = BinaryTable(config.get('binaries', {})) | ||
145 | self.paths.build = Directories(**config.get('paths', {})) | ||
146 | |||
147 | - if self.coredata.cross_file is not None: | ||
148 | - config = MesonConfigFile.parse_datafile(self.coredata.cross_file) | ||
149 | + if self.coredata.cross_files: | ||
150 | + config = MesonConfigFile.from_config_parser( | ||
151 | + coredata.load_configs(self.coredata.cross_files, 'cross')) | ||
152 | self.properties.host = Properties(config.get('properties', {}), False) | ||
153 | self.binaries.host = BinaryTable(config.get('binaries', {}), False) | ||
154 | if 'host_machine' in config: | ||
155 | diff --git a/mesonbuild/msetup.py b/mesonbuild/msetup.py | ||
156 | index 023afdb..6e8ca83 100644 | ||
157 | --- a/mesonbuild/msetup.py | ||
158 | +++ b/mesonbuild/msetup.py | ||
159 | @@ -29,7 +29,9 @@ from .mesonlib import MesonException | ||
160 | |||
161 | def add_arguments(parser): | ||
162 | coredata.register_builtin_arguments(parser) | ||
163 | - parser.add_argument('--cross-file', default=None, | ||
164 | + parser.add_argument('--cross-file', | ||
165 | + default=[], | ||
166 | + action='append', | ||
167 | help='File describing cross compilation environment.') | ||
168 | parser.add_argument('--native-file', | ||
169 | default=[], | ||
170 | diff --git a/mesonbuild/munstable_coredata.py b/mesonbuild/munstable_coredata.py | ||
171 | index 78f3f34..913f942 100644 | ||
172 | --- a/mesonbuild/munstable_coredata.py | ||
173 | +++ b/mesonbuild/munstable_coredata.py | ||
174 | @@ -81,8 +81,9 @@ def run(options): | ||
175 | print('Last seen PKGCONFIG enviroment variable value: ' + v) | ||
176 | elif k == 'version': | ||
177 | print('Meson version: ' + v) | ||
178 | - elif k == 'cross_file': | ||
179 | - print('Cross File: ' + (v or 'None')) | ||
180 | + elif k == 'cross_files': | ||
181 | + if v: | ||
182 | + print('Cross File: ' + ' '.join(v)) | ||
183 | elif k == 'config_files': | ||
184 | if v: | ||
185 | print('Native File: ' + ' '.join(v)) | ||