From 1de0ebf2e50603859ec18cfd94472b3041d381e8 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 5 Oct 2016 19:44:49 +0100 Subject: fix gtk install target to cope with gtk3 --- Docs/PACKAGING-GTK | 27 +++++++++++++++++++-------- Makefile | 23 ++++++++++++++++++++--- frontends/framebuffer/Makefile | 2 +- frontends/gtk/Makefile | 29 +++++++++++++++++++---------- frontends/gtk/Makefile.defaults | 2 +- 5 files changed, 60 insertions(+), 23 deletions(-) diff --git a/Docs/PACKAGING-GTK b/Docs/PACKAGING-GTK index 67e63b231..8f675229f 100644 --- a/Docs/PACKAGING-GTK +++ b/Docs/PACKAGING-GTK @@ -39,19 +39,30 @@ gtk/res/ (dereferencing the symlinks, obviously) to /usr/share/netsurf (or wherever your packaging policy suggests). - You will need to tell NetSurf where to find its resources. NetSurf searches - three locations by default when trying to load them, in this order: + You will need to tell NetSurf where to find its run time loaded + resources. NetSurf searches three locations by default when trying + to load them, in this order: 1. ~/.netsurf/ + + This entry allows the user some flexibility in changing what + resources NetSurf uses by placing resources in their home + directory. + 2. $NETSURFRES/ - 3. /usr/share/netsurf/ - The second one is how the netsurf launcher script controls it. The third - location is controlled by the NETSURF_GTK_RESOURCES option in - Makefile.config, and this is the recommended way for packagers to change - the location it searches, as this still allows the user some flexibility in - changing what NetSurf uses. + This entry allows the user or packager to control resource + aquisition through the environment. This entry is how the + developer launcher script controls resource location. + + 3. NETSURF_GTK_RES_PATH option + This location is controlled by the option in Makefile.config + (defaulting to ${PREFIX}/share/netsurf/ ). This configuration + is the recommended way for packagers to change the location + NetSurf finds external resources. The first path element of the + NETSURF_GTK_RES_PATH option is used in the install target as + the destination for installed resources. User agent string =================== diff --git a/Makefile b/Makefile index 9a9f4b3d6..c5c374ba1 100644 --- a/Makefile +++ b/Makefile @@ -117,7 +117,7 @@ ifeq ($(TARGET),) endif # valid values for the TARGET -VLDTARGET := riscos gtk beos amiga amigaos3 framebuffer windows atari cocoa monkey +VLDTARGET := riscos gtk gtk3 beos amiga amigaos3 framebuffer windows atari cocoa monkey # Check for valid TARGET ifeq ($(filter $(VLDTARGET),$(TARGET)),) @@ -287,7 +287,7 @@ else CXX := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*g++) endif else - ifeq ($(findstring framebuffer,$(TARGET)),framebuffer) + ifeq ($(TARGET),framebuffer) ifeq ($(origin GCCSDK_INSTALL_ENV),undefined) PKG_CONFIG := pkg-config else @@ -299,8 +299,25 @@ else CXX := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*g++) endif else - # All native targets (GTK) + # All native targets PKG_CONFIG := pkg-config + + # gtk target processing + ifeq ($(TARGET),gtk3) + override TARGET := gtk + override NETSURF_GTK_MAJOR := 3 + SUBTARGET = $(NETSURF_GTK_MAJOR) + else + ifeq ($(TARGET),gtk) + ifeq ($(origin NETSURF_GTK_MAJOR),undefined) + override NETSURF_GTK_MAJOR := 2 + else + ifneq ($(NETSURF_GTK_MAJOR),2) + SUBTARGET = $(NETSURF_GTK_MAJOR) + endif + endif + endif + endif endif endif endif diff --git a/frontends/framebuffer/Makefile b/frontends/framebuffer/Makefile index 7eb1f14dd..3d47f8f47 100644 --- a/frontends/framebuffer/Makefile +++ b/frontends/framebuffer/Makefile @@ -173,7 +173,7 @@ NETSURF_FRAMEBUFFER_RESOURCE_LIST := adblock.css credits.html \ install-framebuffer: $(Q)mkdir -p $(DESTDIR)$(NETSURF_FRAMEBUFFER_BIN) $(Q)mkdir -p $(DESTDIR)$(NETSURF_FRAMEBUFFER_RESOURCES) - $(Q)cp -v $(EXETARGET) $(DESTDIR)/$(NETSURF_FRAMEBUFFER_BIN)netsurf$(SUBTARGET) + $(Q)cp -v $(EXETARGET) $(DESTDIR)/$(NETSURF_FRAMEBUFFER_BIN)netsurf-fb $(Q)for F in $(NETSURF_FRAMEBUFFER_RESOURCE_LIST); do cp -vL $(FRONTEND_RESOURCES_DIR)/$$F $(DESTDIR)/$(NETSURF_FRAMEBUFFER_RESOURCES); done $(Q)$(SPLIT_MESSAGES) -l en -p fb -f messages resources/FatMessages | gzip -9n > $(DESTDIR)$(NETSURF_FRAMEBUFFER_RESOURCES)messages diff --git a/frontends/gtk/Makefile b/frontends/gtk/Makefile index f9273f1db..76ef9982c 100644 --- a/frontends/gtk/Makefile +++ b/frontends/gtk/Makefile @@ -40,7 +40,7 @@ GTKCFLAGS := -std=c99 -Dgtk -Dnsgtk -g \ -D_XOPEN_SOURCE=600 \ -D_POSIX_C_SOURCE=200809L \ -D_NETBSD_SOURCE \ - -DGTK_RESPATH=\"$(NETSURF_GTK_RESOURCES)\" + -DGTK_RESPATH=\"$(NETSURF_GTK_RES_PATH)\" # non optional pkg-configed libs $(eval $(call pkg_config_find_and_add,gtk+-$(NETSURF_GTK_MAJOR).0,GTK-$(NETSURF_GTK_MAJOR))) @@ -58,8 +58,14 @@ LDFLAGS += -lm # Path to GTK resources NSGTK_RESOURCES_DIR := $(FRONTEND_RESOURCES_DIR) -# The gtk binary target -EXETARGET := nsgtk +# The gtk binary target. +ifeq ($(NETSURF_GTK_MAJOR),2) + # gtk2 builds have no major suffix + EXETARGET := nsgtk +else + # gtk3 and later builds use the major version suffix + EXETARGET := nsgtk$(NETSURF_GTK_MAJOR) +endif # The filter and target for split messages MESSAGES_FILTER=gtk @@ -188,15 +194,18 @@ GTK_RESOURCES_LIST := \ # translations with more than just Messages files GTK_TRANSLATIONS_HTML := de en fr it ja nl +# destination for installed resources is the first entry in the gtk resource path +NSGTK_RESOURCES_DESTDIR := $(DESTDIR)$(word 1,$(subst :, ,$(NETSURF_GTK_RES_PATH))) + install-gtk: $(Q)mkdir -p $(DESTDIR)$(NETSURF_GTK_BIN) - $(Q)install nsgtk $(DESTDIR)$(NETSURF_GTK_BIN)netsurf - $(Q)mkdir -p $(DESTDIR)$(NETSURF_GTK_RESOURCES)icons - $(Q)install -m 0644 $(NSGTK_RESOURCES_DIR)/icons/*.png $(DESTDIR)$(NETSURF_GTK_RESOURCES)/icons - $(Q)mkdir -p $(DESTDIR)$(NETSURF_GTK_RESOURCES)throbber - $(Q)install -m 0644 $(NSGTK_RESOURCES_DIR)/throbber/*.png $(DESTDIR)$(NETSURF_GTK_RESOURCES)/throbber - $(Q)tar -c -h -C $(NSGTK_RESOURCES_DIR) -f - $(GTK_TRANSLATIONS_HTML) | tar -xv -C $(DESTDIR)$(NETSURF_GTK_RESOURCES) -f - - $(Q)install -m 0644 $(GTK_RESOURCES_LIST) $(DESTDIR)$(NETSURF_GTK_RESOURCES) + $(Q)install $(EXETARGET) $(DESTDIR)$(NETSURF_GTK_BIN)netsurf-gtk$(SUBTARGET) + $(Q)mkdir -p $(NSGTK_RESOURCES_DESTDIR)/icons + $(Q)install -m 0644 $(NSGTK_RESOURCES_DIR)/icons/*.png $(NSGTK_RESOURCES_DESTDIR)/icons + $(Q)mkdir -p $(NSGTK_RESOURCES_DESTDIR)/throbber + $(Q)install -m 0644 $(NSGTK_RESOURCES_DIR)/throbber/*.png $(NSGTK_RESOURCES_DESTDIR)/throbber + $(Q)tar -c -h -C $(NSGTK_RESOURCES_DIR) -f - $(GTK_TRANSLATIONS_HTML) | tar -xv -C $(NSGTK_RESOURCES_DESTDIR) -f - + $(Q)install -m 0644 $(GTK_RESOURCES_LIST) $(NSGTK_RESOURCES_DESTDIR) # ---------------------------------------------------------------------------- # Package target diff --git a/frontends/gtk/Makefile.defaults b/frontends/gtk/Makefile.defaults index fc352a020..a98043eb9 100644 --- a/frontends/gtk/Makefile.defaults +++ b/frontends/gtk/Makefile.defaults @@ -4,7 +4,7 @@ # Where to search for NetSurf's resources after looking in ~/.netsurf and # $NETSURFRES. It must have a trailing / -NETSURF_GTK_RESOURCES := $(PREFIX)/share/netsurf/:./frontends/gtk/res/ +NETSURF_GTK_RES_PATH := $(PREFIX)/share/netsurf/:./frontends/gtk/res/ # Where to install the netsurf binary NETSURF_GTK_BIN := $(PREFIX)/bin/ -- cgit v1.2.3