-
-
Notifications
You must be signed in to change notification settings - Fork 62
/
meson.build
173 lines (150 loc) · 5.3 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
project(
'dev.geopjr.Tuba',
['c', 'vala'],
version: '0.9.1',
meson_version: '>= 0.56.0',
default_options: [
'warning_level=2',
'werror=false',
],
)
# add_project_arguments(['--define=USE_LISTVIEW'], language: 'vala')
# https://gitlab.gnome.org/GNOME/vala/-/issues/1413#note_1707480
if meson.get_compiler ('c').get_id () == 'clang'
add_project_arguments('-Wno-incompatible-function-pointer-types', language: 'c')
endif
devel = get_option('devel')
distro = get_option('distro')
clapper_support = get_option('clapper')
# Setup configuration file
config = configuration_data()
config.set('EXEC_NAME', meson.project_name())
config.set('GETTEXT_PACKAGE', meson.project_name())
config.set('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir')))
config.set('DOMAIN', meson.project_name ())
config.set('G_LOG_DOMAIN', 'Tuba')
config.set('RESOURCES', '/' + '/'.join(meson.project_name().split('.')) + '/')
config.set('VERSION', meson.project_version())
config.set('PREFIX', get_option('prefix'))
config.set('NAME', 'Tuba')
config.set('WEBSITE', 'https://github.com/GeopJr/Tuba')
config.set('ISSUES_WEBSITE', 'https://github.com/GeopJr/Tuba/issues')
config.set('SUPPORT_WEBSITE', 'https://matrix.to/#/#tuba:gnome.org')
config.set('DONATE_WEBSITE', 'https://geopjr.dev/donate')
config.set('TRANSLATE_WEBSITE', 'https://hosted.weblate.org/engage/tuba/')
config.set('WIKI_WEBSITE', 'https://github.com/GeopJr/Tuba/wiki')
config.set('PROFILE', devel ? 'development' : 'production')
if devel
git = find_program('git')
if git.found()
branch = run_command('git', 'branch', '--show-current', check: true).stdout().strip()
revision = run_command('git', 'rev-parse', '--short', 'HEAD', check: true).stdout().strip()
version = '@0@-@1@'.format(branch, revision)
config.set('VERSION', version)
endif
endif
devmode = false
if devmode
add_project_arguments(['--define=DEV_MODE'], language: 'vala')
endif
if host_machine.system() == 'windows'
add_project_arguments(['--define=WINDOWS'], language: 'vala')
elif host_machine.system() == 'darwin'
add_project_arguments(['--define=DARWIN'], language: 'vala')
endif
add_project_arguments(['--vapidir=' + meson.project_source_root() / 'vapi'], language: 'vala')
add_project_arguments (
'-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()),
'-DG_LOG_DOMAIN="Tuba"',
language: 'c'
)
gnome = import('gnome')
i18n = import('i18n')
asresources = gnome.compile_resources(
'as-resources',
'data/gresource.xml',
source_dir: 'data',
c_name: 'as',
)
gstreamer = false
gtk_dep = dependency('gtk4', version: '>=4.13.4', required: true)
libadwaita_dep = dependency('libadwaita-1', version: '>=1.5', required: true)
gtksourceview_dep = dependency('gtksourceview-5', required: true, version: '>=5.6.0')
libwebp_dep = dependency('libwebp', required: false)
libspelling = dependency('libspelling-1', required: false)
clapper_dep = dependency('clapper-0.0', required: false)
clapper_gtk_dep = dependency('clapper-gtk-0.0', required: false)
gstreamer_dep = dependency('gstreamer-1.0', required: false)
if not libwebp_dep.found ()
warning('WebP support might be missing, please install webp-pixbuf-loader.')
endif
if libspelling.found ()
add_project_arguments(['--define=LIBSPELLING'], language: 'vala')
endif
if gtksourceview_dep.version().version_compare('>=5.7.1')
add_project_arguments(['--define=GTKSOURCEVIEW_5_7_1'], language: 'vala')
endif
if gstreamer_dep.found ()
add_project_arguments(['--define=GSTREAMER'], language: 'vala')
gstreamer = true
endif
if clapper_support and clapper_dep.found () and clapper_dep.version().version_compare('>=0.6.0') and clapper_gtk_dep.found ()
add_project_arguments(['--define=CLAPPER'], language: 'vala')
if (clapper_dep.get_variable('features').split().contains('mpris'))
add_project_arguments(['--define=CLAPPER_MPRIS'], language: 'vala')
endif
if clapper_dep.version().version_compare('>=0.8.0')
add_project_arguments(['--define=CLAPPER_0_8'], language: 'vala')
endif
endif
sources = files()
subdir('src')
final_deps = [
dependency('glib-2.0', version: '>=2.76.0'),
dependency('gee-0.8', version: '>=0.8.5'),
dependency('libsoup-3.0'),
dependency('json-glib-1.0', version: '>=1.4.4'),
dependency('libxml-2.0'),
dependency('libsecret-1', required: true),
dependency('icu-uc'),
libspelling,
gtksourceview_dep,
gtk_dep,
libadwaita_dep,
meson.get_compiler('c').find_library('m', required: false),
clapper_dep,
clapper_gtk_dep,
gstreamer_dep
]
executable(
meson.project_name(),
asresources,
sources,
dependencies: final_deps,
install: true,
win_subsystem: 'windows'
)
subdir('tests')
subdir('data')
subdir('po')
# Distributions use their own tooling (e.g. postinst, triggers, etc)
# so it is okay if the post_install() is not run on distro builds
if not distro
# gnome.post_install() is available since meson 0.59.0
if meson.version().version_compare('>=0.59.0')
gnome.post_install(
glib_compile_schemas: true,
gtk_update_icon_cache: true,
update_desktop_database: true,
)
else
meson.add_install_script('build-aux/meson_post_install.py')
endif
endif
if host_machine.system() == 'windows'
configure_file(
input : 'build-aux/dev.geopjr.Tuba.nsi.in',
output : 'dev.geopjr.Tuba.nsi',
configuration : config
)
endif