-
Notifications
You must be signed in to change notification settings - Fork 88
/
meson.build
164 lines (144 loc) · 4.51 KB
/
meson.build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
project('cinnamon-screensaver', 'c', version : '6.4.0', meson_version : '>=0.56.0')
cc = meson.get_compiler('c')
conf = configuration_data()
conf.set_quoted('PACKAGE', meson.project_name())
conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
# project options
# commandline options
prefix = get_option('prefix')
bindir = join_paths(prefix, get_option('bindir'))
datadir = join_paths(prefix, get_option('datadir'))
pkgdatadir = join_paths(datadir, meson.project_name())
libexecdir = join_paths(prefix, get_option('libexecdir'))
pkglibdir = join_paths(libexecdir, meson.project_name())
typelibdir = join_paths(pkglibdir, 'girepository-1.0')
libdir = join_paths(prefix, get_option('libdir'))
#needed?
sysconfdir = join_paths(prefix, get_option('sysconfdir'))
localstatedir = join_paths(prefix, get_option('localstatedir'))
localedir = join_paths(prefix, get_option('localedir'))
# object used for configure_file because meson 0.47 is needed for dicts
# and 0.49 for using them in configure_file
misc_conf = configuration_data()
misc_conf.set('prefix', prefix)
misc_conf.set('bindir', bindir)
misc_conf.set('datadir', datadir)
misc_conf.set('pkgdatadir', pkgdatadir)
misc_conf.set('pkglibdir', pkglibdir)
misc_conf.set('libdir', libdir)
misc_conf.set('PACKAGE', meson.project_name())
misc_conf.set('VERSION', meson.project_version())
misc_conf.set('GETTEXT_PACKAGE', meson.project_name())
gtk = dependency('gtk+-3.0')
glib = dependency('glib-2.0')
gio = dependency('gio-2.0')
gio_unix = dependency('gio-unix-2.0')
gthread = dependency('gthread-2.0')
gobject = dependency('gobject-2.0')
gdk = dependency('gdk-x11-3.0')
x11 = dependency('x11')
xext = dependency('xext')
xrandr = dependency('xrandr', required: false)
m = cc.find_library('m')
xdo = dependency('libxdo', required: false)
if not xdo.found()
xdo = cc.find_library('xdo')
endif
dbus_services_dir = dependency('dbus-1').get_variable(pkgconfig: 'session_bus_services_dir', pkgconfig_define: ['datadir', datadir])
# check for symbols and headers
foreach header : [
'unistd.h'
]
if cc.has_header(header)
conf.set('HAVE_' + header.underscorify().to_upper(), true)
endif
endforeach
foreach sym : [
'sigaction'
]
if cc.has_function(sym, args : '-D_GNU_SOURCE')
conf.set('HAVE_' + sym.to_upper(), true)
endif
endforeach
use_xinerama = get_option('xinerama')
if use_xinerama
if host_machine.system() == 'solaris'
xinerama = cc.find_library('Xext')
xinerama_h = cc.has_header('X11/extensions/xinerama.h')
if not xinerama.found() or xinerama_h
error('could not find usable xinerama library')
endif
conf.set('HAVE_SOLARIS_XINERAMA', 1)
else
xinerama = dependency('xinerama')
conf.set('HAVE_XFREE_XINERAMA', 1)
endif
conf.set('HAVE_XINERAMA', 1)
endif
pam_compile = '''#include <stdio.h>
#include <stdlib.h>
#include <security/pam_appl.h>
int main ()
{
pam_handle_t *pamh = 0;
char *s = pam_strerror(pamh, PAM_SUCCESS);
return 0;
}'''
pam = cc.find_library('pam')
if not cc.has_function('sigtimedwait')
pam = [pam, cc.find_library('rt')]
endif
if cc.compiles(pam_compile)
conf.set('PAM_STRERROR_TWO_ARGS', 1)
endif
# this check is not used anywhere
if cc.has_function('pam_syslog', dependencies: pam)
conf.set('HAVE_PAM_SYSLOG', 1)
endif
# Sun-type pam, this check is not used anywhere
if not cc.has_header_symbol('security/pam_appl.h', 'const struct pam_message')
conf.set('PAM_MESSAGE_NONCONST', 1)
endif
# do we care if the header exists? Just use pkg-config
if cc.has_header('X11/extensions/Xrandr.h')
xrandr = 'Xrandr'
else
xrandr = ''
endif
xrandr = cc.find_library(xrandr, required: false)
if xrandr.found()
conf.set('HAVE_RANDR', 1)
endif
if cc.has_header('X11/extensions/shape.h')
conf.set('HAVE_SHAPE_EXT', 1)
endif
conf_h = configure_file(
output : 'config.h',
configuration : conf)
inc = include_directories('.')
if not get_option('deprecated-warnings')
add_global_arguments([
'-Wno-deprecated-declarations',
'-Wno-deprecated',
'-Wno-declaration-after-statement',
'-DGLIB_DISABLE_DEPRECATION_WARNINGS',
],
language: 'c',
)
endif
# add_global_arguments(
# [
# '-Wall',
# '-Wextra',
# '-Wno-unused-parameter',
# '-Wmissing-prototypes',
# '-Wstrict-prototypes',
# '-pedantic'
# ],
# language: 'c'
# )
subdir('install-scripts')
subdir('libcscreensaver')
subdir('data')
subdir('src')
subdir('backup-locker')