| 1 |
# supported versions |
| 2 |
gnome_shell_versions = ['3.28', '3.30', '3.32', '3.34', '3.36', '3.38', '40', '41', '42', '43'] |
| 3 |
|
| 4 |
# gnome-shell version |
| 5 |
gnome_shell = find_program('gnome-shell', required : false) |
| 6 |
|
| 7 |
if get_option('gnome_shell_version') != '' |
| 8 |
gnome_shell_full_ver = get_option('gnome_shell_version') |
| 9 |
elif gnome_shell.found() |
| 10 |
gnome_shell_full_ver = run_command(gnome_shell, '--version', check : true).stdout().split()[-1] |
| 11 |
else |
| 12 |
error('Could not determine GNOME Shell version') |
| 13 |
endif |
| 14 |
|
| 15 |
gnome_shell_ver_array = gnome_shell_full_ver.split('.') |
| 16 |
if gnome_shell_ver_array[0].to_int() < 40 |
| 17 |
if gnome_shell_ver_array[1].to_int().is_even() |
| 18 |
gnome_shell_ver = gnome_shell_ver_array[0] + '.' + gnome_shell_ver_array[1] |
| 19 |
else |
| 20 |
# evenize development versions |
| 21 |
gnome_shell_ver = gnome_shell_ver_array[0] + '.' + (gnome_shell_ver_array[1].to_int() + 1).to_string() |
| 22 |
endif |
| 23 |
else |
| 24 |
gnome_shell_ver = gnome_shell_ver_array[0] |
| 25 |
endif |
| 26 |
|
| 27 |
if gnome_shell_ver not in gnome_shell_versions |
| 28 |
if gnome_shell_ver.version_compare('>' + gnome_shell_versions[-1]) |
| 29 |
warning('GNOME Shell version ' + gnome_shell_ver + ' not supported yet, building theme for ' + gnome_shell_versions[-1]) |
| 30 |
gnome_shell_ver = gnome_shell_versions[-1] |
| 31 |
else |
| 32 |
error('Unsupported GNOME Shell version') |
| 33 |
endif |
| 34 |
endif |
| 35 |
|
| 36 |
# dependency files |
| 37 |
|
| 38 |
sass_depend_files = run_command( |
| 39 |
'find', '-L', |
| 40 |
meson.current_source_dir() / gnome_shell_ver / 'sass', |
| 41 |
'-name', '_*.scss', |
| 42 |
check : true |
| 43 |
).stdout().split() |
| 44 |
|
| 45 |
# compile and install |
| 46 |
|
| 47 |
foreach variant : get_option('variants') |
| 48 |
|
| 49 |
# no darker shell theme |
| 50 |
if variant == 'darker' |
| 51 |
continue |
| 52 |
endif |
| 53 |
|
| 54 |
# lighter shell theme available only for 3.32-3.38 |
| 55 |
if variant == 'lighter' |
| 56 |
if gnome_shell_ver.version_compare('<=3.30') or gnome_shell_ver.version_compare('>=40') |
| 57 |
continue |
| 58 |
endif |
| 59 |
endif |
| 60 |
|
| 61 |
# generate base SCSS file |
| 62 |
input_scss = configure_file( |
| 63 |
input: meson.current_source_dir() / gnome_shell_ver / 'sass' / 'gnome-shell.scss.in', |
| 64 |
output : 'gnome-shell-' + variant + '.scss', |
| 65 |
configuration : { |
| 66 |
'variant' : variant, |
| 67 |
'transparency' : get_option('transparency').to_string(), |
| 68 |
'sass_path' : meson.current_source_dir() / gnome_shell_ver / 'sass', |
| 69 |
} |
| 70 |
) |
| 71 |
|
| 72 |
output_css = (variant == 'light' ? 'gnome-shell.css' : 'gnome-shell-' + variant + '.css') |
| 73 |
|
| 74 |
gnome_shell_css = custom_target( |
| 75 |
output_css, |
| 76 |
input : input_scss, |
| 77 |
output : output_css, |
| 78 |
command : [sassc, sassc_options, '@INPUT@', '@OUTPUT@'], |
| 79 |
build_by_default : true, |
| 80 |
depend_files : sass_depend_files |
| 81 |
) |
| 82 |
|
| 83 |
if get_option('gnome_shell_gresource') |
| 84 |
|
| 85 |
# asset dependencies for gresource |
| 86 |
gresource_depend_files = [] |
| 87 |
gresource_depend_files += [meson.current_source_dir() / gnome_shell_ver / 'pad-osd.css'] |
| 88 |
gresource_depend_files += run_command( |
| 89 |
'find', '-L', |
| 90 |
meson.current_source_dir() / gnome_shell_ver / 'icons', |
| 91 |
meson.current_source_dir() / gnome_shell_ver / 'common-assets', |
| 92 |
meson.current_source_dir() / gnome_shell_ver / variant + '-assets', |
| 93 |
check : true |
| 94 |
).stdout().split() |
| 95 |
|
| 96 |
gresource_name = (variant == 'light' ? 'gnome-shell-theme' : 'gnome-shell-theme-' + variant) |
| 97 |
|
| 98 |
gnome_shell_gresource = custom_target( |
| 99 |
gresource_name + '-gresource', |
| 100 |
input : meson.current_source_dir() / gnome_shell_ver / 'gresource' / gresource_name + '.gresource.xml', |
| 101 |
output : gresource_name + '.gresource', |
| 102 |
command : [ |
| 103 |
glib_compile_resources, |
| 104 |
'--sourcedir=' + meson.current_source_dir() / gnome_shell_ver, |
| 105 |
'--sourcedir=' + meson.current_build_dir(), |
| 106 |
'--target=@OUTPUT@', |
| 107 |
'@INPUT@' |
| 108 |
], |
| 109 |
build_by_default : true, |
| 110 |
install : true, |
| 111 |
install_dir : prefix / install_dir.get(variant) / common_dirs.get('gnome-shell'), |
| 112 |
depends : gnome_shell_css, |
| 113 |
depend_files: gresource_depend_files |
| 114 |
) |
| 115 |
endif |
| 116 |
|
| 117 |
meson.add_install_script( |
| 118 |
install_file, |
| 119 |
gnome_shell_css.full_path(), |
| 120 |
'$MESON_INSTALL_DESTDIR_PREFIX' / install_dir.get(variant) / common_dirs.get('gnome-shell') / 'gnome-shell.css' |
| 121 |
) |
| 122 |
|
| 123 |
install_subdir( |
| 124 |
gnome_shell_ver / 'common-assets', |
| 125 |
install_dir : prefix / install_dir.get(variant) / common_dirs.get('gnome-shell') |
| 126 |
) |
| 127 |
|
| 128 |
install_subdir( |
| 129 |
gnome_shell_ver / variant + '-assets', |
| 130 |
install_dir : prefix / install_dir.get(variant) / common_dirs.get('gnome-shell') |
| 131 |
) |
| 132 |
|
| 133 |
endforeach |