tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
vixl: init at 8.0.0
Jonas Heinrich
4 months ago
b15e124e
a1f79a17
+488
2 changed files
expand all
collapse all
unified
split
pkgs
by-name
vi
vixl
add_missing_meson_support.patch
package.nix
+445
pkgs/by-name/vi/vixl/add_missing_meson_support.patch
···
1
1
+
From 7c6adc3fbb3624261b9c4d4e0702018697486e3b Mon Sep 17 00:00:00 2001
2
2
+
From: Andrea Pappacoda <andrea@pappacoda.it>
3
3
+
Date: Wed, 7 Aug 2024 00:11:15 +0200
4
4
+
Subject: [PATCH] build: add Meson support
5
5
+
6
6
+
I was trying to package Vixl, but the SCons build system does not
7
7
+
provide an install target, so I would've had to add it. It seemed too
8
8
+
difficult, so I directly created a quite basic Meson build script.
9
9
+
10
10
+
It provides most features of the SCons script, except for tests and
11
11
+
benchmarks, while adding a rich install target, with library soname
12
12
+
versioning and a pkg-config file.
13
13
+
14
14
+
Meson is a simple yet powerful build system, and you're interested in
15
15
+
using it as your main build system I could add tests and benchmarks :)
16
16
+
17
17
+
Origin: upstream, https://github.com/Linaro/vixl/pull/7
18
18
+
Last-Update: 2025-03-22
19
19
+
---
20
20
+
AUTHORS | 1 +
21
21
+
doc/aarch32/meson.build | 12 +++
22
22
+
doc/aarch64/meson.build | 21 +++++
23
23
+
doc/aarch64/topics/meson.build | 21 +++++
24
24
+
doc/meson.build | 21 +++++
25
25
+
meson.build | 158 +++++++++++++++++++++++++++++++++
26
26
+
meson_options.txt | 40 +++++++++
27
27
+
src/aarch32/meson.build | 30 +++++++
28
28
+
src/aarch64/meson.build | 47 ++++++++++
29
29
+
9 files changed, 351 insertions(+)
30
30
+
create mode 100644 doc/aarch32/meson.build
31
31
+
create mode 100644 doc/aarch64/meson.build
32
32
+
create mode 100644 doc/aarch64/topics/meson.build
33
33
+
create mode 100644 doc/meson.build
34
34
+
create mode 100644 meson.build
35
35
+
create mode 100644 meson_options.txt
36
36
+
create mode 100644 src/aarch32/meson.build
37
37
+
create mode 100644 src/aarch64/meson.build
38
38
+
39
39
+
diff --git a/AUTHORS b/AUTHORS
40
40
+
index 257ec9d3..13809d26 100644
41
41
+
--- a/AUTHORS
42
42
+
+++ b/AUTHORS
43
43
+
@@ -6,3 +6,4 @@
44
44
+
ARM Ltd. <*@arm.com>
45
45
+
Google Inc. <*@google.com>
46
46
+
Linaro <*@linaro.org>
47
47
+
+Andrea Pappacoda <andrea@pappacoda.it>
48
48
+
diff --git a/doc/aarch32/meson.build b/doc/aarch32/meson.build
49
49
+
new file mode 100644
50
50
+
index 00000000..e07fc46d
51
51
+
--- /dev/null
52
52
+
+++ b/doc/aarch32/meson.build
53
53
+
@@ -0,0 +1,12 @@
54
54
+
+# SPDX-FileCopyrightText: 2021 VIXL authors
55
55
+
+# SPDX-License-Identifier: BSD-3-Clause
56
56
+
+
57
57
+
+custom_target(
58
58
+
+ 'doc_aarch32',
59
59
+
+ command: [markdown, '@INPUT@'],
60
60
+
+ input: 'getting-started-aarch32.md',
61
61
+
+ output: '@BASENAME@.html',
62
62
+
+ capture: true,
63
63
+
+ install: true,
64
64
+
+ install_dir: doc_dir/'aarch32'
65
65
+
+)
66
66
+
diff --git a/doc/aarch64/meson.build b/doc/aarch64/meson.build
67
67
+
new file mode 100644
68
68
+
index 00000000..d25f8bfa
69
69
+
--- /dev/null
70
70
+
+++ b/doc/aarch64/meson.build
71
71
+
@@ -0,0 +1,21 @@
72
72
+
+# SPDX-FileCopyrightText: 2021 VIXL authors
73
73
+
+# SPDX-License-Identifier: BSD-3-Clause
74
74
+
+
75
75
+
+doc_aarch64_files = [
76
76
+
+ 'getting-started-aarch64',
77
77
+
+ 'supported-instructions-aarch64'
78
78
+
+]
79
79
+
+
80
80
+
+foreach file : doc_aarch64_files
81
81
+
+ custom_target(
82
82
+
+ 'doc_aarch64_' + file,
83
83
+
+ command: [markdown, '@INPUT@'],
84
84
+
+ input: file + '.md',
85
85
+
+ output: file + '.html',
86
86
+
+ capture: true,
87
87
+
+ install: true,
88
88
+
+ install_dir: doc_dir/'aarch64'
89
89
+
+ )
90
90
+
+endforeach
91
91
+
+
92
92
+
+subdir('topics')
93
93
+
diff --git a/doc/aarch64/topics/meson.build b/doc/aarch64/topics/meson.build
94
94
+
new file mode 100644
95
95
+
index 00000000..c6e8542b
96
96
+
--- /dev/null
97
97
+
+++ b/doc/aarch64/topics/meson.build
98
98
+
@@ -0,0 +1,21 @@
99
99
+
+# SPDX-FileCopyrightText: 2021 VIXL authors
100
100
+
+# SPDX-License-Identifier: BSD-3-Clause
101
101
+
+
102
102
+
+doc_aarch64_topics_files = [
103
103
+
+ 'extending-the-disassembler',
104
104
+
+ 'index',
105
105
+
+ 'state-trace',
106
106
+
+ 'ycm'
107
107
+
+]
108
108
+
+
109
109
+
+foreach file : doc_aarch64_topics_files
110
110
+
+ custom_target(
111
111
+
+ 'doc_aarch64_topics_' + file,
112
112
+
+ command: [markdown, '@INPUT@'],
113
113
+
+ input: file + '.md',
114
114
+
+ output: file + '.html',
115
115
+
+ capture: true,
116
116
+
+ install: true,
117
117
+
+ install_dir: doc_dir/'aarch64'/'topics'
118
118
+
+ )
119
119
+
+endforeach
120
120
+
diff --git a/doc/meson.build b/doc/meson.build
121
121
+
new file mode 100644
122
122
+
index 00000000..cbfe193d
123
123
+
--- /dev/null
124
124
+
+++ b/doc/meson.build
125
125
+
@@ -0,0 +1,21 @@
126
126
+
+# SPDX-FileCopyrightText: 2021 VIXL authors
127
127
+
+# SPDX-License-Identifier: BSD-3-Clause
128
128
+
+
129
129
+
+doc_dir = get_option('datadir')/'doc'/meson.project_name()
130
130
+
+
131
131
+
+custom_target(
132
132
+
+ 'doc',
133
133
+
+ command: [markdown, '@INPUT@'],
134
134
+
+ input: '..'/'README.md',
135
135
+
+ output: '@BASENAME@.html',
136
136
+
+ capture: true,
137
137
+
+ install: true,
138
138
+
+ install_dir: doc_dir
139
139
+
+)
140
140
+
+
141
141
+
+if build_a32 or build_t32
142
142
+
+ subdir('aarch32')
143
143
+
+endif
144
144
+
+if build_a64
145
145
+
+ subdir('aarch64')
146
146
+
+endif
147
147
+
diff --git a/meson.build b/meson.build
148
148
+
new file mode 100644
149
149
+
index 00000000..e0f8f79a
150
150
+
--- /dev/null
151
151
+
+++ b/meson.build
152
152
+
@@ -0,0 +1,158 @@
153
153
+
+# SPDX-FileCopyrightText: 2021 VIXL authors
154
154
+
+# SPDX-License-Identifier: BSD-3-Clause
155
155
+
+
156
156
+
+project(
157
157
+
+ 'vixl',
158
158
+
+ 'cpp',
159
159
+
+ default_options: [
160
160
+
+ 'cpp_std=c++17',
161
161
+
+ 'buildtype=release',
162
162
+
+ 'warning_level=3',
163
163
+
+ 'werror=true',
164
164
+
+ 'd_ndebug=if-release',
165
165
+
+ 'b_lto=true'
166
166
+
+ ],
167
167
+
+ license: 'BSD-3-Clause',
168
168
+
+ meson_version: '>=0.50.0',
169
169
+
+ version: '8.0.0',
170
170
+
+)
171
171
+
+
172
172
+
+deps = []
173
173
+
+extra_args = []
174
174
+
+
175
175
+
+if get_option('debug')
176
176
+
+ extra_args += '-DVIXL_DEBUG'
177
177
+
+endif
178
178
+
+
179
179
+
+hosts_32bit = ['arc', 'arm', 'c2000', 'csky', 'mips', 'ppc', 'riscv32', 'rx', 'sparc', 'wasm32', 'x86']
180
180
+
+can_target_aarch64 = not (host_machine.cpu_family() in hosts_32bit)
181
181
+
+
182
182
+
+build_a32 = false
183
183
+
+build_t32 = false
184
184
+
+build_a64 = false
185
185
+
+
186
186
+
+targets = get_option('target')
187
187
+
+if 'auto' in targets or 'all' in targets
188
188
+
+ if can_target_aarch64 or 'all' in targets
189
189
+
+ extra_args += [
190
190
+
+ '-DVIXL_INCLUDE_TARGET_A32',
191
191
+
+ '-DVIXL_INCLUDE_TARGET_T32',
192
192
+
+ '-DVIXL_INCLUDE_TARGET_A64'
193
193
+
+ ]
194
194
+
+ build_a32 = true
195
195
+
+ build_t32 = true
196
196
+
+ build_a64 = true
197
197
+
+ else
198
198
+
+ extra_args += [
199
199
+
+ '-DVIXL_INCLUDE_TARGET_A32',
200
200
+
+ '-DVIXL_INCLUDE_TARGET_T32'
201
201
+
+ ]
202
202
+
+ build_a32 = true
203
203
+
+ build_t32 = true
204
204
+
+ endif
205
205
+
+else
206
206
+
+ if 'a32' in targets or 'aarch32' in targets
207
207
+
+ extra_args += [
208
208
+
+ '-DVIXL_INCLUDE_TARGET_A32'
209
209
+
+ ]
210
210
+
+ build_a32 = true
211
211
+
+ endif
212
212
+
+ if 't32' in targets or 'aarch32' in targets
213
213
+
+ extra_args += [
214
214
+
+ '-DVIXL_INCLUDE_TARGET_T32'
215
215
+
+ ]
216
216
+
+ build_t32 = true
217
217
+
+ endif
218
218
+
+ if 'a64' in targets or 'aarch64' in targets
219
219
+
+ extra_args += [
220
220
+
+ '-DVIXL_INCLUDE_TARGET_A64'
221
221
+
+ ]
222
222
+
+ build_a64 = true
223
223
+
+ endif
224
224
+
+endif
225
225
+
+
226
226
+
+target_sources = []
227
227
+
+if build_a32 or build_t32
228
228
+
+ subdir('src'/'aarch32')
229
229
+
+endif
230
230
+
+if build_a64
231
231
+
+ subdir('src'/'aarch64')
232
232
+
+endif
233
233
+
+
234
234
+
+if get_option('simulator') == 'auto'
235
235
+
+ if not (host_machine.cpu_family() == 'aarch64') and can_target_aarch64
236
236
+
+ extra_args += '-DVIXL_INCLUDE_SIMULATOR_AARCH64'
237
237
+
+ deps += dependency('threads')
238
238
+
+ endif
239
239
+
+elif get_option('simulator') == 'aarch64'
240
240
+
+ if can_target_aarch64 and build_a64
241
241
+
+ extra_args += '-DVIXL_INCLUDE_SIMULATOR_AARCH64'
242
242
+
+ deps += dependency('threads')
243
243
+
+ else
244
244
+
+ error('Building an AArch64 simulator implies that VIXL targets AArch64. Set `target` to include `aarch64` or `a64`.')
245
245
+
+ endif
246
246
+
+endif
247
247
+
+
248
248
+
+allocator = get_option('code_buffer_allocator')
249
249
+
+if (allocator == 'auto' and host_machine.system() == 'linux') or allocator == 'mmap'
250
250
+
+ extra_args += '-DVIXL_CODE_BUFFER_MMAP'
251
251
+
+else
252
252
+
+ extra_args += '-DVIXL_CODE_BUFFER_MALLOC'
253
253
+
+endif
254
254
+
+
255
255
+
+if get_option('implicit_checks')
256
256
+
+ extra_args += '-DVIXL_ENABLE_IMPLICIT_CHECKS'
257
257
+
+endif
258
258
+
+
259
259
+
+markdown = find_program('markdown', required: get_option('doc'))
260
260
+
+if markdown.found()
261
261
+
+ subdir('doc')
262
262
+
+endif
263
263
+
+
264
264
+
+libvixl = library(
265
265
+
+ 'vixl',
266
266
+
+ 'src'/'code-buffer-vixl.cc',
267
267
+
+ 'src'/'compiler-intrinsics-vixl.cc',
268
268
+
+ 'src'/'cpu-features.cc',
269
269
+
+ 'src'/'utils-vixl.cc',
270
270
+
+ cpp_args: extra_args,
271
271
+
+ include_directories: 'src',
272
272
+
+ dependencies: deps,
273
273
+
+ install: true,
274
274
+
+ sources: target_sources,
275
275
+
+ version: meson.project_version()
276
276
+
+)
277
277
+
+
278
278
+
+vixl_dep = declare_dependency(
279
279
+
+ compile_args: extra_args,
280
280
+
+ include_directories: 'src',
281
281
+
+ link_with: libvixl
282
282
+
+)
283
283
+
+
284
284
+
+if meson.version().version_compare('>=0.54.0')
285
285
+
+ meson.override_dependency('vixl', vixl_dep)
286
286
+
+endif
287
287
+
+
288
288
+
+install_headers(
289
289
+
+ 'src'/'assembler-base-vixl.h',
290
290
+
+ 'src'/'code-buffer-vixl.h',
291
291
+
+ 'src'/'code-generation-scopes-vixl.h',
292
292
+
+ 'src'/'compiler-intrinsics-vixl.h',
293
293
+
+ 'src'/'cpu-features.h',
294
294
+
+ 'src'/'globals-vixl.h',
295
295
+
+ 'src'/'invalset-vixl.h',
296
296
+
+ 'src'/'macro-assembler-interface.h',
297
297
+
+ 'src'/'platform-vixl.h',
298
298
+
+ 'src'/'pool-manager-impl.h',
299
299
+
+ 'src'/'pool-manager.h',
300
300
+
+ 'src'/'utils-vixl.h',
301
301
+
+ subdir: 'vixl'
302
302
+
+)
303
303
+
+
304
304
+
+import('pkgconfig').generate(
305
305
+
+ libvixl,
306
306
+
+ description: 'ARMv8 Runtime Code Generation Library',
307
307
+
+ extra_cflags: extra_args,
308
308
+
+ subdirs: 'vixl',
309
309
+
+ url: 'https://github.com/Linaro/vixl'
310
310
+
+)
311
311
+
diff --git a/meson_options.txt b/meson_options.txt
312
312
+
new file mode 100644
313
313
+
index 00000000..b7b5428d
314
314
+
--- /dev/null
315
315
+
+++ b/meson_options.txt
316
316
+
@@ -0,0 +1,40 @@
317
317
+
+# SPDX-FileCopyrightText: 2021 VIXL authors
318
318
+
+# SPDX-License-Identifier: BSD-3-Clause
319
319
+
+
320
320
+
+option(
321
321
+
+ 'target',
322
322
+
+ type: 'array',
323
323
+
+ choices: ['auto', 'all', 'aarch32', 'a32', 't32', 'aarch64', 'a64'],
324
324
+
+ value: ['auto'],
325
325
+
+ description: 'Target ISA/Architecture'
326
326
+
+)
327
327
+
+
328
328
+
+option(
329
329
+
+ 'simulator',
330
330
+
+ type: 'combo',
331
331
+
+ choices: ['auto', 'aarch64', 'none'],
332
332
+
+ value: 'auto',
333
333
+
+ description: 'Simulators to include'
334
334
+
+)
335
335
+
+
336
336
+
+option(
337
337
+
+ 'code_buffer_allocator',
338
338
+
+ type: 'combo',
339
339
+
+ choices: ['auto', 'malloc', 'mmap'],
340
340
+
+ value: 'auto',
341
341
+
+ description: 'Configure the allocation mechanism in the CodeBuffer'
342
342
+
+)
343
343
+
+
344
344
+
+option(
345
345
+
+ 'implicit_checks',
346
346
+
+ type: 'boolean',
347
347
+
+ value: false,
348
348
+
+ description: 'Allow signals raised from simulated invalid (e.g: out of bounds) memory reads to be handled by the host.'
349
349
+
+)
350
350
+
+
351
351
+
+option(
352
352
+
+ 'doc',
353
353
+
+ type: 'feature',
354
354
+
+ value: 'auto',
355
355
+
+ description: 'Convert documentation to HTML (requires the `markdown` program)'
356
356
+
+)
357
357
+
diff --git a/src/aarch32/meson.build b/src/aarch32/meson.build
358
358
+
new file mode 100644
359
359
+
index 00000000..0b22336f
360
360
+
--- /dev/null
361
361
+
+++ b/src/aarch32/meson.build
362
362
+
@@ -0,0 +1,30 @@
363
363
+
+# SPDX-FileCopyrightText: 2021 VIXL authors
364
364
+
+# SPDX-License-Identifier: BSD-3-Clause
365
365
+
+
366
366
+
+# Need to wrap the filenames in files() otherwise this array would be treated
367
367
+
+# as a simple array of strings, and when used in the master meson.build they
368
368
+
+# would refer to nonexistent paths. Wrapping in files() ensures that the
369
369
+
+# filenames will be always relative to this directory, even if referenced in
370
370
+
+# a different one. As a general rule, when I need to refer to a file from a
371
371
+
+# different build directory I should wrap it in files().
372
372
+
+
373
373
+
+target_sources += files(
374
374
+
+ 'assembler-aarch32.cc',
375
375
+
+ 'constants-aarch32.cc',
376
376
+
+ 'disasm-aarch32.cc',
377
377
+
+ 'instructions-aarch32.cc',
378
378
+
+ 'location-aarch32.cc',
379
379
+
+ 'macro-assembler-aarch32.cc',
380
380
+
+ 'operands-aarch32.cc'
381
381
+
+)
382
382
+
+
383
383
+
+install_headers(
384
384
+
+ 'assembler-aarch32.h',
385
385
+
+ 'constants-aarch32.h',
386
386
+
+ 'disasm-aarch32.h',
387
387
+
+ 'instructions-aarch32.h',
388
388
+
+ 'location-aarch32.h',
389
389
+
+ 'macro-assembler-aarch32.h',
390
390
+
+ 'operands-aarch32.h',
391
391
+
+ subdir: 'vixl'/'aarch32'
392
392
+
+)
393
393
+
diff --git a/src/aarch64/meson.build b/src/aarch64/meson.build
394
394
+
new file mode 100644
395
395
+
index 00000000..2898c8f6
396
396
+
--- /dev/null
397
397
+
+++ b/src/aarch64/meson.build
398
398
+
@@ -0,0 +1,47 @@
399
399
+
+# SPDX-FileCopyrightText: 2021 VIXL authors
400
400
+
+# SPDX-License-Identifier: BSD-3-Clause
401
401
+
+
402
402
+
+# Need to wrap the filenames in files() otherwise this array would be treated
403
403
+
+# as a simple array of strings, and when used in the master meson.build they
404
404
+
+# would refer to nonexistent paths. Wrapping in files() ensures that the
405
405
+
+# filenames will be always relative to this directory, even if referenced in
406
406
+
+# a different one. As a general rule, when I need to refer to a file from a
407
407
+
+# different build directory I should wrap it in files().
408
408
+
+
409
409
+
+target_sources += files(
410
410
+
+ 'assembler-aarch64.cc',
411
411
+
+ 'assembler-sve-aarch64.cc',
412
412
+
+ 'cpu-aarch64.cc',
413
413
+
+ 'cpu-features-auditor-aarch64.cc',
414
414
+
+ 'debugger-aarch64.cc',
415
415
+
+ 'decoder-aarch64.cc',
416
416
+
+ 'disasm-aarch64.cc',
417
417
+
+ 'instructions-aarch64.cc',
418
418
+
+ 'logic-aarch64.cc',
419
419
+
+ 'macro-assembler-aarch64.cc',
420
420
+
+ 'macro-assembler-sve-aarch64.cc',
421
421
+
+ 'operands-aarch64.cc',
422
422
+
+ 'pointer-auth-aarch64.cc',
423
423
+
+ 'registers-aarch64.cc',
424
424
+
+ 'simulator-aarch64.cc'
425
425
+
+)
426
426
+
+
427
427
+
+install_headers(
428
428
+
+ 'abi-aarch64.h',
429
429
+
+ 'assembler-aarch64.h',
430
430
+
+ 'constants-aarch64.h',
431
431
+
+ 'cpu-aarch64.h',
432
432
+
+ 'cpu-features-auditor-aarch64.h',
433
433
+
+ 'debugger-aarch64.h',
434
434
+
+ 'decoder-aarch64.h',
435
435
+
+ 'decoder-constants-aarch64.h',
436
436
+
+ 'decoder-visitor-map-aarch64.h',
437
437
+
+ 'disasm-aarch64.h',
438
438
+
+ 'instructions-aarch64.h',
439
439
+
+ 'macro-assembler-aarch64.h',
440
440
+
+ 'operands-aarch64.h',
441
441
+
+ 'registers-aarch64.h',
442
442
+
+ 'simulator-aarch64.h',
443
443
+
+ 'simulator-constants-aarch64.h',
444
444
+
+ subdir: 'vixl'/'aarch64'
445
445
+
+)
+43
pkgs/by-name/vi/vixl/package.nix
···
1
1
+
{
2
2
+
lib,
3
3
+
stdenv,
4
4
+
fetchFromGitHub,
5
5
+
meson,
6
6
+
fetchpatch,
7
7
+
multimarkdown,
8
8
+
ninja,
9
9
+
pkg-config,
10
10
+
}:
11
11
+
12
12
+
stdenv.mkDerivation (finalAttrs: {
13
13
+
pname = "vixl";
14
14
+
version = "8.0.0";
15
15
+
16
16
+
src = fetchFromGitHub {
17
17
+
owner = "Linaro";
18
18
+
repo = "vixl";
19
19
+
tag = finalAttrs.version;
20
20
+
hash = "sha256-VW4Zoh4L8AXoL2kgthAtHkrTnoKpSa9MsBTEGROUrj4=";
21
21
+
};
22
22
+
23
23
+
# Add missing meson build support
24
24
+
# See: https://github.com/Linaro/vixl/pull/7
25
25
+
patches = [ ./add_missing_meson_support.patch ];
26
26
+
27
27
+
nativeBuildInputs = [
28
28
+
meson
29
29
+
multimarkdown
30
30
+
ninja
31
31
+
pkg-config
32
32
+
];
33
33
+
34
34
+
strictDeps = true;
35
35
+
36
36
+
meta = {
37
37
+
description = "AArch32 and AArch64 runtime code generation library";
38
38
+
homepage = "https://github.com/Linaro/vixl";
39
39
+
license = lib.licenses.bsd3;
40
40
+
platforms = lib.platforms.unix;
41
41
+
maintainers = with lib.maintainers; [ onny ];
42
42
+
};
43
43
+
})