A fork of the Materia GTK theme.

By using this site, you agree to have cookies stored on your device, strictly for functional purposes, such as storing your session and preferences.

Dismiss

 meson.build

View raw Download
text/plain • 2.45 kiB
ASCII text
        
            
1
gtk4_launch = find_program('gtk4-launch', required: false)
2
3
if get_option('gtk4_version') != ''
4
gtk4_full_version = get_option('gtk4_version')
5
elif gtk4_launch.found()
6
gtk4_full_version = run_command(gtk4_launch, '--version').stdout()
7
else
8
message('gtk4-launch not found, using styles for last gtk4 version availible')
9
gtk4_full_version = '4.0'
10
endif
11
12
gtk4_version_array = gtk4_full_version.split('.')
13
if gtk4_version_array[1].to_int().is_even()
14
gtk4_version = gtk4_version_array[0] + '.' + gtk4_version_array[1]
15
else
16
gtk4_version = gtk4_version_array[0] + '.' + (gtk4_version_array[1].to_int() + 1).to_string()
17
endif
18
message('Set gtk4 version to ' + gtk4_version)
19
20
gtk4_scss_depend_files = files([
21
'../_color-palette.scss',
22
'../_colors.scss',
23
'../_variables.scss',
24
'../gtk-3.0/sass/_colors-public.scss',
25
'sass/_common.scss',
26
'sass/_drawing.scss',
27
])
28
29
foreach theme: themes
30
gtk4_dir = join_paths(theme['dir'], 'gtk-4.0')
31
32
gtk4_variants = [
33
'gtk',
34
]
35
36
# Only non-dark themes need a dark variant.
37
if theme['color'] != '-dark'
38
gtk4_variants += 'gtk-dark'
39
endif
40
41
install_subdir(
42
'../gtk-3.0/assets',
43
install_dir: gtk4_dir,
44
)
45
46
install_subdir(
47
'../gtk-3.0/icons',
48
install_dir: gtk4_dir,
49
)
50
51
#
52
# SCSS
53
#
54
55
gtk4_scss_conf = configuration_data()
56
gtk4_scss_conf.set('dark_theme', theme['scss_dark_theme'])
57
gtk4_scss_conf.set('light_topbar', theme['scss_light_topbar'])
58
gtk4_scss_conf.set('compact', theme['scss_compact'])
59
gtk4_scss_conf.set('version', gtk4_version)
60
gtk4_scss_conf.set('current_source_dir', meson.current_source_dir())
61
62
foreach gtk4_variant: gtk4_variants
63
gtk4_temp_name = '@0@.gtk4.@1@'.format(theme['name'], gtk4_variant)
64
65
# Configure SCSS file
66
gtk4_scss = configure_file(
67
input: '@0@.scss.in'.format(gtk4_variant),
68
output: '@0@.scss'.format(gtk4_temp_name),
69
configuration: gtk4_scss_conf,
70
)
71
72
# Generate CSS file
73
gtk4_css = custom_target(
74
'@0@.css'.format(gtk4_temp_name),
75
input: gtk4_scss,
76
output: '@0@.css'.format(gtk4_temp_name),
77
command: [sass, sass_opts, '@INPUT@', '@OUTPUT@'],
78
depend_files: gtk4_scss_depend_files,
79
build_by_default: true,
80
)
81
82
# Install it while renaming to a valid name
83
meson.add_install_script(
84
sh, '-c', 'cp "@0@" "@1@"'.format(
85
gtk4_css.full_path(),
86
join_paths('$MESON_INSTALL_DESTDIR_PREFIX', gtk4_dir, '@0@.css'.format(gtk4_variant)),
87
),
88
)
89
endforeach
90
endforeach
91