[gtk+] meson: Rebuild the SCSS-based themes if sassc is available



commit ee408d5f75756375b8cb62ea742d967764754b20
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Thu Jun 1 14:56:32 2017 +0100

    meson: Rebuild the SCSS-based themes if sassc is available
    
    If we have sassc installed then we want to rebuild the themes that use
    SCSS whenever one of their dependencies change.

 gtk/meson.build                    |   17 ++++++++++++++++-
 gtk/theme/Adwaita/meson.build      |   30 ++++++++++++++++++++++++++++++
 gtk/theme/HighContrast/meson.build |   29 +++++++++++++++++++++++++++++
 3 files changed, 75 insertions(+), 1 deletions(-)
---
diff --git a/gtk/meson.build b/gtk/meson.build
index 8d95500..1209c38 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 0000000..7a799f9
--- /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 0000000..f323035
--- /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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]