forked from containers/toolbox
-
Notifications
You must be signed in to change notification settings - Fork 4
/
meson.build
130 lines (119 loc) · 3.38 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
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
go_build_wrapper_file = files('go-build-wrapper')
go_build_wrapper_program = find_program('go-build-wrapper')
meson_generate_completions_program = find_program('meson_generate_completions.py')
meson_go_fmt_program = find_program('meson_go_fmt.py')
sources = files(
'toolbox.go',
'cmd/completion.go',
'cmd/create.go',
'cmd/enter.go',
'cmd/help.go',
'cmd/initContainer.go',
'cmd/list.go',
'cmd/rm.go',
'cmd/rmi.go',
'cmd/root.go',
'cmd/rootDefault.go',
'cmd/rootMigrationPath.go',
'cmd/root_test.go',
'cmd/run.go',
'cmd/utils.go',
'pkg/podman/podman.go',
'pkg/shell/shell.go',
'pkg/shell/shell_test.go',
'pkg/skopeo/skopeo.go',
'pkg/utils/libsubid-wrappers.c',
'pkg/utils/errors.go',
'pkg/utils/utils.go',
'pkg/utils/utils_cgo.go',
'pkg/utils/utils_test.go',
'pkg/version/version.go',
)
cpu_family = host_machine.cpu_family()
endian = host_machine.endian()
dynamic_linker = ''
if cpu_family == 'aarch64' and endian == 'little'
dynamic_linker = '/lib/ld-linux-aarch64.so.1'
elif cpu_family == 'arm' and endian == 'little'
dynamic_linker = '/lib/ld-linux-armhf.so.3'
elif cpu_family == 'ppc64' and endian == 'little'
dynamic_linker = '/lib64/ld64.so.2'
elif cpu_family == 's390x' and endian == 'big'
dynamic_linker = '/lib/ld64.so.1'
elif cpu_family == 'x86' and endian == 'little'
dynamic_linker = '/lib/ld-linux.so.2'
elif cpu_family == 'x86_64' and endian == 'little'
dynamic_linker = '/lib64/ld-linux-x86-64.so.2'
elif cpu_family == 'riscv64' and endian == 'little'
dynamic_linker = '/lib/ld-linux-riscv64-lp64d.so.1'
else
host_machine_description = cpu_family + ' (' + endian + ' endian)'
error('Please specify dynamic linker for:', host_machine_description)
endif
message('Host machine dynamic linker:', dynamic_linker)
toolbox_go = custom_target(
'toolbox',
command: [
go_build_wrapper_program,
meson.current_source_dir(),
meson.project_build_root(),
'@OUTPUT@',
meson.project_version(),
cc.cmd_array().get(-1),
dynamic_linker,
migration_path_for_coreos_toolbox.to_string(),
],
input: sources,
install: true,
install_dir: get_option('bindir'),
output: 'toolbox',
)
if bashcompletionsdir != ''
custom_target(
'bash-completion',
capture: true,
command: [
meson_generate_completions_program,
meson.current_source_dir(),
'bash',
],
depends: [toolbox_go],
install: true,
install_dir: bashcompletionsdir,
output: 'toolbox.bash',
)
endif
if fishcompletionsdir != ''
custom_target(
'fish-completion',
capture: true,
command: [
meson_generate_completions_program,
meson.current_source_dir(),
'fish',
],
depends: [toolbox_go],
install: true,
install_dir: fishcompletionsdir,
output: 'toolbox.fish',
)
endif
custom_target(
'zsh-completion',
capture: true,
command: [
meson_generate_completions_program,
meson.current_source_dir(),
'zsh',
],
depends: [toolbox_go],
install: true,
install_dir: zshcompletionsdir,
output: '_toolbox',
)
if shellcheck.found()
test('shellcheck src/go-build-wrapper', shellcheck, args: [go_build_wrapper_file])
endif
test('go fmt', meson_go_fmt_program, args: [meson.current_source_dir()])
test('go vet', go, args: ['vet', '-c', '3', './...'], workdir: meson.current_source_dir())
test('go test', go, args: ['test', '-vet', 'off', './...'], workdir: meson.current_source_dir())