2012-08-23 14:46:31 +04:00
|
|
|
#
|
|
|
|
# Makefile for NetSurf GTK target
|
|
|
|
#
|
|
|
|
# This file is part of NetSurf
|
|
|
|
#
|
2010-10-27 22:39:24 +04:00
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# GTK flag setup (using pkg-config)
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
|
2011-09-16 15:09:58 +04:00
|
|
|
# define additional CFLAGS and LDFLAGS requirements for pkg-configed libs here
|
|
|
|
NETSURF_FEATURE_RSVG_CFLAGS := -DWITH_RSVG
|
2012-08-21 17:17:11 +04:00
|
|
|
NETSURF_FEATURE_VIDEO_CFLAGS := -DWITH_VIDEO
|
2010-10-27 22:39:24 +04:00
|
|
|
|
2012-12-13 20:31:05 +04:00
|
|
|
$(eval $(call pkg_config_find_and_add_enabled,RSVG,librsvg-2.0,SVG))
|
|
|
|
$(eval $(call pkg_config_find_and_add_enabled,VIDEO,gstreamer-0.10,Video))
|
2010-10-27 22:39:24 +04:00
|
|
|
|
2011-09-16 15:09:58 +04:00
|
|
|
# GTK and GLIB flags to disable depricated usage
|
|
|
|
GTKDEPFLAGS := -DG_DISABLE_SINGLE_INCLUDES \
|
|
|
|
-DG_DISABLE_DEPRECATED \
|
|
|
|
-DGTK_DISABLE_SINGLE_INCLUDES \
|
2011-09-17 18:58:42 +04:00
|
|
|
-DGTK_MULTIHEAD_SAFE \
|
2014-12-21 05:01:45 +03:00
|
|
|
-DPANGO_DISABLE_DEPRECATED
|
|
|
|
|
|
|
|
# later editions of gtk 2 deprecate interfaces we rely upon for cursors
|
|
|
|
# -DGDK_PIXBUF_DISABLE_DEPRECATED
|
2011-09-17 18:58:42 +04:00
|
|
|
|
|
|
|
# libsexy currently means we cannot enable this
|
|
|
|
# -DGDK_DISABLE_DEPRECATED
|
2010-10-27 22:39:24 +04:00
|
|
|
|
2015-04-09 00:21:30 +03:00
|
|
|
# gtk3 is depricating interfaces we use a lot
|
|
|
|
ifeq ($(NETSURF_GTK_MAJOR),2)
|
|
|
|
GTKDEPFLAGS += -DGTK_DISABLE_DEPRECATED
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2014-09-05 19:01:44 +04:00
|
|
|
GTKCFLAGS := -std=c99 -Dgtk -Dnsgtk -g \
|
2011-09-16 15:09:58 +04:00
|
|
|
$(GTKDEPFLAGS) \
|
2010-10-27 22:39:24 +04:00
|
|
|
-D_BSD_SOURCE \
|
2015-03-28 21:15:27 +03:00
|
|
|
-D_DEFAULT_SOURCE \
|
2018-09-06 14:10:38 +03:00
|
|
|
-D_XOPEN_SOURCE=700 \
|
2014-08-17 02:31:55 +04:00
|
|
|
-D_POSIX_C_SOURCE=200809L \
|
2010-10-27 22:39:24 +04:00
|
|
|
-D_NETBSD_SOURCE \
|
2016-10-05 21:44:49 +03:00
|
|
|
-DGTK_RESPATH=\"$(NETSURF_GTK_RES_PATH)\"
|
2012-12-13 21:23:47 +04:00
|
|
|
|
|
|
|
# non optional pkg-configed libs
|
|
|
|
$(eval $(call pkg_config_find_and_add,gtk+-$(NETSURF_GTK_MAJOR).0,GTK-$(NETSURF_GTK_MAJOR)))
|
|
|
|
$(eval $(call pkg_config_find_and_add,gthread-2.0,GThread2))
|
|
|
|
$(eval $(call pkg_config_find_and_add,gmodule-2.0,GModule2))
|
2010-10-27 22:39:24 +04:00
|
|
|
|
2015-06-13 13:31:23 +03:00
|
|
|
|
2011-09-16 15:09:58 +04:00
|
|
|
CFLAGS += $(GTKCFLAGS)
|
2012-12-13 21:23:47 +04:00
|
|
|
LDFLAGS += -lm
|
2010-10-27 22:39:24 +04:00
|
|
|
|
2015-06-22 01:24:31 +03:00
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
# Target setup
|
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
2016-05-06 00:28:51 +03:00
|
|
|
# Path to GTK resources
|
|
|
|
NSGTK_RESOURCES_DIR := $(FRONTEND_RESOURCES_DIR)
|
|
|
|
|
2016-10-05 21:44:49 +03:00
|
|
|
# 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
|
2015-06-22 01:24:31 +03:00
|
|
|
|
|
|
|
# The filter and target for split messages
|
|
|
|
MESSAGES_FILTER=gtk
|
2016-05-06 00:28:51 +03:00
|
|
|
MESSAGES_TARGET=$(NSGTK_RESOURCES_DIR)
|
2015-06-22 01:24:31 +03:00
|
|
|
|
2011-09-16 15:09:58 +04:00
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
# Windows flag setup
|
|
|
|
# ---------------------------------------------------------------------------
|
2010-10-27 22:39:24 +04:00
|
|
|
|
2011-09-16 15:09:58 +04:00
|
|
|
ifeq ($(HOST),Windows_NT)
|
2010-10-27 22:39:24 +04:00
|
|
|
CFLAGS += -U__STRICT_ANSI__
|
2011-09-16 15:09:58 +04:00
|
|
|
endif
|
2010-10-27 22:39:24 +04:00
|
|
|
|
2015-06-13 13:31:23 +03:00
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# Builtin resource handling
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
# builtin resource sources
|
|
|
|
S_RESOURCE :=
|
|
|
|
|
|
|
|
# Glib prior to 2.32 does not have GResource handling.
|
|
|
|
#
|
|
|
|
# This uses pkg-config to check for the minimum required version for
|
2015-06-15 15:36:53 +03:00
|
|
|
# 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.
|
|
|
|
#
|
2015-06-13 13:31:23 +03:00
|
|
|
# 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.
|
2015-06-15 15:36:53 +03:00
|
|
|
#
|
|
|
|
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
|
2015-06-13 13:31:23 +03:00
|
|
|
|
2015-06-15 02:45:49 +03:00
|
|
|
#resource compiler tool
|
2015-06-13 13:31:23 +03:00
|
|
|
GLIB_COMPILE_RESOURCES := glib-compile-resources
|
|
|
|
CFLAGS += -DWITH_GRESOURCE
|
|
|
|
|
2015-06-22 01:24:31 +03:00
|
|
|
NETSURF_GRESOURCE_XML := $(NSGTK_RESOURCES_DIR)/netsurf.gresource.xml
|
|
|
|
MESSAGES_GRESOURCE_XML := $(NSGTK_RESOURCES_DIR)/messages.gresource.xml
|
2015-06-13 13:31:23 +03:00
|
|
|
|
2015-06-22 01:24:31 +03:00
|
|
|
# generate the netsurf gresource source files
|
|
|
|
$(OBJROOT)/netsurf_gresource.c: $(NETSURF_GRESOURCE_XML) $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir $(NSGTK_RESOURCES_DIR) --generate-dependencies $(NETSURF_GRESOURCE_XML))
|
|
|
|
$(VQ)echo "GRESORCE: $<"
|
|
|
|
$(Q)$(GLIB_COMPILE_RESOURCES) --generate-source --sourcedir $(NSGTK_RESOURCES_DIR) --target=$@ $<
|
|
|
|
|
|
|
|
S_RESOURCE += $(OBJROOT)/netsurf_gresource.c
|
2015-06-13 13:31:23 +03:00
|
|
|
|
2015-06-22 01:24:31 +03:00
|
|
|
# generate the messages gresource source file
|
|
|
|
$(OBJROOT)/messages_gresource.c: $(MESSAGES_GRESOURCE_XML) $(addsuffix /Messages,$(addprefix $(MESSAGES_TARGET)/,$(MESSAGES_LANGUAGES)))
|
2015-06-15 15:36:53 +03:00
|
|
|
$(VQ)echo "GRESORCE: $<"
|
|
|
|
$(Q)$(GLIB_COMPILE_RESOURCES) --generate-source --sourcedir $(NSGTK_RESOURCES_DIR) --target=$@ $<
|
|
|
|
|
2015-06-22 01:24:31 +03:00
|
|
|
S_RESOURCE += $(OBJROOT)/messages_gresource.c
|
|
|
|
|
|
|
|
|
2015-06-15 15:36:53 +03:00
|
|
|
endif
|
|
|
|
endif
|
2015-06-13 13:31:23 +03:00
|
|
|
|
2015-06-15 15:36:53 +03:00
|
|
|
# Build pixbufs as inlines if enabled
|
|
|
|
ifneq (,$(filter $(NETSURF_USE_INLINE_PIXBUF),AUTO YES))
|
|
|
|
ifneq ($(NETSURF_FEATURE_GRESOURCE_ENABLED),yes)
|
2012-05-16 23:57:43 +04:00
|
|
|
|
2015-06-15 02:45:49 +03:00
|
|
|
CFLAGS += -DWITH_BUILTIN_PIXBUF
|
2012-05-16 23:57:43 +04:00
|
|
|
|
2015-06-22 01:24:31 +03:00
|
|
|
GTK_IMAGE_favicon := favicon.png
|
|
|
|
GTK_IMAGE_netsurf := netsurf.xpm
|
|
|
|
GTK_IMAGE_menu_cursor := menu_cursor.png
|
2012-05-16 23:57:43 +04:00
|
|
|
|
|
|
|
# 1: input file
|
|
|
|
# 2: output file
|
|
|
|
# 3: bitmap name
|
|
|
|
define convert_image
|
|
|
|
|
2015-06-13 13:31:23 +03:00
|
|
|
# add converted pixbuf to builtin resource sources
|
|
|
|
S_RESOURCE += $(2)
|
2012-05-16 23:57:43 +04:00
|
|
|
|
|
|
|
$(2): $(1)
|
2015-06-15 15:36:53 +03:00
|
|
|
$(VQ)echo " INLINE: ${3}"
|
2012-05-16 23:57:43 +04:00
|
|
|
$(Q)echo "#include <gdk-pixbuf/gdk-pixdata.h>" > $(2)
|
2015-05-20 18:43:48 +03:00
|
|
|
$(Q)gdk-pixbuf-csource --extern --raw --name=$(3) $(1) >> $(2) || \
|
2012-05-16 23:57:43 +04:00
|
|
|
( rm -f $(2) && false )
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
2015-06-22 01:24:31 +03:00
|
|
|
$(eval $(foreach V,$(filter GTK_IMAGE_%,$(.VARIABLES)),$(call convert_image,$(addprefix $(NSGTK_RESOURCES_DIR)/,$($(V))),$(OBJROOT)/$(patsubst GTK_IMAGE_%,%,$(V)).c,$(patsubst GTK_IMAGE_%,%,$(V))_pixdata)))
|
2015-06-15 15:36:53 +03:00
|
|
|
endif
|
2015-06-15 02:45:49 +03:00
|
|
|
endif
|
|
|
|
|
2010-10-29 04:54:27 +04:00
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# Source file setup
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
|
2016-05-06 00:28:51 +03:00
|
|
|
# S_FRONTEND are sources purely for the GTK frontend
|
|
|
|
S_FRONTEND := gui.c schedule.c layout_pango.c bitmap.c plotters.c \
|
2019-08-13 14:09:21 +03:00
|
|
|
scaffolding.c gdk.c completion.c throbber.c accelerator.c \
|
2017-02-17 01:15:49 +03:00
|
|
|
selection.c window.c fetch.c download.c menu.c print.c \
|
|
|
|
search.c tabs.c toolbar.c gettext.c compat.c viewdata.c \
|
|
|
|
viewsource.c preferences.c about.c resources.c corewindow.c \
|
|
|
|
local_history.c global_history.c cookies.c hotlist.c ssl_cert.c
|
2012-05-16 23:57:43 +04:00
|
|
|
|
2011-08-28 18:29:15 +04:00
|
|
|
# This is the final source build list
|
|
|
|
# Note this is deliberately *not* expanded here as common and image
|
|
|
|
# are not yet available
|
2016-05-06 00:28:51 +03:00
|
|
|
SOURCES = $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_RESOURCE) $(S_FRONTEND)
|
2015-04-07 02:08:14 +03:00
|
|
|
|
2012-08-23 14:46:31 +04:00
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# Install target
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
|
2014-08-19 18:59:51 +04:00
|
|
|
GTK_RESOURCES_LIST := \
|
2016-05-20 17:23:05 +03:00
|
|
|
languages SearchEngines ca-bundle.txt \
|
2015-06-22 16:24:51 +03:00
|
|
|
default.css adblock.css quirks.css internal.css \
|
2014-10-22 23:39:43 +04:00
|
|
|
credits.html licence.html welcome.html maps.html Messages \
|
2014-08-19 18:59:51 +04:00
|
|
|
default.ico favicon.png netsurf.png netsurf.xpm netsurf-16x16.xpm \
|
|
|
|
arrow_down_8x32.png
|
|
|
|
|
|
|
|
GTK_RESOURCES_LIST := \
|
2016-05-06 00:28:51 +03:00
|
|
|
$(addprefix $(NSGTK_RESOURCES_DIR)/, $(GTK_RESOURCES_LIST)) \
|
|
|
|
$(wildcard $(NSGTK_RESOURCES_DIR)/*.gtk$(NETSURF_GTK_MAJOR).ui)
|
2012-11-04 15:17:41 +04:00
|
|
|
|
|
|
|
# translations with more than just Messages files
|
2013-04-29 01:06:30 +04:00
|
|
|
GTK_TRANSLATIONS_HTML := de en fr it ja nl
|
2012-11-04 15:17:41 +04:00
|
|
|
|
2016-10-05 21:44:49 +03:00
|
|
|
# destination for installed resources is the first entry in the gtk resource path
|
|
|
|
NSGTK_RESOURCES_DESTDIR := $(DESTDIR)$(word 1,$(subst :, ,$(NETSURF_GTK_RES_PATH)))
|
|
|
|
|
2012-08-23 14:46:31 +04:00
|
|
|
install-gtk:
|
2017-01-07 16:21:25 +03:00
|
|
|
$(Q)$(MKDIR) -p $(DESTDIR)$(NETSURF_GTK_BIN)
|
2016-10-05 21:44:49 +03:00
|
|
|
$(Q)install $(EXETARGET) $(DESTDIR)$(NETSURF_GTK_BIN)netsurf-gtk$(SUBTARGET)
|
2017-01-07 16:21:25 +03:00
|
|
|
$(Q)$(MKDIR) -p $(NSGTK_RESOURCES_DESTDIR)/icons
|
2016-10-05 21:44:49 +03:00
|
|
|
$(Q)install -m 0644 $(NSGTK_RESOURCES_DIR)/icons/*.png $(NSGTK_RESOURCES_DESTDIR)/icons
|
2017-01-07 16:21:25 +03:00
|
|
|
$(Q)$(MKDIR) -p $(NSGTK_RESOURCES_DESTDIR)/throbber
|
2016-10-05 21:44:49 +03:00
|
|
|
$(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)
|
2012-08-23 14:46:31 +04:00
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# Package target
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
package-gtk:
|