From b0b271274c98274d4c53608c856194270ae12d0f Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Fri, 4 Sep 2020 08:26:04 +0100 Subject: Make GTK UI resources more consistent The GTK UI resources have to be different resources between major versions. When kept in one directory with slightly different filenames they were difficult to distinguish and resource definition was difficult to update. The resources for both gtk versions were stored in both builds resulting in unneccessary increased binary size. The new stratagy lists the UI files once in a single gresources file and only includes what is required. If a UI file is added it must be provided in both gtk2 and 3 or a build failure will occour rather than a runtime error. --- frontends/gtk/Makefile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'frontends/gtk/Makefile') diff --git a/frontends/gtk/Makefile b/frontends/gtk/Makefile index e4929e416..3bf3ea063 100644 --- a/frontends/gtk/Makefile +++ b/frontends/gtk/Makefile @@ -103,6 +103,7 @@ GLIB_COMPILE_RESOURCES := glib-compile-resources CFLAGS += -DWITH_GRESOURCE NETSURF_GRESOURCE_XML := $(NSGTK_RESOURCES_DIR)/netsurf.gresource.xml +UI_GRESOURCE_XML := $(NSGTK_RESOURCES_DIR)/ui.gresource.xml MESSAGES_GRESOURCE_XML := $(NSGTK_RESOURCES_DIR)/messages.gresource.xml # generate the netsurf gresource source files @@ -112,6 +113,13 @@ $(OBJROOT)/netsurf_gresource.c: $(NETSURF_GRESOURCE_XML) $(shell $(GLIB_COMPILE_ S_RESOURCE += $(OBJROOT)/netsurf_gresource.c +# generate the ui gresource source files +$(OBJROOT)/ui_gresource.c: $(UI_GRESOURCE_XML) $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir $(NSGTK_RESOURCES_DIR)/gtk$(NETSURF_GTK_MAJOR) --generate-dependencies $(UI_GRESOURCE_XML)) + $(VQ)echo "GRESORCE: $<" + $(Q)$(GLIB_COMPILE_RESOURCES) --generate-source --sourcedir $(NSGTK_RESOURCES_DIR)/gtk$(NETSURF_GTK_MAJOR) --target=$@ $< + +S_RESOURCE += $(OBJROOT)/ui_gresource.c + # generate the messages gresource source file $(OBJROOT)/messages_gresource.c: $(MESSAGES_GRESOURCE_XML) $(addsuffix /Messages,$(addprefix $(MESSAGES_TARGET)/,$(MESSAGES_LANGUAGES))) $(VQ)echo "GRESORCE: $<" @@ -182,7 +190,7 @@ GTK_RESOURCES_LIST := \ GTK_RESOURCES_LIST := \ $(addprefix $(NSGTK_RESOURCES_DIR)/, $(GTK_RESOURCES_LIST)) \ - $(wildcard $(NSGTK_RESOURCES_DIR)/*.gtk$(NETSURF_GTK_MAJOR).ui) + $(wildcard $(NSGTK_RESOURCES_DIR)/gtk$(NETSURF_GTK_MAJOR)/*.ui) # translations with more than just Messages files GTK_TRANSLATIONS_HTML := de en fr it ja nl zh_CN -- cgit v1.2.3