summaryrefslogtreecommitdiff
path: root/frontends/gtk/Makefile
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2020-09-04 08:26:04 +0100
committerVincent Sanders <vince@kyllikki.org>2020-09-04 08:26:04 +0100
commitb0b271274c98274d4c53608c856194270ae12d0f (patch)
tree15ccb25db78ddef1c2ed225ecc6777fdd0b521c1 /frontends/gtk/Makefile
parent50f5e3f1a655f0ef17e31433873855770d191176 (diff)
downloadnetsurf-b0b271274c98274d4c53608c856194270ae12d0f.tar.gz
netsurf-b0b271274c98274d4c53608c856194270ae12d0f.tar.bz2
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.
Diffstat (limited to 'frontends/gtk/Makefile')
-rw-r--r--frontends/gtk/Makefile10
1 files changed, 9 insertions, 1 deletions
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