-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
meson.build
119 lines (102 loc) · 3.32 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
project(
'terms',
'rust',
version: '0.1.0',
meson_version: '>= 0.59',
license: 'GPL-3',
)
i18n = import('i18n')
gnome = import('gnome')
application_name = 'Terms'
base_id = 'io.github.vhdirk.' + application_name
application_id = base_id
full_version = '0.1.0'
# Check dependencies
glib_req_version = '2.72'
gtk_req_version = '4.10.0'
gir_req_version = '1.68'
libadwaita_req_version = '1.4.0'
# libpanel_req_version = '1.4'
glib_req = '>= @0@'.format(glib_req_version)
gtk_req = '>= @0@'.format(gtk_req_version)
gir_req = '>= @0@'.format(gir_req_version)
libadwaita_req = '>= @0@'.format(libadwaita_req_version)
# libpanel_req = '>= @0@'.format(libpanel_req_version)
dependency('glib-2.0', version: glib_req)
dependency('gio-2.0', version: glib_req) # always same version as glib
dependency('gtk4', version: gtk_req)
dependency('libadwaita-1', version: libadwaita_req)
# dependency('libpanel-1', version: libpanel_req)
glib_compile_resources = find_program('glib-compile-resources', required: true)
glib_compile_schemas = find_program('glib-compile-schemas', required: true)
desktop_file_validate = find_program('desktop-file-validate', required: false)
appstream_util = find_program('appstream-util', required: false)
cargo = find_program('cargo', required: true)
cargo_version = run_command(cargo, '--version', check: true).stdout().strip()
rustc_version = run_command('rustc', '--version', check: true).stdout().strip()
version = meson.project_version()
prefix = get_option('prefix')
bindir = prefix / get_option('bindir')
localedir = prefix / get_option('localedir')
datadir = prefix / get_option('datadir')
pkgdatadir = datadir / meson.project_name()
iconsdir = datadir / 'icons'
podir = meson.project_source_root() / 'po'
gettext_package = meson.project_name()
if get_option('profile') == 'development'
profile = 'Devel'
application_id += '.Devel'
elif get_option('profile') == 'hack'
profile = 'Devel'
application_id += '.Hack'
elif get_option('profile') == 'beta'
profile = 'Beta'
else
profile = 'Stable'
endif
if profile == 'Devel'
vcs_tag = run_command('git', 'rev-parse', '--short', 'HEAD', check: false).stdout().strip()
if vcs_tag == ''
version_suffix = '-devel'
else
version_suffix = '-@0@'.format(vcs_tag)
endif
application_id = '@0@.@1@'.format(base_id, profile)
else
version_suffix = ''
application_id = base_id
release_date = run_command('git', 'show', '-s', '--format=%cI', check: false).stdout().strip()
endif
full_version += version_suffix
if profile == 'Devel'
# Setup pre-commit hook for ensuring coding style is always consistent
message('Setting up git pre-commit hook..')
run_command('cp', '-f', 'hooks/pre-commit.hook', '.git/hooks/pre-commit', check: false)
endif
meson.add_dist_script(
'build-aux/dist-vendor.sh',
meson.project_build_root() / 'meson-dist' / meson.project_name() + '-' + version,
meson.project_source_root()
)
subdir('data')
subdir('i18n')
subdir('src')
summary({
'prefix': get_option('prefix'),
'libdir': get_option('libdir'),
'datadir': get_option('datadir'),
'bindir': get_option('bindir'),
},
section: 'Directories',
)
summary({
'Profile': get_option('profile'),
'Flatpak': get_option('flatpak'),
},
section: 'Build options',
)
gnome.post_install(
gtk_update_icon_cache: true,
glib_compile_schemas: true,
update_desktop_database: true,
)