-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmeson.build
108 lines (85 loc) · 3.06 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
project('MXL Plyr',
'rust',
version: '3.0.0',
meson_version: '>= 0.59.0',
# license: 'GPL-3.0-or-later'
default_options : ['buildtype=debug',
'rust_std=2021'
]
)
i18n = import('i18n')
gnome = import('gnome')
datadir = get_option('prefix') / get_option('datadir')
iconsdir = datadir / 'icons'
plugins_install_dir = get_option('libdir') / 'gstreamer-1.0'
target_dir = 'target'
base_id = 'com.x-software.mxl'
cargo = find_program('cargo', required: true)
run_command('./scripts/setup-gdkpixbuf.sh', meson.project_build_root() / 'lib', check: true)
run_command('./scripts/setup-gdkpixbuf.sh', meson.project_build_root() / target_dir / 'lib', check: true)
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'
licensesdir = datadir / 'licenses'
package_name_full = 'MXL-Plyr'
message('Build package', package_name_full)
package_name = 'mxl-plyr'
package_id = 'mxl_plyr'
message('Building', package_name_full)
dependency('glib-2.0', version: '>= 2.66')
dependency('gio-2.0', version: '>= 2.66')
dependency('gtk4', version: '>= 4.0.0')
dependency('libadwaita-1', version: '>= 1.0.0')
dependency('gstreamer-1.0', version: '>= 1.0.0')
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)
if host_machine.system() == 'linux'
update_desktop_database = true
gtk_update_icon_cache = true
else
update_desktop_database = false
gtk_update_icon_cache = false
endif
if get_option('profile') == 'development'
gnome.post_install(
glib_compile_schemas: true,
gtk_update_icon_cache: gtk_update_icon_cache,
update_desktop_database: update_desktop_database,
)
endif
podir = meson.current_source_dir() / 'po'
application_id = '@0@.plyr'.format(base_id)
binary_output_file = 'mxl_plyr'
subdir('data' / 'resources')
third_party_license_file = '@0@_third_party_licenses.json'.format(binary_output_file)
run_command('cargo', 'bundle-licenses', '--format', 'json', '--output', third_party_license_file,
check : true)
install_data(third_party_license_file, install_dir: licensesdir)
cargo_options = [ '--manifest-path', meson.current_source_dir() / 'Cargo.toml' ]
cargo_options += [ '--target-dir', meson.project_build_root() / target_dir ]
if get_option('buildtype') == 'release'
cargo_options += [ '--release' ]
rust_target = 'release'
message('Building in release mode')
else
rust_target = 'debug'
message('Building in debug mode')
endif
cargo_build = custom_target(
'cargo-build',
build_by_default: true,
build_always_stale: true,
output: binary_output_file,
console: true,
install: true,
install_dir: bindir,
command: [
cargo, 'build',
cargo_options,
'&&', 'cp', target_dir / rust_target / binary_output_file, '@OUTPUT@',
]
)