This repository has been archived by the owner on Jul 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
meson.build
182 lines (156 loc) · 5.25 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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
project('desksanity', 'c',
version: '1.1.99',
license: 'BSD 2 clause',
default_options: [ 'c_std=gnu99', 'warning_level=2' ],
meson_version: '>= 0.40.0')
add_global_arguments('-DHAVE_CONFIG_H=1', language: 'c')
dir_prefix = get_option('prefix')
dir_bin = join_paths(dir_prefix, get_option('bindir'))
dir_sysconf = get_option('sysconfdir')
dir_data = join_paths(dir_prefix, get_option('datadir'))
dir_include = join_paths(dir_prefix, get_option('includedir'))
dir_include_e = join_paths(dir_include, meson.project_name())
dir_lib = join_paths(dir_prefix, get_option('libdir'))
pkgconfig = import('pkgconfig')
cc = meson.get_compiler('c')
# disable for release builds
dev_cflags = []
dev_cflags_try = [
'-Wall',
'-W',
'-Wpointer-arith',
'-Wshadow',
'-Wno-missing-field-initializers',
'-Wfloat-equal',
'-Wuninitialized',
'-Wundef',
'-Wcast-align',
'-Wformat=2',
'-Wno-format-y2k',
]
foreach cf: dev_cflags_try
if cc.has_argument(cf) == true
dev_cflags += cf
endif
endforeach
add_global_arguments(dev_cflags, language: 'c')
dep_e = dependency('enlightenment')
release = dep_e.get_pkgconfig_variable('release')
host_os = host_machine.system()
if host_os == 'linux'
if cc.has_header_symbol('features.h', '__UCLIBC__')
host_os = 'linux-uclibc'
elif cc.has_header_symbol('features.h', '__dietlibc__')
host_os = 'linux-dietlibc'
else
host_os = 'linux-gnu'
endif
endif
module_arch = '@0@-@1@-@2@'.format(host_os, host_machine.cpu_family(), release)
config_h = configuration_data()
config_h.set('_GNU_SOURCE', '1')
config_h.set('_ALL_SOURCE', '1')
config_h.set('_POSIX_PTHREAD_SEMANTICS', '1')
config_h.set('_TANDEM_SOURCE', '1')
config_h.set('__EXTENSIONS__', '1')
config_h.set_quoted('MODULE_ARCH', module_arch)
config_h.set_quoted('PACKAGE', meson.project_name())
config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
config_h.set_quoted('VERSION', meson.project_version())
config_h.set_quoted('PACKAGE_NAME', meson.project_name())
config_h.set_quoted('BINDIR', dir_bin)
config_h.set_quoted('DATADIR', dir_data)
if cc.has_function('setenv') == true
config_h.set('HAVE_SETENV', '1')
endif
if cc.has_function('unsetenv') == true
config_h.set('HAVE_UNSETENV', '1')
endif
if cc.has_function('clearenv') == true
config_h.set('HAVE_CLEARENV', '1')
endif
if cc.has_header('features.h') == true
config_h.set('HAVE_FEATURES_H', '1')
endif
if cc.has_header('sys/ptrace.h') == true
config_h.set('HAVE_SYS_PTRACE_H', '1')
endif
if cc.has_header('arpa/inet.h') == true
config_h.set('HAVE_ARPA_INET_H', '1')
endif
if cc.has_header('netinet/in.h') == true
config_h.set('HAVE_NETINET_IN_H', '1')
endif
if cc.has_header('execinfo.h') == true
config_h.set('HAVE_EXECINFO_H', '1')
elif cc.has_function('backtrace_symbols_fd', dependencies: 'execinfo') == false
execinfo_dep = dependency('execinfo', required: false)
endif
if cc.has_header('fnmatch.h') == false
error('fnmatch.h not found')
endif
if cc.has_function('fnmatch') == false
dep_fnmatch = dependency('fnmatch', required: true)
endif
add_global_arguments('-DPACKAGE_BIN_DIR="@0@"'.format(dir_bin), language: 'c')
add_global_arguments('-DPACKAGE_LIB_DIR="@0@"'.format(dir_lib), language: 'c')
add_global_arguments('-DPACKAGE_DATA_DIR="@0@"'.format(join_paths(dir_data, meson.project_name())), language: 'c')
add_global_arguments('-DPACKAGE_SYSCONF_DIR="@0@"'.format(dir_sysconf), language: 'c')
dep_efl_wl = dependency('efl-wl', required: false)
dir_module_e = join_paths([dep_e.get_pkgconfig_variable('modules'), 'desksanity'])
edje_cc = find_program('edje_cc')
install_data(['e-module-desksanity.edj', 'module.desktop'],
install_dir: dir_module_e,
install_mode: 'rw-rw-r--')
build_files = [
'src/e_mod_main.h',
'src/e_mod_main.c',
'src/ds_config.c',
'src/maximize.c',
'src/moveresize.c',
'src/pip.c',
'src/zoom.c',
'src/magnify.c',
'src/desksanity.c'
]
if dep_efl_wl.found() == true and dep_e.get_pkgconfig_variable('wayland') == 'true'
config_h.set('HAVE_RUNNER', '1')
dir_gadgets = join_paths([dir_lib, 'enlightenment/gadgets', module_arch])
executable('e_gadget_start',
'loader/start.c',
c_args: '-fPIE',
link_args: '-fPIE',
dependencies: [dependency('elementary'), dependency('enlightenment')],
install_dir: join_paths([dir_gadgets, 'start']),
install: true)
executable('e_gadget_test',
'loader/test.c',
c_args: '-fPIE',
link_args: '-fPIE',
dependencies: dependency('elementary'),
install_dir: join_paths([dir_gadgets, 'test']),
install: true)
config_h.set_quoted('GADGET_DIR', dir_gadgets)
desktop_data = configuration_data()
desktop_data.set('GADGET_DIR', dir_gadgets)
configure_file(input: 'loader/test.desktop.in',
output: 'test.desktop',
install: true,
install_dir: join_paths([dir_gadgets, 'test']),
configuration: desktop_data)
configure_file(input: 'loader/start.desktop.in',
output: 'start.desktop',
install: true,
install_dir: join_paths([dir_gadgets, 'start']),
configuration: desktop_data)
endif
configure_file(output: 'config.h',
install: false,
configuration: config_h)
shared_module('desksanity', build_files,
include_directories: include_directories(['src']),
name_prefix: '',
dependencies: [dep_e, dep_efl_wl],
install_dir: join_paths([dir_module_e, module_arch]),
install: true)
meson.add_install_script('meson_modules.sh', join_paths([dir_module_e, module_arch, 'desksanity.so']))