-
Notifications
You must be signed in to change notification settings - Fork 203
/
meson.build
158 lines (138 loc) · 4.01 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (c) 2024 Greg Kroah-Hartman <gregkh@linuxfoundation.org>
project(
'usbutils',
'c',
version: '018',
license: ['GPL-2.0-only', 'GPL-2.0-or-later','GPL-2.0-or-later'],
meson_version : '>=0.60.0',
default_options : ['c_std=gnu99', 'warning_level=2', 'prefix=/usr']
)
pkg = import('pkgconfig')
# Compiler stuff
cc = meson.get_compiler('c')
add_project_arguments(
cc.get_supported_arguments([
'-Wbad-function-cast',
# should be removed and the code fixed
'-Wno-cast-align',
'-Wchar-subscripts',
'-Wempty-body',
'-Wformat',
'-Wformat=2',
'-Wformat-nonliteral',
'-Wformat-security',
'-Wformat-y2k',
'-Winit-self',
'-Winline',
'-Wint-conversion',
'-Wmissing-declarations',
'-Wmissing-format-attribute',
'-Wmissing-include-dirs',
'-Wmissing-prototypes',
'-Wmissing-noreturn',
'-Wnested-externs',
'-Wold-style-definition',
'-Wold-style-declaration',
'-Wpointer-arith',
'-Wredundant-decls',
'-Wshadow',
'-Wsign-compare',
#'-Wsuggest-attribute=const',
#'-Wsuggest-attribute=noreturn',
#'-Wsuggest-attribute=malloc',
#'-Wsuggest-attribute=returns_nonnull',
'-Wstrict-prototypes',
'-Wswitch',
'-Wtype-limits',
'-Wundef',
'-Wuninitialized',
'-Wunused',
'-Wunused-variable',
'-Wvla',
'-Wwrite-strings',
'-fdiagnostics-color=auto',
# warnings disabled on purpose
'-Wno-unused-parameter',
'-Wno-unused-function',
'-Wno-deprecated-declarations',
]),
language: 'c',
)
# Configuration information
config = configuration_data()
config.set_quoted('PACKAGE_NAME', meson.project_name())
config.set_quoted('VERSION', meson.project_version())
config_h = configure_file(output: 'config.h', configuration: config)
add_project_arguments('-include', 'config.h', language : 'c')
#####################
# man page generation
#####################
install_man(['man/lsusb.8', 'man/lsusb.py.1', 'man/usb-devices.1', 'man/usbhid-dump.8'])
##########################
# lsusb build instructions
##########################
lsusb_sources = [
'desc-defs.c',
'desc-defs.h',
'desc-dump.c',
'desc-dump.h',
'lsusb-t.c',
'lsusb.c',
'lsusb.h',
'names.c',
'names.h',
'sysfs.c',
'sysfs.h',
'usb-spec.h',
'usbmisc.c',
'usbmisc.h',
'ccan/check_type/check_type.h',
'ccan/config.h',
'ccan/container_of/container_of.h',
'ccan/str/str_debug.h',
'ccan/str/str.h',
'ccan/list/list.h',
]
libudev = dependency('libudev', version: '>= 196')
libusb = dependency('libusb-1.0', version: '>= 1.0.22')
executable('lsusb', lsusb_sources, dependencies: [libusb, libudev], install: true)
################################
# usbhid-dump build instructions
################################
usbhid_sources = [
'usbhid-dump/dev.c',
'usbhid-dump/dev.h',
'usbhid-dump/dev_list.c',
'usbhid-dump/dev_list.h',
'usbhid-dump/iface.c',
'usbhid-dump/iface.h',
'usbhid-dump/iface_list.c',
'usbhid-dump/iface_list.h',
'usbhid-dump/misc.h',
'usbhid-dump/usbhid-dump.c',
]
executable('usbhid-dump', usbhid_sources, dependencies: libusb, install: true)
##############################
# usbreset build instructions
##############################
usbreset_sources = [
'usbreset.c'
]
# By default, usbreset does not get installed as it could cause problems, it's
# in the repo for those that wish to try it out.
executable('usbreset', usbreset_sources, install: false)
################################
# usb-devices build instructions
################################
usb_devices_sources = [
'usb-devices'
]
# Hack as this is not something to compile, but rather we can just copy it.
install_data(usb_devices_sources, install_dir: get_option('bindir'), install_mode: 'rwxr-xr-x')
#############################
# lsusb.py build instructions
#############################
# Also a hack, like was done for usb-devices, as this is "just" a script and
# doesn't need to be compiled.
install_data(files('lsusb.py'), install_dir: get_option('bindir'), install_mode: 'rwxr-xr-x')