From: Emmanuele Bassi Date: Tue, 14 Mar 2017 16:35:58 +0000 (+0000) Subject: Optionally depend on sassc to generate the theme CSS X-Git-Tag: archive/raspbian/3.24.39-1+rpi1~1^2~65^2~39^2~641 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=f82329de3584d35dc99e13a4a3a8415fc2024398;p=gtk%2B3.0.git 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 --- diff --git a/configure.ac b/configure.ac index f038b48550..262bb9676f 100644 --- a/configure.ac +++ b/configure.ac @@ -1815,6 +1815,14 @@ case "$host" in 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 3b76b82db6..c601ad2ede 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -1323,36 +1323,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/Raleigh/gtk-default.css resource_files = $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(builddir)/gtk.gresource.xml)