]> git.ipfire.org Git - thirdparty/util-linux.git/blame - libmount/meson.build
libmount: make it possible to define order of hooks
[thirdparty/util-linux.git] / libmount / meson.build
CommitLineData
d4c880d5
ZJS
1dir_libmount = include_directories('.', 'src')
2
3defs = configuration_data()
f02de6de
TW
4defs.set('LIBMOUNT_VERSION', pc_version)
5defs.set('LIBMOUNT_MAJOR_VERSION', pc_version.split('.')[0])
6defs.set('LIBMOUNT_MINOR_VERSION', pc_version.split('.')[1])
7defs.set('LIBMOUNT_PATCH_VERSION', pc_version.split('.')[2])
d4c880d5 8
7da59534 9configure_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
17lib_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
39if 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
1a75b4f9 50 src/hook_selinux_target.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()
57endif
58
59if enable_btrfs
60 lib_mount_sources += 'src/btrfs.c'
61endif
62
63libmount_sym = 'src/libmount.sym'
64libmount_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libmount_sym)
65
66if build_libmount and not have_dirfd and not have_ddfd
67 error('neither dirfd nor ddfd are available')
68endif
69
69939195
ZJS
70lib__mount = static_library(
71 '_mount',
d4c880d5 72 lib_mount_sources,
69939195
ZJS
73 include_directories : [dir_include,
74 dir_libmount,
75 dir_libblkid])
76
77lib_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
85lib__mount_deps = [
86 lib_selinux,
87 get_option('cryptsetup-dlopen').enabled() ? lib_dl : lib_cryptsetup,
88 realtime_libs
89]
69939195
ZJS
90lib_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 103mount_dep = declare_dependency(link_with: lib_mount, include_directories: '.')
d4c880d5 104
3f7734ae
TW
105if 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 113endif
d4c880d5 114
074aaf26
TW
115libmount_tests = [
116 'cache',
117 'context',
118 'lock',
119 'optstr',
120 'tab',
121 'tab_diff',
122 'monitor',
123 'tab_update',
124 'utils',
125 'version',
126 'debug',
127]
128
129libmount_test_src_override = {
130 'debug': 'init',
131}
132
133foreach libmount_test: libmount_tests
134 test_name = 'test_mount_' + libmount_test
135 exe = executable(
136 test_name,
137 'src/' + libmount_test_src_override.get(libmount_test, libmount_test) + '.c',
138 include_directories : [dir_include, dir_libblkid],
139 link_with : [lib__mount, lib_common, lib_blkid_static],
c07f7b4e 140 dependencies : lib__mount_deps,
074aaf26
TW
141 c_args : ['-DTEST_PROGRAM'],
142 )
143 # the test-setup expects the helpers in the toplevel build-directory
144 link = meson.build_root() / test_name
145 run_command('ln', '-srf', exe.full_path(), link,
146 check : true)
147endforeach
148
d4c880d5 149subdir('python')