summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2017-03-14 16:35:58 +0000
committerEmmanuele Bassi <ebassi@gnome.org>2017-04-01 15:36:27 +0100
commit99c79d67690dda5fe857c91aac20d0c906d6aa00 (patch)
tree737b24400f5ed994d9bcb9cab6ae7c57e7622153
parentd55249c6f1b4a02876a79280b832c1f2f9627891 (diff)
downloadgtk+-99c79d67690dda5fe857c91aac20d0c906d6aa00.tar.gz
Optionally depend on sassc to generate the theme CSS
Instead of using Ruby/Sass to generate the CSS from SCSS files, we can use the faster and more lightweight libsass/sassc binary. We can keep the CSS files in Git to make it easier to dist GTK+, but we can add rules to ensure they get rebuilt if the source SCSS changes. https://bugzilla.gnome.org/show_bug.cgi?id=780041
-rw-r--r--configure.ac8
-rw-r--r--gtk/Makefile.am57
2 files changed, 49 insertions, 16 deletions
diff --git a/configure.ac b/configure.ac
index 45313193c6..9be280972a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1869,6 +1869,14 @@ esac
AC_SUBST(GDK_HIDDEN_VISIBILITY_CFLAGS)
##################################################
+# Theming
+##################################################
+
+AC_PATH_PROG([SASSC], [sassc])
+AC_ARG_VAR(SASSC)
+AM_CONDITIONAL([REBUILD_SCSS], [test "xSASSC" != x])
+
+##################################################
# Output commands
##################################################
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index e0124e5eed..9adab54393 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -1283,36 +1283,61 @@ gesture_sources = \
gesture/gesture-two-finger-swipe-left-symbolic.svg \
gesture/gesture-two-finger-swipe-right-symbolic.svg
-theme_sources = \
- theme/win32/gtk.css \
- theme/win32/gtk-win32-base.css \
- theme/Adwaita/assets.txt \
- theme/Adwaita/assets.svg \
+adwaita_theme_scss = \
theme/Adwaita/_colors-public.scss \
theme/Adwaita/_colors.scss \
theme/Adwaita/_common.scss \
theme/Adwaita/_drawing.scss \
theme/Adwaita/gtk-contained-dark.scss \
theme/Adwaita/gtk-contained.scss \
- theme/Adwaita/parse-sass.sh \
- theme/Adwaita/render-assets.sh \
- theme/Adwaita/Gemfile \
- theme/Adwaita/README \
- theme/Adwaita/gtk-contained.css \
- theme/Adwaita/gtk-contained-dark.css \
- theme/Adwaita/gtk.css \
- theme/Adwaita/gtk-dark.css \
+ $()
+
+highcontrast_theme_scss = \
theme/HighContrast/_colors.scss \
theme/HighContrast/_common.scss \
theme/HighContrast/_drawing.scss \
theme/HighContrast/gtk-contained-inverse.scss \
theme/HighContrast/gtk-contained.scss \
- theme/HighContrast/Gemfile \
+ $()
+
+if REBUILD_SCSS
+# If we have sassc then we can rebuild the theme CSS as soon as the SCSS
+# files have been changed
+
+scss_verbose = $(scss_verbose_@AM_V@)
+scss_verbose_ = $(scss_verbose_@AM_DEFAULT_V@)
+scss_verbose_0 = @echo " SCSS $@";
+
+theme/Adwaita/gtk-contained.css: $(top_srcdir)/gtk/theme/Adwaita/gtk-contained.scss
+ $(scss_verbose) $(MKDIR_P) $(dir $@) && $(SASSC) -a $< $@ || rm -f $@
+
+theme/Adwaita/gtk-contained-dark.css: $(top_srcdir)/gtk/theme/Adwaita/gtk-contained-dark.scss
+ $(scss_verbose) $(MKDIR_P) $(dir $@) && $(SASSC) -a $< $@ || rm -f $@
+
+theme/HighContrast/gtk-contained.css: $(top_srcdir)/gtk/theme/HighContrast/gtk-contained.scss
+ $(scss_verbose) $(MKDIR_P) $(dir $@) && $(SASSC) -a $< $@ || rm -f $@
+
+theme/HighContrast/gtk-contained-inverse.css: $(top_srcdir)/gtk/theme/HighContrast/gtk-contained-inverse.scss
+ $(scss_verbose) $(MKDIR_P) $(dir $@) && $(SASSC) -a $< $@ || rm -f $@
+
+endif # REBUILD_SCSS
+
+theme_sources = \
+ theme/win32/gtk.css \
+ theme/win32/gtk-win32-base.css \
+ $(adwaita_theme_scss) \
+ theme/Adwaita/assets.txt \
+ theme/Adwaita/assets.svg \
+ theme/Adwaita/README \
+ theme/Adwaita/gtk-contained.css \
+ theme/Adwaita/gtk-contained-dark.css \
+ theme/Adwaita/gtk.css \
+ theme/Adwaita/gtk-dark.css \
+ $(highcontrast_theme_scss) \
theme/HighContrast/gtk-contained.css \
theme/HighContrast/gtk-contained-inverse.css \
theme/HighContrast/gtk.css \
- theme/HighContrast/gtk-inverse.css \
- theme/HighContrast/parse-sass.sh
+ theme/HighContrast/gtk-inverse.css
resource_files = $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(builddir)/gtk.gresource.xml)