summaryrefslogtreecommitdiff
path: root/gtk/Makefile.target
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2015-06-15 13:36:53 +0100
committerVincent Sanders <vince@kyllikki.org>2015-06-17 21:35:40 +0100
commit3e2270482f73528949746fc24a01d0f0c01baee8 (patch)
tree1d6b4914c6cf8b59aaa0c19ba322e4c56eb2a836 /gtk/Makefile.target
parent59fbd51a77a684c15b189f666e4359bfd820f627 (diff)
downloadnetsurf-3e2270482f73528949746fc24a01d0f0c01baee8.tar.gz
netsurf-3e2270482f73528949746fc24a01d0f0c01baee8.tar.bz2
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.
Diffstat (limited to 'gtk/Makefile.target')
-rw-r--r--gtk/Makefile.target29
1 files changed, 21 insertions, 8 deletions
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 <gdk-pixbuf/gdk-pixdata.h>" > $(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
# ----------------------------------------------------------------------------