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
|
|
|
|
NETSURF_FEATURE_NSSVG_CFLAGS := -DWITH_NS_SVG
|
|
|
|
NETSURF_FEATURE_ROSPRITE_CFLAGS := -DWITH_NSSPRITE
|
|
|
|
NETSURF_FEATURE_BMP_CFLAGS := -DWITH_BMP
|
|
|
|
NETSURF_FEATURE_GIF_CFLAGS := -DWITH_GIF
|
|
|
|
NETSURF_FEATURE_PNG_CFLAGS := -DWITH_PNG
|
2012-01-02 01:42:38 +04:00
|
|
|
NETSURF_FEATURE_JS_CFLAGS := -DWITH_JS -DJS_HAS_FILE_OBJECT=0
|
2012-06-28 03:17:18 +04:00
|
|
|
NETSURF_FEATURE_MOZJS_CFLAGS := -DWITH_MOZJS -DJS_HAS_FILE_OBJECT=0
|
2012-08-21 17:17:11 +04:00
|
|
|
NETSURF_FEATURE_VIDEO_CFLAGS := -DWITH_VIDEO
|
2010-10-27 22:39:24 +04:00
|
|
|
|
2012-08-21 17:17:11 +04:00
|
|
|
# add a line similar to below for each optional lib here
|
|
|
|
# note: webp lacks pkg-config file
|
2012-12-13 21:23:47 +04:00
|
|
|
$(eval $(call pkg_config_find_and_add_enabled,PNG,libpng,PNG))
|
2012-12-13 20:31:05 +04:00
|
|
|
$(eval $(call pkg_config_find_and_add_enabled,BMP,libnsbmp,BMP))
|
|
|
|
$(eval $(call pkg_config_find_and_add_enabled,GIF,libnsgif,GIF))
|
|
|
|
$(eval $(call pkg_config_find_and_add_enabled,RSVG,librsvg-2.0,SVG))
|
|
|
|
$(eval $(call pkg_config_find_and_add_enabled,NSSVG,libsvgtiny,SVG))
|
|
|
|
$(eval $(call pkg_config_find_and_add_enabled,ROSPRITE,librosprite,Sprite))
|
|
|
|
$(eval $(call pkg_config_find_and_add_enabled,MOZJS,mozjs185,JavaScript))
|
|
|
|
$(eval $(call pkg_config_find_and_add_enabled,JS,mozilla-js,JavaScript))
|
|
|
|
$(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 \
|
2010-10-27 22:39:24 +04:00
|
|
|
-D_XOPEN_SOURCE=600 \
|
2014-08-17 02:31:55 +04:00
|
|
|
-D_POSIX_C_SOURCE=200809L \
|
2010-10-27 22:39:24 +04:00
|
|
|
-D_NETBSD_SOURCE \
|
2014-09-05 19:01:44 +04:00
|
|
|
-DGTK_RESPATH=\"$(NETSURF_GTK_RESOURCES)\"
|
2012-12-13 21:23:47 +04:00
|
|
|
|
|
|
|
# non optional pkg-configed libs
|
|
|
|
$(eval $(call pkg_config_find_and_add,openssl,OpenSSL))
|
|
|
|
$(eval $(call pkg_config_find_and_add,libcurl,Curl ))
|
|
|
|
$(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
|
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
# The gtk binary target
|
|
|
|
EXETARGET := nsgtk
|
|
|
|
|
|
|
|
# The filter and target for split messages
|
|
|
|
MESSAGES_FILTER=gtk
|
|
|
|
MESSAGES_TARGET=gtk/res
|
|
|
|
|
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 :=
|
|
|
|
|
2015-06-22 01:24:31 +03:00
|
|
|
# Path to GTK resources
|
|
|
|
NSGTK_RESOURCES_DIR := gtk/res
|
|
|
|
|
2015-06-13 13:31:23 +03:00
|
|
|
# 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
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
# S_GTK are sources purely for the GTK build
|
2016-04-24 01:33:37 +03:00
|
|
|
S_GTK := gui.c schedule.c layout_pango.c bitmap.c plotters.c \
|
2011-12-30 04:58:35 +04:00
|
|
|
treeview.c scaffolding.c gdk.c completion.c login.c throbber.c \
|
2014-01-26 03:00:22 +04:00
|
|
|
selection.c history.c window.c fetch.c download.c menu.c \
|
2016-04-24 01:33:37 +03:00
|
|
|
print.c search.c tabs.c toolbar.c gettext.c \
|
2014-08-01 03:58:42 +04:00
|
|
|
compat.c cookies.c hotlist.c viewdata.c viewsource.c \
|
2015-06-05 00:43:11 +03:00
|
|
|
preferences.c about.c ssl_cert.c resources.c
|
2012-05-16 23:57:43 +04:00
|
|
|
|
2016-01-19 18:10:29 +03:00
|
|
|
S_GTK := $(addprefix gtk/,$(S_GTK))
|
2010-10-29 04:54:27 +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
|
2015-06-13 13:31:23 +03:00
|
|
|
SOURCES = $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_RESOURCE) $(S_GTK)
|
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-03-08 18:45:28 +03:00
|
|
|
languages SearchEngines toolbarIndices 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 := \
|
|
|
|
$(addprefix gtk/res/, $(GTK_RESOURCES_LIST)) \
|
|
|
|
$(wildcard gtk/res/*.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
|
|
|
|
2012-08-23 14:46:31 +04:00
|
|
|
install-gtk:
|
2012-11-04 15:17:41 +04:00
|
|
|
$(Q)mkdir -p $(DESTDIR)$(NETSURF_GTK_BIN)
|
2012-11-07 05:32:09 +04:00
|
|
|
$(Q)install nsgtk $(DESTDIR)$(NETSURF_GTK_BIN)netsurf
|
2014-08-19 18:59:51 +04:00
|
|
|
$(Q)mkdir -p $(DESTDIR)$(NETSURF_GTK_RESOURCES)icons
|
2012-11-07 05:32:09 +04:00
|
|
|
$(Q)install -m 0644 gtk/res/icons/*.png $(DESTDIR)$(NETSURF_GTK_RESOURCES)/icons
|
2014-08-19 18:59:51 +04:00
|
|
|
$(Q)mkdir -p $(DESTDIR)$(NETSURF_GTK_RESOURCES)throbber
|
2012-11-07 05:32:09 +04:00
|
|
|
$(Q)install -m 0644 gtk/res/throbber/*.png $(DESTDIR)$(NETSURF_GTK_RESOURCES)/throbber
|
2014-08-19 18:59:51 +04:00
|
|
|
$(Q)tar -c -h -C gtk/res -f - $(GTK_TRANSLATIONS_HTML) | tar -xv -C $(DESTDIR)$(NETSURF_GTK_RESOURCES) -f -
|
|
|
|
$(Q)install -m 0644 $(GTK_RESOURCES_LIST) $(DESTDIR)$(NETSURF_GTK_RESOURCES)
|
2012-08-23 14:46:31 +04:00
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# Package target
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
package-gtk:
|