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
|
pkgdatadir = get_option('prefix') / get_option('datadir') / meson.project_name()
bindir = get_option('prefix') / get_option('bindir')
blp = find_program('blueprint-compiler', required: true)
sass = find_program('sass', required: true)
esbuild = find_program('esbuild', required: true)
gjs = find_program('gjs', required: true)
layer_shell = dependency('gtk4-layer-shell-0')
blueprint_sources = files(
'ui/Bar.blp',
)
# transplie blueprints
ui = custom_target(
'blueprint',
input: blueprint_sources,
output: '.',
command: [
blp,
'batch-compile',
'@OUTPUT@',
'@CURRENT_SOURCE_DIR@',
'@INPUT@',
],
)
# bundle ts files
js = custom_target(
'typescript',
input: files('ts/App.ts'),
command: [
esbuild,
'--bundle', '@INPUT@',
'--format=esm',
'--outfile=@OUTPUT@',
'--sourcemap=inline',
'--external:gi://*',
'--external:gettext',
'--external:system',
],
output: 'index.js',
)
# bundle scss files
css = custom_target(
'scss',
input: files('main.scss'),
command: [sass, '@INPUT@', '@OUTPUT@'],
output: 'main.css',
)
# compiling source files into a binary
import('gnome').compile_resources(
'data',
files('gresource.xml'),
dependencies: [ui, css, js],
gresource_bundle: true,
install: true,
install_dir: pkgdatadir,
)
# gresource can't be run with gjs, we still need an entry script
configure_file(
input: files('main.in.js'),
output: 'main.js',
configuration: {
'GJS': gjs.full_path(),
'PKGDATADIR': pkgdatadir,
},
install: true,
install_dir: pkgdatadir,
)
# and we need to wrap the entry script to preload gtk4-layer-shell
configure_file(
input: 'main.in.sh',
output: meson.project_name(),
configuration: {
'LAYER_SHELL_PREFIX': layer_shell.get_variable('prefix'),
'INDEX': pkgdatadir / 'main.js',
},
install: true,
install_dir: bindir,
)
|