-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathmeson.build
167 lines (140 loc) · 5.39 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
project(
'font-manager',
['c', 'vala'],
version: '0.9.4',
license: 'GPL-3.0-or-later',
license_files: ['COPYING'],
meson_version: '>= 1.1.0'
)
if meson.version().version_compare('< 1.1.0')
error('Meson version is @0@ but project requires >= 1.1.0'.format(meson.version()))
endif
# There has to be a better way to require a specific vala version, right?
valac = meson.get_compiler('vala')
if not valac.version().version_compare('>= 0.56.3')
error('Vala compiler version is @0@ but project requires >= 0.56.3'.format(valac.version()))
endif
cc = meson.get_compiler('c')
m_dep = cc.find_library('m', required: false)
i18n = import('i18n')
fontconfig = dependency('fontconfig', version: '>= 2.12')
freetype = dependency('freetype2', version: '>= 2.10')
gio = dependency('gio-2.0', version: '>= 2.7')
gio_unix = dependency('gio-unix-2.0', version: '>= 2.7')
glib = dependency('glib-2.0', version: '>= 2.64')
gmodule = dependency('gmodule-2.0', version: '>= 2.50')
gtk = dependency('gtk4', version: '>= 4.12')
harfbuzz = dependency('harfbuzz', version: '>= 2.5')
json = dependency('json-glib-1.0', version: '>= 1.5')
pangoft2 = dependency('pangoft2', version: '>= 1.45')
python = import('python').find_installation('python3')
sqlite = dependency('sqlite3', version: '>= 3.35')
xml = dependency('libxml-2.0', version: '>= 2.9.10')
gnome = import('gnome')
# This dependency cannot be used for vala targets
base_deps = declare_dependency(
dependencies: [ fontconfig, freetype, glib, gmodule, gtk,
harfbuzz, json, m_dep, pangoft2, sqlite, xml ]
)
vala_deps = declare_dependency(
dependencies: [ glib, gio, gio_unix, gmodule, gtk, json, m_dep, sqlite, xml ]
)
if get_option('adwaita')
adwaita = dependency('libadwaita-1')
add_global_arguments('-D', 'HAVE_ADWAITA', language: 'vala')
endif
if get_option('webkit')
soup = dependency('libsoup-3.0', version: '>= 3.2')
webkit = dependency('webkitgtk-6.0', version: '>= 2.4')
add_global_arguments('-D', 'HAVE_WEBKIT', language: 'vala')
endif
if get_option('libarchive')
libarchive = dependency('libarchive', version: '>= 3.7')
add_global_arguments('-D', 'HAVE_LIBARCHIVE', language: 'vala')
endif
includes = [ include_directories('.') ]
config_vapi = files('config.vapi')
prefix = get_option('prefix')
datadir = get_option('datadir')
pkglib_dir = join_paths(prefix, get_option('libdir'), meson.project_name())
pkglibexec_dir = join_paths(prefix, get_option('libexecdir'), meson.project_name())
datetime = '''
from datetime import date
print(date.today())
'''
today = run_command(python, '-c', datetime, check: true).stdout().strip()
config = configuration_data()
config.set('PACKAGE_NAME', meson.project_name())
config.set('PACKAGE_VERSION', meson.project_version())
config.set('CURRENT_DATE', today)
config.set('PACKAGE_URL', 'http://fontmanager.github.io/')
config.set('PACKAGE_BUGREPORT', 'https://github.com/FontManager/master/issues')
config.set('GETTEXT_PACKAGE', meson.project_name())
config.set('PKGLIBEXECDIR', pkglibexec_dir)
config.set('PREFIX', prefix)
config.set('BINDIR', join_paths(prefix, 'bin'))
config.set('LOCALEDIR', join_paths(prefix, datadir, 'locale'))
config.set('SRCDIR', meson.current_build_dir())
config.set('SYSCONFDIR', get_option('sysconfdir'))
configure_file(input: 'config.h.meson', output: 'config.h', configuration: config)
reproducible = get_option('reproducible') ? '-DREPRODUCIBLE' : '-DNOT_REPRODUCIBLE'
add_project_arguments(
'-DG_LOG_DOMAIN="[@0@]"'.format(meson.project_name()),
'-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()),
reproducible,
language: 'c'
)
if get_option('unihan')
add_global_arguments('-DINCLUDE_UNIHAN_DATA=1', language: 'c')
else
add_global_arguments('-DINCLUDE_UNIHAN_DATA=0', language: 'c')
endif
subdir('lib')
subdir('src')
subdir('extensions')
subdir('help')
subdir('data')
if get_option('enable-nls')
subdir('po')
endif
meson.add_dist_script('meson_dist.py')
gnome.post_install(
glib_compile_schemas: true,
gtk_update_icon_cache: true,
update_desktop_database: true,
update_mime_database: true
)
summary(
{
' Font Manager ': get_option('manager'),
' Font Viewer ': get_option('viewer'),
' Help Documents ': get_option('yelp-doc'),
' GNOME search provider ': get_option('search-provider'),
' Use Adwaita stylesheet ': get_option('adwaita'),
' Google Fonts Integration ': get_option('webkit'),
' Compressed files support ': get_option('libarchive'),
' Nautilus extension ': get_option('nautilus'),
' Nemo extension ': get_option('nemo'),
' Thunar extension ': get_option('thunar'),
' Translations ': get_option('enable-nls'),
' Unihan data ' : get_option('unihan'),
' API Documentation ': get_option('gtk-doc'),
' Reproducible build ': get_option('reproducible'),
' AppArmor Profile (unconfined) ' : get_option('app-armor')
},
section: '''Project options
''',
bool_yn: true
)
summary(
{
' prefix ': prefix,
' bindir ': join_paths(prefix, get_option('bindir')),
' libdir ': join_paths(prefix, get_option('libdir'), meson.project_name()),
' libexecdir ': join_paths(prefix, get_option('libexecdir'), meson.project_name()),
' datadir ': join_paths(prefix, datadir),
' sysconfdir ' : join_paths('/', get_option('sysconfdir'))
},
section: '''Directories
'''
)