forked from GNOME/file-roller
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmeson.build
170 lines (149 loc) · 4.9 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
project('file-roller', 'c',
license : 'GPL2+',
version : '3.29.1',
meson_version : '>=0.43'
)
glib_version = '>=2.36'
gtk_version = '>=3.13.2'
nautilus_version = '>=2.22.2'
json_glib_version = '>=0.14.0'
libnotify_version = '>=0.4.3'
libarchive_version = '>=3.0.0'
gnome = import('gnome')
i18n = import('i18n')
gettext_package = meson.project_name()
prefix = get_option('prefix')
datadir = join_paths(prefix, get_option('datadir'))
privexecdir = join_paths(prefix, get_option('libexecdir'), meson.project_name())
c_comp = meson.get_compiler('c')
meson.add_install_script('postinstall.py')
# Dependencies
libm_dep = c_comp.find_library('m')
thread_dep = dependency('threads')
glib_dep = dependency('glib-2.0', version : glib_version)
gthread_dep = dependency('gthread-2.0')
gtk_dep = dependency('gtk+-3.0', version : gtk_version)
# Optional dependencies
if get_option('nautilus-actions')
libnautilus_extension_dep = dependency('libnautilus-extension', version : nautilus_version, required : false)
build_nautilus_actions = libnautilus_extension_dep.found()
else
build_nautilus_actions = false
endif
libjson_glib_dep = dependency('json-glib-1.0', version : json_glib_version, required : false)
use_json_glib = libjson_glib_dep.found()
if get_option('notification')
libnotify_dep = dependency('libnotify', version : libnotify_version, required : false)
use_libnotify = libnotify_dep.found()
else
use_libnotify = false
endif
if get_option('libarchive')
libarchive_dep = dependency('libarchive', version : libarchive_version, required : false)
use_libarchive = libarchive_dep.found()
else
use_libarchive = false
endif
use_magic = false
if get_option('magic')
libmagic_dep = c_comp.find_library('magic')
if c_comp.compiles('''#include <magic.h>
int main () { magic_t m = magic_open(MAGIC_NONE); }''',
dependencies : libmagic_dep)
use_magic = true
endif
endif
have_mkdtemp = c_comp.has_function('mkdtemp')
cpio_path = 'cpio'
if get_option('cpio') == 'auto'
cpio = find_program('gcpio', 'cpio', required : false)
if cpio.found()
cpio_path = cpio.path()
endif
endif
# config.h
config_data = configuration_data()
config_data.set_quoted('GETTEXT_PACKAGE', gettext_package)
config_data.set_quoted('LOCALEDIR', join_paths(prefix, get_option('localedir')))
config_data.set_quoted('PACKAGE_NAME', meson.project_name())
config_data.set_quoted('PACKAGE_VERSION', meson.project_version())
if get_option('run-in-place')
config_data.set_quoted('PRIVDATADIR', join_paths(meson.source_root(), 'data'))
config_data.set_quoted('PRIVEXECDIR', join_paths(meson.source_root(), 'src', 'commands'))
config_data.set_quoted('UIDIR', join_paths(meson.source_root(), 'data', 'ui'))
config_data.set_quoted('SHDIR', join_paths(meson.source_root(), 'src', 'sh'))
else
config_data.set_quoted('PRIVDATADIR', join_paths(datadir, meson.project_name()))
config_data.set_quoted('PRIVEXECDIR', privexecdir)
config_data.set_quoted('UIDIR', join_paths(datadir, meson.project_name(), 'ui'))
config_data.set_quoted('SHDIR', join_paths(prefix, get_option('libexecdir'), meson.project_name()))
endif
if use_json_glib
config_data.set('HAVE_JSON_GLIB', 1)
endif
if use_libnotify
config_data.set('ENABLE_NOTIFICATION', 1)
endif
if use_libarchive
config_data.set('ENABLE_LIBARCHIVE', 1)
endif
if get_option('packagekit')
config_data.set('ENABLE_PACKAGEKIT', 1)
endif
if get_option('buildtype').contains('debug')
config_data.set('DEBUG', 1)
endif
if have_mkdtemp
config_data.set('HAVE_MKDTEMP', 1)
endif
if use_magic
config_data.set('ENABLE_MAGIC', 1)
endif
config_data.set_quoted('CPIO_PATH', cpio_path)
config_file = configure_file(output : 'config.h', configuration : config_data)
config_inc = include_directories('.')
# C args
c_args = []
if get_option('buildtype').contains('debug')
test_args = [
'-Wall',
'-Wcast-align',
'-Wtype-limits',
'-Wclobbered',
'-Wempty-body',
'-Wignored-qualifiers',
'-Wmissing-prototypes',
'-Wnested-externs',
'-Wpointer-arith',
'-Wno-sign-compare',
'-Wformat-security'
]
else
c_args += [ '-Wno-deprecated-declarations' ]
test_args = [ '-Wall' ]
endif
c_args += c_comp.get_supported_arguments(test_args)
# Subdirectories
subdir('data')
subdir('help')
if build_nautilus_actions
subdir('nautilus')
endif
subdir('po')
subdir('src')
# Summary
summary = [
'configuration summary:',
'',
' project: @0@ @1@'.format(meson.project_name(), meson.project_version()),
' prefix: @0@'.format(prefix),
' nautilus actions: @0@'.format(build_nautilus_actions),
' notifications: @0@'.format(use_libnotify),
' packagekit: @0@'.format(get_option('packagekit')),
' libarchive: @0@'.format(use_libarchive),
' magic: @0@'.format(use_magic),
' have mkdtemp: @0@'.format(have_mkdtemp),
' cpio: @0@'.format(cpio_path),
''
]
message('\n'.join(summary))