-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeson.build
88 lines (69 loc) · 2.57 KB
/
meson.build
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
project('systemd-boot-efi', 'c',
version : '257',
license : 'GPLv2',
default_options: [
'c_std=gnu11',
'warning_level=2',
],
meson_version : '>= 0.60.0',
)
project_major_version = meson.project_version().split('.')[0].split('~')[0]
if meson.project_version().contains('.')
project_minor_version = meson.project_version().split('.')[-1].split('~')[0]
else
project_minor_version = '0'
endif
conf = configuration_data()
conf.set_quoted('PROJECT_URL', 'https://systemd.io/')
conf.set('PROJECT_VERSION', project_major_version,
description : 'Numerical project version (used where a simple number is expected)')
# Our own paths
bootlibdir = get_option('prefix')
cc = meson.get_compiler('c')
sh = find_program('sh')
# new in GCC 10
have = cc.has_argument('-Wzero-length-bounds')
conf.set10('HAVE_WARNING_ZERO_LENGTH_BOUNDS', have)
# new in GCC 15
have = cc.has_argument('-Wzero-as-null-pointer-constant')
conf.set10('HAVE_WARNING_ZERO_AS_NULL_POINTER_CONSTANT', have)
############################################################
efi_arch = {
'aarch64' : 'aa64',
'arm' : 'arm',
'loongarch32' : 'loongarch32',
'loongarch64' : 'loongarch64',
'riscv32' : 'riscv32',
'riscv64' : 'riscv64',
'x86_64' : 'x64',
'x86' : 'ia32',
}.get(host_machine.cpu_family(), '')
pymod = import('python')
pyelftools = pymod.find_installation('python3',
required : true,
modules : ['elftools'])
conf.set_quoted('EFI_MACHINE_TYPE_NAME', efi_arch)
efi_arch_alt = ''
efi_cpu_family_alt = ''
if efi_arch == 'x64' and cc.links('''
#include <limits.h>
int main(int argc, char *argv[]) {
return __builtin_popcount(argc - CHAR_MAX);
}''', args : ['-m32', '-march=i686'], name : '32bit build possible')
efi_arch_alt = 'ia32'
efi_cpu_family_alt = 'x86'
endif
############################################################
check_efi_alignment_py = find_program('tools/check-efi-alignment.py')
elf2efi_py = find_program('tools/elf2efi.py')
version_tag = meson.project_version()
conf.set_quoted('VERSION_TAG', version_tag)
version_h = configure_file(
input : 'version.h.in',
output : 'version.h',
configuration: conf)
# A list of boot stubs. Required for testing of ukify.
boot_stubs = []
build_dir_include = include_directories('.')
subdir('fundamental')
subdir('efi')