From 3e2270482f73528949746fc24a01d0f0c01baee8 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Mon, 15 Jun 2015 13:36:53 +0100 Subject: Make GTK resource handling configurable This makes the GTK resource handling configurable in the same way as all other pkg-config style feature options. It is now possible to completely disable compiled in resources if wanted as well as forcing inline pixdata on if desired. --- gtk/Makefile.target | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'gtk/Makefile.target') diff --git a/gtk/Makefile.target b/gtk/Makefile.target index bbe5d5f54..cc8516264 100644 --- a/gtk/Makefile.target +++ b/gtk/Makefile.target @@ -87,13 +87,20 @@ S_RESOURCE := # Glib prior to 2.32 does not have GResource handling. # # This uses pkg-config to check for the minimum required version for -# this feature. Note we check for gmodule-2.0 which is a specific -# part of glib we require. +# this feature in a way similar to the pkg_config_find_and_add_enabled +# macro. Note we check for gmodule-2.0 which is a specific part of +# glib we require. +# # It would be nice if we could check for this functionality rather # than "knowing" the version but there does not appear to be a simple # way to implement that. -NETSURF_GRESOURCE_AVAILABLE := $(shell $(PKG_CONFIG) --atleast-version=2.32 gmodule-2.0 && echo yes) -ifeq ($(NETSURF_GRESOURCE_AVAILABLE),yes) +# +NETSURF_FEATURE_GRESOURCE_AVAILABLE := $(shell $(PKG_CONFIG) --atleast-version=2.32 gmodule-2.0 && echo yes) +ifneq (,$(filter $(NETSURF_USE_GRESOURCE),AUTO YES)) +ifeq ($(NETSURF_FEATURE_GRESOURCE_AVAILABLE),yes) + +# Gresource use has been enabled +NETSURF_FEATURE_GRESOURCE_ENABLED := yes #resource compiler tool GLIB_COMPILE_RESOURCES := glib-compile-resources @@ -106,10 +113,15 @@ GRESOURCE_XML := $(NSGTK_RESOURCES_DIR)/netsurf.gresource.xml # generate the gresource source file $(OBJROOT)/netsurf_gresource.c: $(GRESOURCE_XML) $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir $(NSGTK_RESOURCES_DIR) --generate-dependencies $(GRESOURCE_XML)) - $(GLIB_COMPILE_RESOURCES) --generate-source --sourcedir $(NSGTK_RESOURCES_DIR) --target=$@ $< + $(VQ)echo "GRESORCE: $<" + $(Q)$(GLIB_COMPILE_RESOURCES) --generate-source --sourcedir $(NSGTK_RESOURCES_DIR) --target=$@ $< + +endif +endif -else -# No GResource available so build pixbufs as inlines instead +# Build pixbufs as inlines if enabled +ifneq (,$(filter $(NETSURF_USE_INLINE_PIXBUF),AUTO YES)) +ifneq ($(NETSURF_FEATURE_GRESOURCE_ENABLED),yes) CFLAGS += -DWITH_BUILTIN_PIXBUF @@ -124,6 +136,7 @@ define convert_image S_RESOURCE += $(2) $(2): $(1) + $(VQ)echo " INLINE: ${3}" $(Q)echo "#include " > $(2) $(Q)gdk-pixbuf-csource --extern --raw --name=$(3) $(1) >> $(2) || \ ( rm -f $(2) && false ) @@ -131,7 +144,7 @@ $(2): $(1) endef $(eval $(foreach V,$(filter GTK_IMAGE_%,$(.VARIABLES)),$(call convert_image,$($(V)),$(OBJROOT)/$(patsubst GTK_IMAGE_%,%,$(V)).c,$(patsubst GTK_IMAGE_%,%,$(V))_pixdata))) - +endif endif # ---------------------------------------------------------------------------- -- cgit v1.2.3