1 # SPDX-License-Identifier: LGPL-2.1+
3 # Copyright 2017 Zbigniew Jędrzejewski-Szmek
5 # systemd is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU Lesser General Public License as published by
7 # the Free Software Foundation; either version 2.1 of the License, or
8 # (at your option) any later version.
10 # systemd is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public License
16 # along with systemd; If not, see <http://www.gnu.org/licenses/>.
18 udevadm_sources = files('''
27 udevadm-test-builtin.c
32 systemd_udevd_sources = files('udevd.c')
34 libudev_core_sources = '''
44 udev-builtin-input_id.c
45 udev-builtin-keyboard.c
47 udev-builtin-net_setup_link.c
48 udev-builtin-path_id.c
56 if conf.get('HAVE_KMOD') == 1
57 libudev_core_sources += ['udev-builtin-kmod.c']
60 if conf.get('HAVE_BLKID') == 1
61 libudev_core_sources += ['udev-builtin-blkid.c']
64 if conf.get('HAVE_ACL') == 1
65 libudev_core_sources += ['udev-builtin-uaccess.c',
70 ############################################################
72 generate_keyboard_keys_list = find_program('generate-keyboard-keys-list.sh')
73 keyboard_keys_list_txt = custom_target(
74 'keyboard-keys-list.txt',
75 output : 'keyboard-keys-list.txt',
76 command : [generate_keyboard_keys_list, cpp],
79 generate_keyboard_keys_gperf = find_program('generate-keyboard-keys-gperf.sh')
80 fname = 'keyboard-keys-from-name.gperf'
81 gperf_file = custom_target(
83 input : keyboard_keys_list_txt,
85 command : [generate_keyboard_keys_gperf, '@INPUT@'],
88 fname = 'keyboard-keys-from-name.h'
89 keyboard_keys_from_name_h = custom_target(
95 '-N', 'keyboard_lookup_key',
96 '-H', 'hash_key_name',
101 ############################################################
103 link_config_gperf_c = custom_target(
104 'link-config-gperf.c',
105 input : 'net/link-config-gperf.gperf',
106 output : 'link-config-gperf.c',
107 command : [gperf, '@INPUT@', '--output-file', '@OUTPUT@'])
109 ############################################################
111 if get_option('link-udev-shared')
112 udev_link_with = [libshared]
113 udev_rpath = rootlibexecdir
115 udev_link_with = [libshared_static,
120 libudev_basic = static_library(
123 include_directories : includes,
124 c_args : ['-fvisibility=default'])
126 libudev_static = static_library(
129 include_directories : includes,
130 link_with : udev_link_with,
131 link_whole : libudev_basic)
133 libudev = shared_library(
135 version : libudev_version,
136 include_directories : includes,
137 link_args : ['-shared',
138 '-Wl,--version-script=' + libudev_sym_path],
139 link_with : [libsystemd_static, libshared_static],
140 link_whole : libudev_basic,
141 dependencies : [threads],
142 link_depends : libudev_sym,
144 install_dir : rootlibdir)
146 libudev_core_includes = [includes, include_directories('net')]
147 libudev_core = static_library(
149 libudev_core_sources,
151 keyboard_keys_from_name_h,
152 include_directories : libudev_core_includes,
153 c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
154 link_with : udev_link_with,
155 dependencies : [libblkid, libkmod])
157 foreach prog : [['ata_id/ata_id.c'],
158 ['cdrom_id/cdrom_id.c'],
159 ['collect/collect.c'],
160 ['scsi_id/scsi_id.c',
162 'scsi_id/scsi_serial.c',
165 ['mtd_probe/mtd_probe.c',
166 'mtd_probe/mtd_probe.h',
167 'mtd_probe/probe_smartmedia.c']]
169 executable(prog[0].split('/')[0],
171 include_directories : includes,
172 c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
173 link_with : [libudev_static],
174 install_rpath : udev_rpath,
176 install_dir : udevlibexecdir)
179 install_data('udev.conf',
180 install_dir : join_paths(sysconfdir, 'udev'))
182 udev_pc = configure_file(
183 input : 'udev.pc.in',
185 configuration : substs)
186 install_data(udev_pc,
187 install_dir : pkgconfigdatadir)
189 meson.add_install_script('sh', '-c',
190 mkdir_p.format(join_paths(sysconfdir, 'udev/rules.d')))