]>
Commit | Line | Data |
---|---|---|
d4c880d5 ZJS |
1 | dir_libmount = include_directories('.', 'src') |
2 | ||
3 | defs = configuration_data() | |
f02de6de TW |
4 | defs.set('LIBMOUNT_VERSION', pc_version) |
5 | defs.set('LIBMOUNT_MAJOR_VERSION', pc_version.split('.')[0]) | |
6 | defs.set('LIBMOUNT_MINOR_VERSION', pc_version.split('.')[1]) | |
7 | defs.set('LIBMOUNT_PATCH_VERSION', pc_version.split('.')[2]) | |
d4c880d5 | 8 | |
7da59534 | 9 | configure_file( |
d4c880d5 ZJS |
10 | input : 'src/libmount.h.in', |
11 | output : 'libmount.h', | |
7a7982f9 TW |
12 | configuration : defs, |
13 | install : build_libmount, | |
14 | install_dir : join_paths(get_option('includedir'), 'libmount'), | |
15 | ) | |
d4c880d5 ZJS |
16 | |
17 | lib_mount_sources = ''' | |
18 | src/mountP.h | |
19 | src/cache.c | |
8241fb00 | 20 | src/hooks.c |
d4c880d5 ZJS |
21 | src/fs.c |
22 | src/init.c | |
23 | src/iter.c | |
24 | src/lock.c | |
25 | src/optmap.c | |
26 | src/optstr.c | |
27 | src/tab.c | |
28 | src/tab_diff.c | |
29 | src/tab_parse.c | |
30 | src/tab_update.c | |
31 | src/test.c | |
32 | src/utils.c | |
33 | src/version.c | |
34 | '''.split() + [ | |
35 | list_h, | |
36 | monotonic_c, | |
37 | ] | |
38 | ||
39 | if LINUX | |
40 | lib_mount_sources += ''' | |
e23c3262 KZ |
41 | src/hooks.c |
42 | src/monitor.c | |
43 | src/optlist.c | |
44 | src/hook_veritydev.c | |
c54947e9 | 45 | src/hook_subdir.c |
ee99f438 | 46 | src/hook_owner.c |
e23c3262 KZ |
47 | src/hook_mount.c |
48 | src/hook_mount_legacy.c | |
49 | src/hook_mkdir.c | |
d5c515dc | 50 | src/hook_selinux.c |
e23c3262 | 51 | src/hook_loopdev.c |
0bbc62dd | 52 | src/hook_idmap.c |
e23c3262 KZ |
53 | src/context_umount.c |
54 | src/context_mount.c | |
55 | src/context.c | |
d4c880d5 ZJS |
56 | '''.split() |
57 | endif | |
58 | ||
59 | if enable_btrfs | |
60 | lib_mount_sources += 'src/btrfs.c' | |
61 | endif | |
62 | ||
63 | libmount_sym = 'src/libmount.sym' | |
64 | libmount_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libmount_sym) | |
65 | ||
66 | if build_libmount and not have_dirfd and not have_ddfd | |
67 | error('neither dirfd nor ddfd are available') | |
68 | endif | |
69 | ||
69939195 ZJS |
70 | lib__mount = static_library( |
71 | '_mount', | |
d4c880d5 | 72 | lib_mount_sources, |
69939195 ZJS |
73 | include_directories : [dir_include, |
74 | dir_libmount, | |
75 | dir_libblkid]) | |
76 | ||
77 | lib_mount_static = static_library( | |
1c68d580 | 78 | 'mount_static', |
69939195 ZJS |
79 | link_whole : lib__mount, |
80 | link_with : [lib_common, | |
81 | lib_blkid.get_static_lib()], | |
82 | dependencies : [realtime_libs], | |
83 | install : false) | |
84 | ||
c07f7b4e CH |
85 | lib__mount_deps = [ |
86 | lib_selinux, | |
87 | get_option('cryptsetup-dlopen').enabled() ? lib_dl : lib_cryptsetup, | |
88 | realtime_libs | |
89 | ] | |
69939195 ZJS |
90 | lib_mount = library( |
91 | 'mount', | |
92 | link_whole : lib__mount, | |
d4c880d5 ZJS |
93 | include_directories : [dir_include, |
94 | dir_libmount, | |
95 | dir_libblkid], | |
96 | link_depends : libmount_sym, | |
97 | version : libmount_version, | |
98 | link_args : ['-Wl,--version-script=@0@'.format(libmount_sym_path)], | |
99 | link_with : [lib_common, | |
100 | lib_blkid], | |
c07f7b4e | 101 | dependencies : lib__mount_deps, |
d4c880d5 | 102 | install : build_libmount) |
eefff5aa | 103 | mount_dep = declare_dependency(link_with: lib_mount, include_directories: '.') |
d4c880d5 | 104 | |
3f7734ae TW |
105 | if build_libmount |
106 | pkgconfig.generate(lib_mount, | |
107 | description : 'mount library', | |
108 | subdirs : 'libmount', | |
109 | version : pc_version) | |
a2464983 | 110 | if meson.version().version_compare('>=0.54.0') |
eefff5aa | 111 | meson.override_dependency('mount', mount_dep) |
a2464983 | 112 | endif |
3f7734ae | 113 | endif |
d4c880d5 | 114 | |
074aaf26 TW |
115 | libmount_tests = [ |
116 | 'cache', | |
117 | 'context', | |
118 | 'lock', | |
119 | 'optstr', | |
565eebbc | 120 | 'optlist', |
074aaf26 TW |
121 | 'tab', |
122 | 'tab_diff', | |
123 | 'monitor', | |
124 | 'tab_update', | |
125 | 'utils', | |
126 | 'version', | |
127 | 'debug', | |
128 | ] | |
129 | ||
130 | libmount_test_src_override = { | |
131 | 'debug': 'init', | |
132 | } | |
133 | ||
134 | foreach libmount_test: libmount_tests | |
135 | test_name = 'test_mount_' + libmount_test | |
136 | exe = executable( | |
137 | test_name, | |
138 | 'src/' + libmount_test_src_override.get(libmount_test, libmount_test) + '.c', | |
139 | include_directories : [dir_include, dir_libblkid], | |
140 | link_with : [lib__mount, lib_common, lib_blkid_static], | |
c07f7b4e | 141 | dependencies : lib__mount_deps, |
074aaf26 TW |
142 | c_args : ['-DTEST_PROGRAM'], |
143 | ) | |
144 | # the test-setup expects the helpers in the toplevel build-directory | |
e2cd7446 | 145 | link = meson.project_build_root() / test_name |
074aaf26 TW |
146 | run_command('ln', '-srf', exe.full_path(), link, |
147 | check : true) | |
148 | endforeach | |
149 | ||
d4c880d5 | 150 | subdir('python') |