]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/udev/meson.build
udev: move naming-scheme bits into their own file
[thirdparty/systemd.git] / src / udev / meson.build
1 # SPDX-License-Identifier: LGPL-2.1+
2
3 udevadm_sources = files('''
4 udevadm.c
5 udevadm.h
6 udevadm-control.c
7 udevadm-hwdb.c
8 udevadm-info.c
9 udevadm-monitor.c
10 udevadm-settle.c
11 udevadm-test.c
12 udevadm-test-builtin.c
13 udevadm-trigger.c
14 udevadm-util.c
15 udevadm-util.h
16 '''.split())
17
18 systemd_udevd_sources = files('udevd.c')
19
20 libudev_core_sources = '''
21 udev.h
22 udev-ctrl.c
23 udev-ctrl.h
24 udev-event.c
25 udev-node.c
26 udev-node.h
27 udev-rules.c
28 udev-watch.c
29 udev-watch.h
30 udev-builtin.c
31 udev-builtin.h
32 udev-builtin-btrfs.c
33 udev-builtin-hwdb.c
34 udev-builtin-input_id.c
35 udev-builtin-keyboard.c
36 udev-builtin-net_id.c
37 udev-builtin-net_setup_link.c
38 udev-builtin-path_id.c
39 udev-builtin-usb_id.c
40 net/link-config.c
41 net/link-config.h
42 net/ethtool-util.c
43 net/ethtool-util.h
44 net/naming-scheme.c
45 net/naming-scheme.h
46 '''.split()
47
48 if conf.get('HAVE_KMOD') == 1
49 libudev_core_sources += ['udev-builtin-kmod.c']
50 endif
51
52 if conf.get('HAVE_BLKID') == 1
53 libudev_core_sources += ['udev-builtin-blkid.c']
54 endif
55
56 if conf.get('HAVE_ACL') == 1
57 libudev_core_sources += ['udev-builtin-uaccess.c',
58 logind_acl_c,
59 sd_login_sources]
60 endif
61
62 ############################################################
63
64 generate_keyboard_keys_list = find_program('generate-keyboard-keys-list.sh')
65 keyboard_keys_list_txt = custom_target(
66 'keyboard-keys-list.txt',
67 output : 'keyboard-keys-list.txt',
68 command : [generate_keyboard_keys_list, cpp],
69 capture : true)
70
71 generate_keyboard_keys_gperf = find_program('generate-keyboard-keys-gperf.sh')
72 fname = 'keyboard-keys-from-name.gperf'
73 gperf_file = custom_target(
74 fname,
75 input : keyboard_keys_list_txt,
76 output : fname,
77 command : [generate_keyboard_keys_gperf, '@INPUT@'],
78 capture : true)
79
80 fname = 'keyboard-keys-from-name.h'
81 keyboard_keys_from_name_h = custom_target(
82 fname,
83 input : gperf_file,
84 output : fname,
85 command : [gperf,
86 '-L', 'ANSI-C', '-t',
87 '-N', 'keyboard_lookup_key',
88 '-H', 'hash_key_name',
89 '-p', '-C',
90 '@INPUT@'],
91 capture : true)
92
93 ############################################################
94
95 link_config_gperf_c = custom_target(
96 'link-config-gperf.c',
97 input : 'net/link-config-gperf.gperf',
98 output : 'link-config-gperf.c',
99 command : [gperf, '@INPUT@', '--output-file', '@OUTPUT@'])
100
101 ############################################################
102
103 if get_option('link-udev-shared')
104 udev_link_with = [libshared]
105 udev_rpath = rootlibexecdir
106 else
107 udev_link_with = [libshared_static,
108 libsystemd_static]
109 udev_rpath = ''
110 endif
111
112 libudev_basic = static_library(
113 'udev-basic',
114 libudev_sources,
115 include_directories : includes,
116 c_args : ['-fvisibility=default'])
117
118 libudev_static = static_library(
119 'udev_static',
120 'udev.h',
121 include_directories : includes,
122 link_with : udev_link_with,
123 link_whole : libudev_basic)
124
125 static_libudev = get_option('static-libudev')
126 static_libudev_pic = static_libudev == 'true' or static_libudev == 'pic'
127 install_libudev_static = static_library(
128 'udev',
129 basic_sources,
130 shared_sources,
131 libsystemd_sources,
132 libudev_sources,
133 disable_mempool_c,
134 include_directories : includes,
135 build_by_default : static_libudev != 'false',
136 install : static_libudev != 'false',
137 install_dir : rootlibdir,
138 link_depends : libudev_sym,
139 dependencies : libshared_deps + [libmount],
140 c_args : static_libudev_pic ? [] : ['-fno-PIC'],
141 pic : static_libudev_pic)
142
143 libudev = shared_library(
144 'udev',
145 disable_mempool_c,
146 version : libudev_version,
147 include_directories : includes,
148 link_args : ['-shared',
149 '-Wl,--version-script=' + libudev_sym_path],
150 link_with : [libsystemd_static, libshared_static],
151 link_whole : libudev_basic,
152 dependencies : [threads],
153 link_depends : libudev_sym,
154 install : true,
155 install_dir : rootlibdir)
156
157 libudev_core_includes = [includes, include_directories('net')]
158 libudev_core = static_library(
159 'udev-core',
160 libudev_core_sources,
161 link_config_gperf_c,
162 keyboard_keys_from_name_h,
163 include_directories : libudev_core_includes,
164 c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
165 link_with : udev_link_with,
166 dependencies : [libblkid, libkmod])
167
168 foreach prog : [['ata_id/ata_id.c'],
169 ['cdrom_id/cdrom_id.c'],
170 ['scsi_id/scsi_id.c',
171 'scsi_id/scsi_id.h',
172 'scsi_id/scsi_serial.c',
173 'scsi_id/scsi.h'],
174 ['v4l_id/v4l_id.c'],
175 ['mtd_probe/mtd_probe.c',
176 'mtd_probe/mtd_probe.h',
177 'mtd_probe/probe_smartmedia.c']]
178
179 executable(prog[0].split('/')[0],
180 prog,
181 include_directories : includes,
182 c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
183 link_with : [libudev_static],
184 install_rpath : udev_rpath,
185 install : true,
186 install_dir : udevlibexecdir)
187 endforeach
188
189 install_data('udev.conf',
190 install_dir : join_paths(sysconfdir, 'udev'))
191
192 configure_file(
193 input : 'udev.pc.in',
194 output : 'udev.pc',
195 configuration : substs,
196 install_dir : pkgconfigdatadir == 'no' ? '' : pkgconfigdatadir)
197
198 meson.add_install_script('sh', '-c',
199 mkdir_p.format(join_paths(sysconfdir, 'udev/rules.d')))