systemd/hwdb.d/meson.build

80 lines
2.4 KiB
Meson
Raw Normal View History

# SPDX-License-Identifier: LGPL-2.1-or-later
# Those files right now are not supported by the grammar. Also,
# they are very long but quite repetitive and the parser is not very fast.
# So we don't "test" them.
hwdb_files_notest = files('''
2021-03-26 08:27:11 +00:00
README
2020-12-02 13:55:21 +00:00
20-dmi-id.hwdb
20-pci-vendor-model.hwdb
20-pci-classes.hwdb
20-usb-vendor-model.hwdb
20-usb-classes.hwdb
20-sdio-vendor-model.hwdb
20-sdio-classes.hwdb
20-bluetooth-vendor-product.hwdb
20-acpi-vendor.hwdb
20-OUI.hwdb
20-net-ifname.hwdb
hwdb: add support for VMBUS guids (#8677) This addresses missing feature on #8677 Devices in Hyper-V/Azure exist on vmbus and are identified by UUID value. This patch adds a hardware table so that udevadm can report properties. I chose names are based on the values reported in Window Device Manager (for consistency). The table includes several devices that are not used by Linux but are present and ignored. For example: $ udevadm info -q property /sys/bus/vmbus/devices/58f75a6d-d949-4320-99e1-a2a2576d581c DEVPATH=/devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0004:00/VMBUS:00/58f75a6d-d949-4320-99e1-a2a2576d581c DRIVER=hid_hyperv ID_MODEL_FROM_DATABASE=Microsoft Hyper-V Mouse MODALIAS=vmbus:9eb6a8cf4a5bc04cb98b8ba1a1f3f95a SUBSYSTEM=vmbus USEC_INITIALIZED=11076966 Or with updated kernel the driverctl script. $ driverctl -b vmbus -v list-devices 1eccfd72-4b41-45ef-b73a-4a6e44c12924 hv_balloon (Microsoft Hyper-V Dynamic Memory) 242ff919-07db-4180-9c2e-b86cb68c8c55 hv_util (Microsoft Hyper-V Data Exchange) 2450ee40-33bf-4fbd-892e-9fb06e9214cf hv_util (Microsoft Hyper-V Backup/Restore) 2dd1ce17-079e-403c-b352-a1921ee207ee hv_util (Microsoft Hyper-V Time Sync) 4487b255-b88c-403f-bb51-d1f69cf17f87 (none) (Microsoft Hyper-V Virtual Machine Activation) 53557f8e-057d-425b-9265-01c0fd7e273e hv_netvsc (Microsoft Hyper-V Network Adapter) 5620e0c7-8062-4dce-aeb7-520c7ef76171 hyperv_fb (Microsoft Hyper-V Video) 58f75a6d-d949-4320-99e1-a2a2576d581c hid_hyperv (Microsoft Hyper-V Mouse) 849a776e-8120-4e4a-9a36-7e3d95ac75b3 hv_netvsc (Microsoft Hyper-V Network Adapter) 99221fa0-24ad-11e2-be98-001aa01bbf6e (none) (Microsoft Hyper-V Remote Desktop Control) b2f44faf-2a29-42ba-91b2-f13fd30a2d4b hv_storvsc (Microsoft Hyper-V SCSI Controller) b6650ff7-33bc-4840-8048-e0676786f393 hv_util (Microsoft Hyper-V Guest Shutdown) d34b2567-b9b6-42b9-8778-0a4ec0b955bf hyperv_keyboard (Microsoft Hyper-V Keyboard) f5bee29c-1741-4aad-a4c2-8fdedb46dcc2 (none) (Microsoft Hyper-V Remote Desktop Virtualization) fd149e91-82e0-4a7d-afa6-2a4166cbd7c0 hv_util (Microsoft Hyper-V Heartbeat)
2018-04-09 20:25:08 +00:00
20-vmbus-class.hwdb
'''.split())
hwdb_files_test = files('''
60-autosuspend.hwdb
60-autosuspend-fingerprint-reader.hwdb
60-evdev.hwdb
60-input-id.hwdb
60-keyboard.hwdb
60-seat.hwdb
60-sensor.hwdb
70-analyzers.hwdb
70-cameras.hwdb
70-joystick.hwdb
70-mouse.hwdb
70-pda.hwdb
70-pointingstick.hwdb
70-touchpad.hwdb
hwdb: add hardware database for unit of IEEE 1394 Current udev rules configures group owner of firewire character device to video group, corresponding to nodes in IEEE 1394 in below cases: 1.the node with any unit for any minor version of IIDC version 1 specification defined by 1394 Trading Association 2.the node with any unit for specification defined by Point Grey Research 3.the node with any unit for AV/C device v1.0 defined by 1394 Trading Association 4.the node with any unit for vendor-unique protocol defined by 1394 Trading Association Nevertheless, case 3 and 4 can cover the node with any unit for audio function as well. In the cases, it's convenient to assign audio group. Additionally, some nodes are known to have layout different from the specification defined by 1394 Trading Association. In the case, it's required to add rules specific to them. Furthermore, some nodes have no fields for vendor name and model name in configuration ROM. In the case, it's required to add entries to hardware database for users convenience. For the above reasons, this commit adds rules to use information in hardware database for known units in IEEE 1394. One database entry corresponds to one unit. Two types of key are used to match the unit; customized key from node context, kernel modalias of unit context. The entry has the type of function, at least. Supplementally, it has vendor and model names. For your information, below statements with Python pyparsing module are expected to parse all of the custom key and module alias in the list: ``` subsystem_prefix = pp.Literal('ieee1394:').suppress() hex_to_int = lambda a: int(a[0], 16) node_prefix = pp.Literal('node:').suppress() prefixed_lower_hex = pp.Combine(pp.Literal('0x') + pp.Word(pp.srange('[a-z0-9]'), exact=6)).setParseAction(hex_to_int) ven_in_node = pp.dictOf(pp.Literal('ven'), prefixed_lower_hex) mo_in_node = pp.dictOf(pp.Literal('mo'), prefixed_lower_hex) unit_in_node = pp.Group(prefixed_lower_hex + pp.Literal(':').suppress() + prefixed_lower_hex) units_in_node = pp.Group(pp.Literal('units') + pp.ZeroOrMore(pp.Literal('*')).suppress() + unit_in_node + pp.ZeroOrMore(pp.Literal('*')).suppress()) node_parser = subsystem_prefix + node_prefix + ven_in_node + pp.Optional(mo_in_node) + units_in_node higher_hex = pp.Word(pp.srange('[A-Z0-9]'), exact=8).setParseAction(hex_to_int) ven_in_unit = pp.dictOf(pp.Literal('ven'), higher_hex) mo_literal_in_unit = pp.dictOf(pp.Literal('mo'), higher_hex) mo_in_unit = pp.dictOf(pp.Literal('mo'), higher_hex ^ pp.Literal('*')) sp_in_unit = pp.dictOf(pp.Literal('sp'), higher_hex) ver_in_unit = pp.dictOf(pp.Literal('ver'), higher_hex) unit_parser = subsystem_prefix + ven_in_unit + mo_in_unit + sp_in_unit + ver_in_unit key_parser = node_parser ^ unit_parser ``` Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2021-04-07 02:49:22 +00:00
80-ieee1394-unit-function.hwdb
meson: build systemd using meson It's crucial that we can build systemd using VS2010! ... er, wait, no, that's not the official reason. We need to shed old systems by requring python 3! Oh, no, it's something else. Maybe we need to throw out 345 years of knowlege accumulated in autotools? Whatever, this new thing is cool and shiny, let's use it. This is not complete, I'm throwing it out here for your amusement and critique. - rules for sd-boot are missing. Those might be quite complicated. - rules for tests are missing too. Those are probably quite simple and repetitive, but there's lots of them. - it's likely that I didn't get all the conditions right, I only tested "full" compilation where most deps are provided and nothing is disabled. - busname.target and all .busname units are skipped on purpose. Otherwise, installation into $DESTDIR has the same list of files and the autoconf install, except for .la files. It'd be great if people had a careful look at all the library linking options. I added stuff until things compiled, and in the end there's much less linking then in the old system. But it seems that there's still a lot of unnecessary deps. meson has a `shared_module` statement, which sounds like something appropriate for our nss and pam modules. Unfortunately, I couldn't get it to work. For the nss modules, we need an .so version of '2', but `shared_module` disallows the version argument. For the pam module, it also didn't work, I forgot the reason. The handling of .m4 and .in and .m4.in files is rather awkward. It's likely that this could be simplified. If make support is ever dropped, I think it'd make sense to switch to a different templating system so that two different languages and not required, which would make everything simpler yet. v2: - use get_pkgconfig_variable - use sh not bash - use add_project_arguments v3: - drop required:true and fix progs/prog typo v4: - use find_library('bz2') - add TTY_GID definition - define __SANE_USERSPACE_TYPES__ - use join_paths(prefix, ...) is used on all paths to make them all absolute v5: - replace all declare_dependency's with [] - add more conf.get guards around optional components v6: - drop -pipe, -Wall which are the default in meson - use compiler.has_function() and compiler.has_header_symbol instead of the hand-rolled checks. - fix duplication in 'liblibsystemd' library name - use the right .sym file for pam_systemd - rename 'compiler' to 'cc': shorter, and more idiomatic. v7: - use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D - rename prefix to prefixdir, rootprefix to rootprefixdir ("prefix" is too common of a name and too easy to overwrite by mistake) - wrap more stuff with conf.get('ENABLE...') == 1 - use rootprefix=='/' and rootbindir as install_dir, to fix paths under split-usr==true. v8: - use .split() also for src/coredump. Now everything is consistent ;) - add rootlibdir option and use it on the libraries that require it v9: - indentation v10: - fix check for qrencode and libaudit v11: - unify handling of executable paths, provide options for all progs This makes the meson build behave slightly differently than the autoconf-based one, because we always first try to find the executable in the filesystem, and fall back to the default. I think different handling of loadkeys, setfont, and telinit was just a historical accident. In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs. In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin), but in Debian, those directories are not included in the path. C.f. https://github.com/mesonbuild/meson/issues/1576. - call all the options 'xxx-path' for clarity. - sort man/rules/meson.build properly so it's stable
2017-04-05 03:03:47 +00:00
'''.split())
if conf.get('ENABLE_HWDB') == 1
auto_suspend_rules = custom_target(
'60-autosuspend-chromiumos.hwdb',
output : '60-autosuspend-chromiumos.hwdb',
command : make_autosuspend_rules_py,
capture : true,
install : true,
install_dir: udevhwdbdir)
install_data(hwdb_files_notest,
hwdb_files_test,
install_dir : udevhwdbdir)
if install_sysconfdir
meson.add_install_script('sh', '-c',
mkdir_p.format(sysconfdir / 'udev/hwdb.d'))
meson.add_install_script('sh', '-c',
meson: call find_program() once and reuse the variable everywhere Meson 0.58 has gotten quite bad with emitting a message every time a quoted command is used: Program /home/zbyszek/src/systemd-work/tools/meson-make-symlink.sh found: YES (/home/zbyszek/src/systemd-work/tools/meson-make-symlink.sh) Program sh found: YES (/usr/bin/sh) Program sh found: YES (/usr/bin/sh) Program sh found: YES (/usr/bin/sh) Program sh found: YES (/usr/bin/sh) Program sh found: YES (/usr/bin/sh) Program sh found: YES (/usr/bin/sh) Program xsltproc found: YES (/usr/bin/xsltproc) Configuring custom-entities.ent using configuration Message: Skipping bootctl.1 because ENABLE_EFI is false Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Message: Skipping journal-remote.conf.5 because HAVE_MICROHTTPD is false Message: Skipping journal-upload.conf.5 because HAVE_MICROHTTPD is false Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Message: Skipping loader.conf.5 because ENABLE_EFI is false Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) ... Let's suffer one message only for each command. Hopefully we can silence even this when https://github.com/mesonbuild/meson/issues/8642 is resolved.
2021-05-14 12:16:17 +00:00
'test -n "$DESTDIR" || @0@/systemd-hwdb update'.format(rootbindir))
endif
2017-04-15 04:40:59 +00:00
if want_tests != 'false'
parse_hwdb_py = find_program('parse_hwdb.py')
test('parse-hwdb',
parse_hwdb_py,
args : [hwdb_files_test,
auto_suspend_rules],
timeout : 90)
endif
endif
############################################################
run_target(
'update-hwdb',
command : [update_hwdb_sh, meson.current_source_dir()])
run_target(
'update-hwdb-autosuspend',
command : [update_hwdb_autosuspend_sh, project_source_root])