]> git.ipfire.org Git - thirdparty/util-linux.git/blame - libmount/meson.build
Merge branch 'PR/libsmartcols-cell-data' of github.com:karelzak/util-linux-work
[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
20 src/fs.c
21 src/init.c
22 src/iter.c
23 src/lock.c
24 src/optmap.c
25 src/optstr.c
26 src/tab.c
27 src/tab_diff.c
28 src/tab_parse.c
29 src/tab_update.c
30 src/test.c
31 src/utils.c
32 src/version.c
33'''.split() + [
34 list_h,
35 monotonic_c,
36]
37
38if LINUX
39 lib_mount_sources += '''
e23c3262
KZ
40 src/hooks.c
41 src/monitor.c
42 src/optlist.c
43 src/hook_veritydev.c
c54947e9 44 src/hook_subdir.c
ee99f438 45 src/hook_owner.c
e23c3262
KZ
46 src/hook_mount.c
47 src/hook_mount_legacy.c
48 src/hook_mkdir.c
d5c515dc 49 src/hook_selinux.c
e23c3262 50 src/hook_loopdev.c
0bbc62dd 51 src/hook_idmap.c
e23c3262
KZ
52 src/context_umount.c
53 src/context_mount.c
54 src/context.c
d4c880d5
ZJS
55'''.split()
56endif
57
58if enable_btrfs
59 lib_mount_sources += 'src/btrfs.c'
60endif
61
62libmount_sym = 'src/libmount.sym'
63libmount_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libmount_sym)
64
65if build_libmount and not have_dirfd and not have_ddfd
66 error('neither dirfd nor ddfd are available')
67endif
68
69939195
ZJS
69lib__mount = static_library(
70 '_mount',
d4c880d5 71 lib_mount_sources,
69939195
ZJS
72 include_directories : [dir_include,
73 dir_libmount,
74 dir_libblkid])
75
76lib_mount_static = static_library(
1c68d580 77 'mount_static',
69939195
ZJS
78 link_whole : lib__mount,
79 link_with : [lib_common,
80 lib_blkid.get_static_lib()],
81 dependencies : [realtime_libs],
82 install : false)
83
c07f7b4e
CH
84lib__mount_deps = [
85 lib_selinux,
86 get_option('cryptsetup-dlopen').enabled() ? lib_dl : lib_cryptsetup,
87 realtime_libs
88]
69939195
ZJS
89lib_mount = library(
90 'mount',
91 link_whole : lib__mount,
d4c880d5
ZJS
92 include_directories : [dir_include,
93 dir_libmount,
94 dir_libblkid],
95 link_depends : libmount_sym,
96 version : libmount_version,
97 link_args : ['-Wl,--version-script=@0@'.format(libmount_sym_path)],
98 link_with : [lib_common,
99 lib_blkid],
c07f7b4e 100 dependencies : lib__mount_deps,
d4c880d5 101 install : build_libmount)
eefff5aa 102mount_dep = declare_dependency(link_with: lib_mount, include_directories: '.')
d4c880d5 103
3f7734ae
TW
104if build_libmount
105 pkgconfig.generate(lib_mount,
106 description : 'mount library',
107 subdirs : 'libmount',
108 version : pc_version)
a2464983 109 if meson.version().version_compare('>=0.54.0')
eefff5aa 110 meson.override_dependency('mount', mount_dep)
a2464983 111 endif
3f7734ae 112endif
d4c880d5 113
074aaf26
TW
114libmount_tests = [
115 'cache',
116 'context',
117 'lock',
118 'optstr',
565eebbc 119 'optlist',
074aaf26
TW
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
ba30b89c 133if program_tests
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],
141 dependencies : lib__mount_deps,
142 c_args : ['-DTEST_PROGRAM'],
143 )
144 # the test-setup expects the helpers in the toplevel build-directory
145 link = meson.project_build_root() / test_name
146 run_command('ln', '-srf', exe.full_path(), link,
147 check : true)
148 endforeach
149endif
074aaf26 150
d4c880d5 151subdir('python')