Debian Codegraph @

subprojects/libglnx/meson.build

raw
1 # Copyright 2019 Endless OS Foundation LLC
2 # Copyright 2019 Collabora Ltd.
3 # SPDX-License-Identifier: LGPL-2.1-or-later
4
5 project(
6 'libglnx',
7 'c',
8 default_options : [
9 'c_std=gnu99',
10 'warning_level=2',
11 ],
12 )
13
14 add_project_arguments('-D_GNU_SOURCE', language: 'c')
15 add_project_arguments('-Wno-unused-local-typedefs', language: 'c')
16
17 # We are intentionally using non-ISO features in this (sub)project,
18 # even if a parent project wants to use pedantic warnings
19 add_project_arguments('-Wno-pedantic', language: 'c')
20 add_project_arguments('-Wno-variadic-macros', language: 'c')
21
22 cc = meson.get_compiler('c')
23
24
25 check_functions = [
26 'renameat2',
27 'memfd_create',
28 'copy_file_range',
29 'name_to_handle_at',
30 ]
31 conf = configuration_data()
32 foreach check_function : check_functions
33 have_it = cc.compiles('''
34 #include <sys/types.h>
35 #include <unistd.h>
36 #include <stdio.h>
37 #include <sys/mount.h>
38 #include <fcntl.h>
39 #include <sched.h>
40 #include <linux/loop.h>
41 #include <linux/random.h>
42 #include <sys/mman.h>
43
44 void func (void) {
45 (void) ''' + check_function + ''';
46 }
47 ''',
48 args : '-D_GNU_SOURCE',
49 name : check_function + '() is declared',
50 )
51 conf.set10('HAVE_DECL_' + check_function.underscorify().to_upper(), have_it)
52 endforeach
53
54 check_functions = [
55 'close_range',
56 ]
57 foreach check_function : check_functions
58 if cc.has_function(check_function)
59 conf.set('HAVE_' + check_function.underscorify().to_upper(), 1)
60 endif
61 endforeach
62
63 config_h = configure_file(
64 output : 'libglnx-config.h',
65 configuration : conf,
66 )
67
68 libglnx_deps = [
69 dependency('gio-2.0'),
70 dependency('gio-unix-2.0'),
71 ]
72 libglnx_inc = include_directories('.')
73 libglnx_sources = [
74 'glnx-backport-autocleanups.h',
75 'glnx-backport-autoptr.h',
76 'glnx-backport-testutils.c',
77 'glnx-backport-testutils.h',
78 'glnx-backports.c',
79 'glnx-backports.h',
80 'glnx-chase.c',
81 'glnx-chase.h',
82 'glnx-console.c',
83 'glnx-console.h',
84 'glnx-dirfd.c',
85 'glnx-dirfd.h',
86 'glnx-errors.c',
87 'glnx-errors.h',
88 'glnx-fdio.c',
89 'glnx-fdio.h',
90 'glnx-local-alloc.c',
91 'glnx-local-alloc.h',
92 'glnx-lockfile.c',
93 'glnx-lockfile.h',
94 'glnx-macros.h',
95 'glnx-missing.h',
96 'glnx-missing-syscall.h',
97 'glnx-shutil.c',
98 'glnx-shutil.h',
99 'glnx-xattrs.c',
100 'glnx-xattrs.h',
101 'libglnx.h',
102 ]
103
104 libglnx = static_library('glnx',
105 libglnx_sources,
106 dependencies : libglnx_deps,
107 gnu_symbol_visibility : 'hidden',
108 include_directories : libglnx_inc,
109 install : false)
110 libglnx_dep = declare_dependency(
111 dependencies : libglnx_deps,
112 include_directories : libglnx_inc,
113 link_with : libglnx)
114
115 subdir('tests')
116