diff --git a/gtk/meson.build b/gtk/meson.build index 8d9550019b..1209c38e5a 100644 --- a/gtk/meson.build +++ b/gtk/meson.build @@ -680,9 +680,24 @@ gtk_gresources_xml = configure_file(output: 'gtk.gresources.xml', outfile ]) +# Re-build the theme files if sassc is available +theme_deps = [] +sassc = find_program('sassc', required: false) +if sassc.found() + sassc_opts = [ '-a', '-M', '-t', 'compact' ] + + subdir('theme/Adwaita') + subdir('theme/HighContrast') +endif + gtkresources = gnome.compile_resources('gtkresources', gtk_gresources_xml, - source_dir: meson.current_source_dir(), + dependencies: theme_deps, + source_dir: [ + # List in order of preference + meson.current_build_dir(), + meson.current_source_dir(), + ], c_name: '_gtk', extra_args: '--manual-register') diff --git a/gtk/theme/Adwaita/meson.build b/gtk/theme/Adwaita/meson.build new file mode 100644 index 0000000000..7a799f947d --- /dev/null +++ b/gtk/theme/Adwaita/meson.build @@ -0,0 +1,30 @@ +scss_files = files([ + '_colors-public.scss', + '_colors.scss', + '_common.scss', + '_drawing.scss', +]) + +theme_variants = [ + 'dark', +] + +theme_deps += custom_target('Adwaita', + input: 'gtk-contained.scss', + output: 'gtk-contained.css', + command: [ + sassc, sassc_opts, '@INPUT@', '@OUTPUT@', + ], + depend_files: scss_files, + build_by_default: true) + +foreach variant: theme_variants + theme_deps += custom_target('Adwaita-' + variant, + input: 'gtk-contained-@0@.scss'.format(variant), + output: 'gtk-contained-@0@.css'.format(variant), + command: [ + sassc, sassc_opts, '@INPUT@', '@OUTPUT@', + ], + depend_files: scss_files, + build_by_default: true) +endforeach diff --git a/gtk/theme/HighContrast/meson.build b/gtk/theme/HighContrast/meson.build new file mode 100644 index 0000000000..f3230353ef --- /dev/null +++ b/gtk/theme/HighContrast/meson.build @@ -0,0 +1,29 @@ +scss_files = files([ + '_colors.scss', + '_common.scss', + '_drawing.scss', +]) + +theme_variants = [ + 'inverse', +] + +theme_deps += custom_target('HighContrast', + input: 'gtk-contained.scss', + output: 'gtk-contained.css', + command: [ + sassc, sassc_opts, '@INPUT@', '@OUTPUT@', + ], + depend_files: scss_files, + build_by_default: true) + +foreach variant: theme_variants + theme_deps += custom_target('HighContrast-' + variant, + input: 'gtk-contained-@0@.scss'.format(variant), + output: 'gtk-contained-@0@.css'.format(variant), + command: [ + sassc, sassc_opts, '@INPUT@', '@OUTPUT@', + ], + depend_files: scss_files, + build_by_default: true) +endforeach