1# SPDX-License-Identifier: LGPL-2.1-or-later
2
3# Those files right now are not supported by the grammar. Also,
4# they are very long but quite repetitive and the parser is not very fast.
5# So we don't "test" them.
6hwdb_files_notest = files(
7        'README',
8        '20-dmi-id.hwdb',
9        '20-pci-vendor-model.hwdb',
10        '20-pci-classes.hwdb',
11        '20-usb-vendor-model.hwdb',
12        '20-usb-classes.hwdb',
13        '20-sdio-vendor-model.hwdb',
14        '20-sdio-classes.hwdb',
15        '20-bluetooth-vendor-product.hwdb',
16        '20-acpi-vendor.hwdb',
17        '20-OUI.hwdb',
18        '20-net-ifname.hwdb',
19        '20-vmbus-class.hwdb')
20
21hwdb_files_test = files(
22        '60-autosuspend.hwdb',
23        '60-autosuspend-fingerprint-reader.hwdb',
24        '60-evdev.hwdb',
25        '60-input-id.hwdb',
26        '60-keyboard.hwdb',
27        '60-seat.hwdb',
28        '60-sensor.hwdb',
29        '70-analyzers.hwdb',
30        '70-av-production.hwdb',
31        '70-cameras.hwdb',
32        '70-joystick.hwdb',
33        '70-mouse.hwdb',
34        '70-pda.hwdb',
35        '70-pointingstick.hwdb',
36        '70-touchpad.hwdb',
37        '80-ieee1394-unit-function.hwdb')
38
39if conf.get('ENABLE_HWDB') == 1
40        auto_suspend_rules = custom_target(
41                '60-autosuspend-chromiumos.hwdb',
42                output : '60-autosuspend-chromiumos.hwdb',
43                command : make_autosuspend_rules_py,
44                capture : true,
45                install : true,
46                install_dir: udevhwdbdir)
47
48        install_data(hwdb_files_notest,
49                     hwdb_files_test,
50                     install_dir : udevhwdbdir)
51
52        if install_sysconfdir
53                meson.add_install_script('sh', '-c',
54                                         mkdir_p.format(sysconfdir / 'udev/hwdb.d'))
55
56                meson.add_install_script('sh', '-c',
57                                         'test -n "$DESTDIR" || @0@/systemd-hwdb update'.format(rootbindir))
58        endif
59
60        if want_tests != 'false'
61                parse_hwdb_py = find_program('parse_hwdb.py')
62                test('parse-hwdb',
63                     parse_hwdb_py,
64                     suite : 'dist-check',
65                     args : [hwdb_files_test,
66                             auto_suspend_rules],
67                     timeout : 90)
68        endif
69endif
70
71############################################################
72
73run_target(
74        'update-hwdb',
75        command : [update_hwdb_sh, meson.current_source_dir()])
76
77run_target(
78        'update-hwdb-autosuspend',
79        command : [update_hwdb_autosuspend_sh, project_source_root])
80