blob: 59737de545722e84323131d2acfcc82bd02cdb51 [file] [log] [blame]
Richard Hughescb973682018-12-19 11:44:22 +00001project('flashromutils', 'c',
Nikolai Artemiev47cb6fc2022-07-22 09:58:14 +10002 version : run_command('util/getversion.sh', '--version', check : true).stdout().strip(),
Nico Huberb417c0c2019-09-24 22:12:40 +02003 license : 'GPL-2.0',
Thomas Heijligen3ecf0b62022-08-18 12:16:29 +02004 meson_version : '>=0.53.0',
Anastasia Klimchuk3c508432022-04-13 15:15:24 +10005 default_options : [
6 'warning_level=2',
7 'c_std=c99',
Anastasia Klimchukc676be92022-04-26 14:53:18 +10008 'werror=true',
Anastasia Klimchuk3c508432022-04-13 15:15:24 +10009 'optimization=s',
Nikolai Artemiev47cb6fc2022-07-22 09:58:14 +100010 'debug=false',
11 ],
Richard Hughescb973682018-12-19 11:44:22 +000012)
13
14# libtool versioning
15lt_current = '1'
16lt_revision = '0'
17lt_age = '0'
18lt_version = '@0@.@1@.@2@'.format(lt_current, lt_age, lt_revision)
19
Jacob Garber4a84ec22019-07-25 19:12:31 -060020# hide/enable some warnings
Richard Hughescb973682018-12-19 11:44:22 +000021warning_flags = [
Anastasia Klimchukcde70112021-10-25 13:20:26 +110022 '-Wshadow',
23 '-Wmissing-prototypes',
Jacob Garber4a84ec22019-07-25 19:12:31 -060024 '-Wwrite-strings',
Richard Hughescb973682018-12-19 11:44:22 +000025 '-Wno-unused-parameter',
Richard Hughescb973682018-12-19 11:44:22 +000026 '-Wno-address-of-packed-member',
27 '-Wno-enum-conversion',
Richard Hughescb973682018-12-19 11:44:22 +000028 '-Wno-missing-braces',
29]
30
31conf = configuration_data()
32
33cc = meson.get_compiler('c')
34add_project_arguments(cc.get_supported_arguments(warning_flags), language : 'c')
35add_project_arguments('-D_DEFAULT_SOURCE', language : 'c')
Rosen Penev566193f2020-07-18 12:50:16 -070036add_project_arguments('-D_POSIX_C_SOURCE=200809L', language : 'c') # required for fileno, nanosleep, and strndup
Richard Hughescb973682018-12-19 11:44:22 +000037add_project_arguments('-D_BSD_SOURCE', language : 'c') # required for glibc < v2.19
Thomas Heijligen3ecf0b62022-08-18 12:16:29 +020038add_project_arguments('-D__BSD_VISIBLE', language : 'c') # required for u_char, u_int, u_long on FreeBSD
39add_project_arguments('-D__XSI_VISIBLE', language : 'c') # required for gettimeofday() on FreeBSD
40add_project_arguments('-D_NETBSD_SOURCE', language : 'c') # required for indirect include of strings.h on NetBSD
41add_project_arguments('-D_DARWIN_C_SOURCE', language : 'c') # required for indirect include of strings.h on MacOS
Richard Hughescb973682018-12-19 11:44:22 +000042add_project_arguments('-DFLASHROM_VERSION="' + meson.project_version() + '"', language : 'c')
43
44# get defaults from configure
Thomas Heijligenb975da12022-08-13 12:10:05 +020045config_print_wiki = get_option('classic_cli_print_wiki')
Thomas Heijligen84e9c912021-06-01 16:22:14 +020046config_default_programmer_name = get_option('default_programmer_name')
47config_default_programmer_args = get_option('default_programmer_args')
Richard Hughescb973682018-12-19 11:44:22 +000048
49cargs = []
50deps = []
Thomas Heijligen51208f32022-04-28 11:07:29 +020051srcs = files(
52 '82802ab.c',
53 'at45db.c',
54 'bitbang_spi.c',
55 'edi.c',
56 'en29lv640b.c',
57 'flashchips.c',
58 'flashrom.c',
59 'fmap.c',
60 'helpers.c',
Edward O'Callaghan4c76c732022-08-12 11:03:00 +100061 'helpers_fileio.c',
Thomas Heijligen51208f32022-04-28 11:07:29 +020062 'ich_descriptors.c',
63 'jedec.c',
64 'layout.c',
65 'libflashrom.c',
66 'opaque.c',
Edward O'Callaghan63f6a372022-08-12 12:56:43 +100067 'parallel.c',
Thomas Heijligen51208f32022-04-28 11:07:29 +020068 'print.c',
69 'programmer.c',
70 'programmer_table.c',
71 'sfdp.c',
72 'spi25.c',
73 'spi25_statusreg.c',
74 'spi95.c',
75 'spi.c',
76 'sst28sf040.c',
77 'sst49lfxxxc.c',
78 'sst_fwhub.c',
79 'stm50.c',
80 'udelay.c',
81 'w29ee011.c',
82 'w39.c',
83 'writeprotect.c',
84 'writeprotect_ranges.c',
85)
Richard Hughescb973682018-12-19 11:44:22 +000086
Richard Hughescb973682018-12-19 11:44:22 +000087# check for required symbols
88if cc.has_function('clock_gettime')
89 add_project_arguments('-DHAVE_CLOCK_GETTIME=1', language : 'c')
90endif
91if cc.has_function('strnlen')
92 add_project_arguments('-DHAVE_STRNLEN=1', language : 'c')
93endif
94if cc.check_header('sys/utsname.h')
95 add_project_arguments('-DHAVE_UTSNAME=1', language : 'c')
96endif
Thomas Heijligenc02b1a92022-04-25 14:54:10 +020097if host_machine.system() in ['cygwin', 'windows']
98 add_project_arguments('-DIS_WINDOWS=1', language : 'c')
99else
100 add_project_arguments('-DIS_WINDOWS=0', language : 'c')
101endif
Richard Hughescb973682018-12-19 11:44:22 +0000102
Thomas Heijligen3ecf0b62022-08-18 12:16:29 +0200103systems_hwaccess = [ 'linux', 'openbsd', 'freebsd', 'dragonfly', 'netbsd' ]
104systems_serial = [ 'linux', 'openbsd', 'freebsd', 'dragonfly', 'netbsd', 'darwin' ]
Richard Hughescb973682018-12-19 11:44:22 +0000105
Thomas Heijligen3ecf0b62022-08-18 12:16:29 +0200106cpus_port_io = [ 'x86', 'x86_64' ]
Peter Marheine306c8b72022-01-21 02:07:30 +0000107
Thomas Heijligen3ecf0b62022-08-18 12:16:29 +0200108group_ftdi = get_option('programmer').contains('group_ftdi')
109group_pci = get_option('programmer').contains('group_pci')
110group_usb = get_option('programmer').contains('group_usb')
111group_i2c = get_option('programmer').contains('group_i2c')
112group_serial = get_option('programmer').contains('group_serial')
113group_jlink = get_option('programmer').contains('group_jlink')
114group_internal = get_option('programmer').contains('group_internal')
115group_external = get_option('programmer').contains('group_external')
Peter Marheine306c8b72022-01-21 02:07:30 +0000116
Thomas Heijligen3ecf0b62022-08-18 12:16:29 +0200117libpci = dependency('libpci', required : group_pci, static : (host_machine.system() == 'openbsd' ? true : false)) # On openbsd a static version of libpci is needed to get also -libz
118libusb1 = dependency('libusb-1.0', required : group_usb)
119libftdi1 = dependency('libftdi1', required : group_ftdi)
120libjaylink = dependency('libjaylink', required : group_jlink)
Richard Hughescb973682018-12-19 11:44:22 +0000121
Thomas Heijligen3ecf0b62022-08-18 12:16:29 +0200122subdir('platform')
Richard Hughescb973682018-12-19 11:44:22 +0000123
Thomas Heijligen3ecf0b62022-08-18 12:16:29 +0200124if systems_hwaccess.contains(host_machine.system())
Thomas Heijligen4bd966c2022-05-16 10:56:55 +0200125 srcs += files('hwaccess_physmap.c')
Thomas Heijligen3ecf0b62022-08-18 12:16:29 +0200126 if ['x86', 'x86_64'].contains(host_machine.cpu_family())
127 srcs += files('hwaccess_x86_msr.c', 'hwaccess_x86_io.c')
Thomas Heijligen140c1262021-09-27 15:12:26 +0200128 endif
Richard Hughescb973682018-12-19 11:44:22 +0000129endif
130
Thomas Heijligen3ecf0b62022-08-18 12:16:29 +0200131# Pseudo dependencies
132linux_headers = \
133 cc.has_header('linux/i2c.h') and \
134 cc.has_header('linux/i2c-dev.h') and \
135 cc.has_header('mtd/mtd-user.h') and \
136 cc.has_header('linux/spi/spidev.h') ? declare_dependency() : dependency('', required : false)
Thomas Heijligenb975da12022-08-13 12:10:05 +0200137
Thomas Heijligen3ecf0b62022-08-18 12:16:29 +0200138# '<programmer_name>' : {
139# 'system' : list[string], # default: ['all']
140# 'cpu_families : list[string], # default: ['all']
141# 'deps' : list[dep], # default: []
142# 'groups : list[boolean], # default: []
143# 'srcs' : list[file], # default: []
144# 'flags' : list[string], # default: []
145# 'default' : boolean, # default: true
146# 'active' : boolean, # added on runtime
147# }
148programmer = {
149 'atahpt' : {
150 'systems' : systems_hwaccess,
151 'cpu_families' : cpus_port_io,
152 'deps' : [ libpci ],
153 'groups' : [ group_pci, group_internal ],
154 'srcs' : files('atahpt.c', 'pcidev.c'),
155 'flags' : [ '-DCONFIG_ATAHPT=1' ],
156 'default' : false, # not yet working
157 },
158 'atapromise' : {
159 'systems' : systems_hwaccess,
160 'cpu_families' : cpus_port_io,
161 'deps' : [ libpci ],
162 'groups' : [ group_pci, group_internal ],
163 'srcs' : files('atapromise.c', 'pcidev.c'),
164 'flags' : [ '-DCONFIG_ATAPROMISE=1' ],
165 'default' : false,
166 },
167 'atavia' : {
168 'systems' : systems_hwaccess,
169 'deps' : [ libpci ],
170 'groups' : [ group_pci, group_internal ],
171 'srcs' : files('atavia.c', 'pcidev.c'),
172 'flags' : [ '-DCONFIG_ATAVIA=1' ],
173 },
174 'buspirate_spi' : {
175 'systems' : systems_serial,
176 'groups' : [ group_serial, group_external ],
177 'srcs' : files('buspirate_spi.c', 'serial.c', (host_machine.system() == 'linux' ? 'custom_baud_linux.c' : 'custom_baud.c')),
178 'flags' : [ '-DCONFIG_BUSPIRATE_SPI=1' ],
179 },
180 'ch341a_spi' : {
181 'deps' : [ libusb1 ],
182 'groups' : [ group_usb, group_external ],
183 'srcs' : files('ch341a_spi.c'),
184 'flags' : [ '-DCONFIG_CH341A_SPI=1' ],
185 },
186 'dediprog' : {
187 'deps' : [ libusb1 ],
188 'groups' : [ group_usb, group_external ],
189 'srcs' : files('dediprog.c', 'usbdev.c'),
190 'flags' : [ '-DCONFIG_DEDIPROG=1' ],
191 },
192 'developerbox_spi' : {
193 'deps' : [ libusb1 ],
194 'groups' : [ group_usb, group_external ],
195 'srcs' : files('developerbox_spi.c', 'usbdev.c'),
196 'flags' : [ '-DCONFIG_DEVELOPERBOX_SPI=1' ],
197 },
198 'digilent_spi' : {
199 'deps' : [ libusb1 ],
200 'groups' : [ group_usb, group_external ],
201 'srcs' : files('digilent_spi.c'),
202 'flags' : [ '-DCONFIG_DIGILENT_SPI=1' ],
203 },
204 'dirtyjtag_spi' : {
205 'deps' : [ libusb1 ],
206 'groups' : [ group_usb, group_external ],
207 'srcs' : files('dirtyjtag_spi.c'),
208 'flags' : [ '-DCONFIG_DIRTYJTAG_SPI=1' ],
209 },
210 'drkaiser' : {
211 'systems' : systems_hwaccess,
212 'deps' : [ libpci ],
213 'groups' : [ group_pci, group_internal ],
214 'srcs' : files('drkaiser.c', 'pcidev.c'),
215 'flags' : [ '-DCONFIG_DRKAISER=1' ],
216 },
217 'dummy' : {
218 'srcs' : files('dummyflasher.c'),
219 'flags' : [ '-DCONFIG_DUMMY=1' ],
220 },
221 'ft2232_spi' : {
222 'deps' : [ libftdi1 ],
223 'groups' : [ group_ftdi, group_external ],
224 'srcs' : files('ft2232_spi.c' ),
225 'flags' : [ '-DCONFIG_FT2232_SPI=1' ],
226 },
227 'gfxnvidia' : {
228 'systems' : systems_hwaccess,
229 'deps' : [ libpci ],
230 'groups' : [ group_pci, group_internal ],
231 'srcs' : files('gfxnvidia.c', 'pcidev.c'),
232 'flags' : [ '-DCONFIG_GFXNVIDIA=1' ],
233 },
234 'internal' : {
235 'systems' : systems_hwaccess + ['linux'],
236 'cpu_families' : (host_machine.system() == 'linux' ? [host_machine.cpu_family()] : ['x86', 'x86_64']),
237 'deps' : [ libpci ],
238 'groups' : [ group_internal ],
239 'srcs' : (host_machine.cpu_family() in ['x86', 'x86_64'] ? files(
240 'processor_enable.c',
241 'chipset_enable.c',
242 'board_enable.c',
243 'cbtable.c',
244 'internal.c',
245 'it87spi.c',
246 'sb600spi.c',
247 'amd_imc.c',
248 'wbsio_spi.c',
249 'mcp6x_spi.c',
250 'ichspi.c',
251 'dmi.c',
252 'pcidev.c',
253 'known_boards.c',
254 ) : files(
255 'board_enable.c',
256 'cbtable.c',
257 'chipset_enable.c',
258 'internal.c',
259 'processor_enable.c',
260 'pcidev.c',
261 'known_boards.c',
262 )),
263 'flags' : [
264 '-DCONFIG_INTERNAL=1',
265 '-DCONFIG_INTERNAL_DMI=' + (get_option('use_internal_dmi') ? '1' : '0'),
266 ]
267 },
268 'it8212' : {
269 'systems' : systems_hwaccess,
270 'deps' : [ libpci ],
271 'groups' : [ group_pci, group_internal ],
272 'srcs' : files('it8212.c', 'pcidev.c'),
273 'flags' : [ '-DCONFIG_IT8212=1' ],
274 },
275 'jlink_spi' : {
276 'deps' : [ libjaylink ],
277 'groups' : [ group_jlink, group_external ],
278 'srcs' : files('jlink_spi.c'),
279 'flags' : [ '-DCONFIG_JLINK_SPI=1' ],
280 'default' : false,
281 },
282 'linux_mtd' : {
283 'systems' : [ 'linux' ],
284 'deps' : [ linux_headers ],
285 'groups' : [ group_internal ],
286 'srcs' : files('linux_mtd.c'),
287 'flags' : [ '-DCONFIG_LINUX_MTD=1' ],
288 },
289 'linux_spi' : {
290 'systems' : [ 'linux' ],
291 'deps' : [ linux_headers ],
292 # internal / external?
293 'srcs' : files('linux_spi.c'),
294 'flags' : [ '-DCONFIG_LINUX_SPI=1' ],
295 },
296 'mstarddc_spi' : {
297 'systems' : [ 'linux' ],
298 'deps' : [ linux_headers ],
299 'groups' : [ group_i2c ],
300 'srcs' : files('mstarddc_spi.c'),
301 'flags' : [ '-DCONFIG_MSTARDDC_SPI=1' ],
302 'default' : false
303 },
304 'nic3com' : {
305 'systems' : systems_hwaccess,
306 'cpu_families' : cpus_port_io,
307 'deps' : [ libpci ],
308 'groups' : [ group_pci, group_internal ],
309 'srcs' : files('nic3com.c', 'pcidev.c'),
310 'flags' : [ '-DCONFIG_NIC3COM=1' ],
311 },
312 'nicintel' : {
313 'systems' : systems_hwaccess,
314 'deps' : [ libpci ],
315 'groups' : [ group_pci, group_internal ],
316 'srcs' : files('nicintel.c', 'pcidev.c'),
317 'flags' : [ '-DCONFIG_NICINTEL=1' ],
318 },
319 'nicintel_eeprom' : {
320 'systems' : systems_hwaccess,
321 'deps' : [ libpci ],
322 'groups' : [ group_pci, group_internal ],
323 'srcs' : files('nicintel_eeprom.c', 'pcidev.c'),
324 'flags' : [ '-DCONFIG_NICINTEL_EEPROM=1' ],
325 },
326 'nicintel_spi' : {
327 'systems' : systems_hwaccess,
328 'deps' : [ libpci ],
329 'groups' : [ group_pci, group_internal ],
330 'srcs' : files('nicintel_spi.c', 'pcidev.c'),
331 'flags' : [ '-DCONFIG_NICINTEL_SPI=1' ],
332 },
333 'nicnatsemi' : {
334 'systems' : systems_hwaccess,
335 'cpu_families' : cpus_port_io,
336 'deps' : [ libpci ],
337 'groups' : [ group_pci, group_internal ],
338 'srcs' : files('nicnatsemi.c', 'pcidev.c'),
339 'flags' : [ '-DCONFIG_NICNATSEMI=1' ],
340 'default' : false, # not complete nor tested
341 },
342 'nicrealtek' : {
343 'systems' : systems_hwaccess,
344 'cpu_families' : cpus_port_io,
345 'deps' : [ libpci ],
346 'groups' : [ group_pci, group_internal ],
347 'srcs' : files('nicrealtek.c', 'pcidev.c'),
348 'flags' : [ '-DCONFIG_NICREALTEK=1' ],
349 },
350 'ogp_spi' : {
351 'systems' : systems_hwaccess,
352 'deps' : [ libpci ],
353 'groups' : [ group_pci, group_internal ],
354 'srcs' : files('ogp_spi.c', 'pcidev.c'),
355 'flags' : [ '-DCONFIG_OGP_SPI=1' ],
356 },
357 'pickit2_spi' : {
358 'deps' : [ libusb1 ],
359 'groups' : [ group_usb, group_external ],
360 'srcs' : files('pickit2_spi.c'),
361 'flags' : [ '-DCONFIG_PICKIT2_SPI=1' ],
362 },
363 'pony_spi' : {
364 'systems' : systems_serial,
365 'groups' : [ group_serial, group_external ],
366 'srcs' : files('pony_spi.c', 'serial.c', (host_machine.system() == 'linux' ? 'custom_baud_linux.c' : 'custom_baud.c')),
367 'flags' : [ '-DCONFIG_PONY_SPI=1' ],
368 },
369 'rayer_spi' : {
370 'systems' : systems_hwaccess,
371 'cpu_families' : cpus_port_io,
372 'groups' : [ group_internal ],
373 'srcs' : files('rayer_spi.c'),
374 'flags' : [ '-DCONFIG_RAYER_SPI=1' ],
375 },
376 'satamv' : {
377 'systems' : systems_hwaccess,
378 'cpu_families' : cpus_port_io,
379 'deps' : [ libpci ],
380 'groups' : [ group_pci, group_internal ],
381 'srcs' : files('satamv.c', 'pcidev.c'),
382 'flags' : ['-DCONFIG_SATAMV=1'],
383 },
384 'satasii' : {
385 'systems' : systems_hwaccess,
386 'deps' : [ libpci ],
387 'groups' : [ group_pci, group_internal ],
388 'srcs' : files('satasii.c', 'pcidev.c'),
389 'flags' : [ '-DCONFIG_SATASII=1' ],
390 },
391 'serprog' : {
392 'systems' : systems_serial,
393 'groups' : [ group_serial, group_external ],
394 'srcs' : files('serprog.c', 'serial.c', (host_machine.system() == 'linux' ? 'custom_baud_linux.c' : 'custom_baud.c')),
395 'flags' : [ '-DCONFIG_SERPROG=1' ],
396 },
397 'stlinkv3_spi' : {
398 'deps' : [ libusb1 ],
399 'groups' : [ group_usb, group_external ],
400 'srcs' : files('stlinkv3_spi.c', 'usbdev.c'),
401 'flags' : [ '-DCONFIG_STLINKV3_SPI=1' ],
402 },
403 'usbblaster_spi' : {
404 'deps' : [ libftdi1 ],
405 'groups' : [ group_ftdi, group_external ],
406 'srcs' : files('usbblaster_spi.c'),
407 'flags' : [ '-DCONFIG_USBBLASTER_SPI=1' ],
408 },
409}
410
411active_programmer_count = 0
412foreach p_name, p_data : programmer
413 p_data += {
414 'systems' : p_data.get('systems', ['all']),
415 'cpu_families' : p_data.get('cpu_families', ['all']),
416 'deps' : p_data.get('deps', []),
417 'groups' : p_data.get('groups', []),
418 'srcs' : p_data.get('srcs', []),
419 'flags' : p_data.get('flags', []),
420 'default' : p_data.get('default', true),
421 }
422
423 active = false
424 deps_found = true
425 not_found_dep = ''
426 not_active_message = ''
427 selected_hard = p_name in get_option('programmer')
428 selected_soft = p_data.get('groups').contains(true) or \
429 'all' in get_option('programmer') or \
430 'auto' in get_option('programmer') and p_data.get('default')
431 available = (p_data.get('systems').contains('all') or p_data.get('systems').contains(host_machine.system())) \
432 and (p_data.get('cpu_families').contains('all') or p_data.get('cpu_families').contains(host_machine.cpu_family()))
433
434 foreach dep : p_data.get('deps')
435 if not dep.found()
436 deps_found = false
437 not_found_dep = dep.name()
438 break
439 endif
440 endforeach
441
442 if selected_hard
443 if not available
444 error(p_name + ' selected but not supported on this platform')
445 elif not deps_found
446 error(p_name + ' selected but dependency ' + not_found_dep +'not found')
447 else
448 active = true
449 endif
450 elif selected_soft
451 if not available
452 not_active_message = 'Not available on platform'
453 elif not deps_found
454 not_active_message = 'dependency ' + not_found_dep + ' not found'
455 else
456 active = true
457 endif
458 else
459 not_active_message = 'not selected'
460 endif
461
462 p_data += {
463 'active' : active,
464 'summary' : not_active_message,
465 }
466 programmer += {p_name : p_data}
467 if active
468 active_programmer_count += 1
469 endif
470endforeach
471
472if active_programmer_count == 0
473 error('At least one programmer must be selected')
474endif
475
476# add srcs, cargs & deps from active programmer to global srcs, cargs & deps
477foreach p_name, p_data : programmer
478 if p_data.get('active')
479 srcs += p_data.get('srcs')
480 cargs += p_data.get('flags')
481 deps += p_data.get('deps')
482 endif
483endforeach
Thomas Heijligenb975da12022-08-13 12:10:05 +0200484
485if config_print_wiki.enabled()
486 if get_option('classic_cli').disabled()
487 error('`classic_cli_print_wiki` can not be enabled without `classic_cli`')
488 else
489 srcs += files('print_wiki.c')
490 cargs += '-DCONFIG_PRINT_WIKI=1'
491 endif
Thomas Heijligen2ae9bf22022-05-03 12:00:14 +0200492endif
493
494if config_default_programmer_name != ''
495 cargs += '-DCONFIG_DEFAULT_PROGRAMMER_NAME=&programmer_' + config_default_programmer_name
496else
497 cargs += '-DCONFIG_DEFAULT_PROGRAMMER_NAME=NULL'
498endif
499
500cargs += '-DCONFIG_DEFAULT_PROGRAMMER_ARGS="' + config_default_programmer_args + '"'
501
Richard Hughescb973682018-12-19 11:44:22 +0000502install_headers([
Thomas Heijligen58015c22022-04-14 13:50:55 +0200503 'include/libflashrom.h',
Richard Hughescb973682018-12-19 11:44:22 +0000504 ],
505)
506
Thomas Heijligen58015c22022-04-14 13:50:55 +0200507include_dir = include_directories('include')
508
Richard Hughescb973682018-12-19 11:44:22 +0000509mapfile = 'libflashrom.map'
Thomas Heijligen3ecf0b62022-08-18 12:16:29 +0200510if host_machine.system() == 'darwin'
511 vflag = ''
512else
513 vflag = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), mapfile)
514endif
Thomas Heijligenf6a273b2022-05-03 12:21:47 +0200515libflashrom = both_libraries(
Richard Hughescb973682018-12-19 11:44:22 +0000516 'flashrom',
517 sources : [
518 srcs,
519 ],
Thomas Heijligen58015c22022-04-14 13:50:55 +0200520 include_directories : include_dir,
Richard Hughescb973682018-12-19 11:44:22 +0000521 soversion : lt_current,
522 version : lt_version,
523 dependencies : [
524 deps,
525 ],
526 c_args : [
527 cargs,
528 ],
529 install : true,
530 link_args : vflag,
531 link_depends : mapfile,
532)
533
Mario Limonciellod954d5d2019-09-24 16:06:57 -0500534version = meson.project_version()
535#strip leading characters
536if version.startswith('v')
537 version = version.split('v')[1]
538endif
539if version.startswith('p')
540 version = version.split('p')[1]
541endif
542
Richard Hughescb973682018-12-19 11:44:22 +0000543pkgg = import('pkgconfig')
544pkgg.generate(
Thomas Heijligenf6a273b2022-05-03 12:21:47 +0200545 libraries : libflashrom,
Mario Limonciellod954d5d2019-09-24 16:06:57 -0500546 version : version,
Mario Limonciello2a8d4392019-10-15 13:32:19 -0500547 name : 'flashrom',
548 filebase : 'flashrom',
549 description : 'library to interact with flashrom',
Richard Hughescb973682018-12-19 11:44:22 +0000550)
551
Richard Hughesdad3a162020-02-17 09:57:01 +0000552conf.set('VERSION', version)
Nikolai Artemiev47cb6fc2022-07-22 09:58:14 +1000553conf.set('MAN_DATE', run_command('util/getversion.sh', '--man-date', check : true).stdout().strip())
Richard Hughesdad3a162020-02-17 09:57:01 +0000554configure_file(
555 input : 'flashrom.8.tmpl',
556 output : 'flashrom.8',
557 configuration : conf,
558 install: true,
Thomas Heijligen454a28c2022-05-03 11:50:16 +0200559 install_dir: join_paths(get_option('mandir'), 'man8'),
Richard Hughesdad3a162020-02-17 09:57:01 +0000560)
561
Thomas Heijligena12e0102022-08-13 12:42:05 +0200562if get_option('classic_cli').auto() or get_option('classic_cli').enabled()
563 executable(
564 'flashrom',
565 files(
566 'cli_classic.c',
567 'cli_common.c',
568 'cli_output.c',
569 ),
570 c_args : cargs,
571 include_directories : include_dir,
572 install : true,
573 install_dir : get_option('sbindir'),
574 link_with : libflashrom.get_static_lib(), # flashrom needs internal symbols of libflashrom
575 )
576endif
Richard Hughescb973682018-12-19 11:44:22 +0000577
Thomas Heijligenb7341b12022-08-13 12:21:44 +0200578if get_option('ich_descriptors_tool').auto() or get_option('ich_descriptors_tool').enabled()
579 subdir('util/ich_descriptors_tool')
580endif
Thomas Heijligen3ecf0b62022-08-18 12:16:29 +0200581
582programmer_names_active = []
583programmer_names_not_active = []
584foreach p_name, p_data : programmer
585 if p_data.get('active')
586 programmer_names_active += p_name
587 else
588 programmer_names_not_active += p_name + ' (' + p_data.get('summary', '') + ')'
589 endif
590endforeach
591
592summary({
593 'active' : [programmer_names_active],
594 'non active' : [programmer_names_not_active],
595}, section : 'Programmer')