summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile95
-rw-r--r--Makefile.config55
-rw-r--r--gtk/dialogs/gtk_options.c1
-rw-r--r--gtk/gtk_gui.c5
-rw-r--r--riscos/filetype.c3
-rw-r--r--riscos/window.c6
-rw-r--r--utils/config.h12
7 files changed, 131 insertions, 46 deletions
diff --git a/Makefile b/Makefile
index 5f1cbd34c..ccaa72004 100644
--- a/Makefile
+++ b/Makefile
@@ -138,33 +138,61 @@ endif
OBJROOT := build-$(HOST)-$(TARGET)$(SUBTARGET)
+# ----------------------------------------------------------------------------
+# General flag setup
+# ----------------------------------------------------------------------------
+
include Makefile.config
+# 1: Feature name (ie, NETSURF_USE_BMP -> BMP)
+# 2: Parameters to add to CFLAGS
+# 3: Parameters to add to LDFLAGS
+define feature_enabled
+ ifeq ($$(NETSURF_USE_$(1)),YES)
+ CFLAGS += $(2)
+ LDFLAGS += $(3)
+ endif
+endef
+
+$(eval $(call feature_enabled,BMP,-DWITH_BMP,))
+$(eval $(call feature_enabled,GIF,-DWITH_GIF,))
+$(eval $(call feature_enabled,JPEG,-DWITH_JPEG,-ljpeg))
+$(eval $(call feature_enabled,MNG,-DWITH_MNG,-lmng))
+
+$(eval $(call feature_enabled,HARU_PDF,-DWITH_PDF_EXPORT,-lhpdf -lpng))
+
+# common libraries without pkg-config support
+LDFLAGS += -lz
+
+# ----------------------------------------------------------------------------
+# RISC OS host flag setup
+# ----------------------------------------------------------------------------
+
ifeq ($(HOST),riscos)
-LDFLAGS := -Xlinker -symbols=$(OBJROOT)/sym -lxml2 -lz -lm -lcurl -lssl -lcrypto -lmng -ljpeg \
- -lcares
-else
+LDFLAGS := -Xlinker -symbols=$(OBJROOT)/sym -lxml2 -lz -lm -lcurl -lssl \
+ -lcrypto -lcares
+
+$(eval $(call feature_enabled,NSSVG,-DWITH_NS_SVG,-lsvgtiny))
+$(eval $(call feature_enabled,DRAW,-DWITH_DRAW,-lpencil))
+$(eval $(call feature_enabled,SPRITE,-DWITH_SPRITE,))
+$(eval $(call feature_enabled,ARTWORKS,-DWITH_ARTWORKS,))
+endif
+
+# ----------------------------------------------------------------------------
+# BeOS flag setup
+# ----------------------------------------------------------------------------
+
ifeq ($(HOST),beos)
-# some people do *not* have libm...
LDFLAGS := -L/boot/home/config/lib
-LDFLAGS += -lxml2 -lz -lcurl -lssl -lcrypto -ljpeg -liconv
-LDFLAGS += -lmng -ljpeg
-else
-LDFLAGS := $(shell $(PKG_CONFIG) --libs libxml-2.0 libcurl openssl)
-endif
-# Common libraries without pkgconfig support:
-LDFLAGS += -lz -lm -lmng -ljpeg
-ifeq ($(NETSURF_USE_HARU_PDF),YES)
-LDFLAGS += -lhpdf -lpng
-CFLAGS += -DWITH_PDF_EXPORT
-endif
+LDFLAGS += -lxml2 -lz -lcurl -lssl -lcrypto -liconv
endif
-ifeq ($(TARGET),gtk)
-# Building for GTK, we need the GTK flags
+# ----------------------------------------------------------------------------
+# GTK flag setup (using pkg-config)
+# ----------------------------------------------------------------------------
-FEATURE_CFLAGS :=
-FEATURE_LDFLAGS :=
+ifeq ($(TARGET),gtk)
+LDFLAGS := $(shell $(PKG_CONFIG) --libs libxml-2.0 libcurl openssl)
# 1: Feature name (ie, NETSURF_USE_RSVG -> RSVG)
# 2: pkg-config required modules for feature
@@ -180,8 +208,8 @@ define pkg_config_find_and_add
endif
ifeq ($$(NETSURF_USE_$(1)),YES)
ifeq ($$(NETSURF_FEATURE_$(1)_AVAILABLE),yes)
- FEATURE_CFLAGS += $$(shell pkg-config --cflags $(2)) $$(NETSURF_FEATURE_$(1)_CFLAGS)
- FEATURE_LDFLAGS += $$(shell pkg-config --libs $(2)) $$(NETSURF_FEATURE_$(1)_LDFLAGS)
+ CFLAGS += $$(shell pkg-config --cflags $(2)) $$(NETSURF_FEATURE_$(1)_CFLAGS)
+ LDFLAGS += $$(shell pkg-config --libs $(2)) $$(NETSURF_FEATURE_$(1)_LDFLAGS)
$$(info AUTOCONF: auto-enabled $(3) ($(2)).)
else
$$(error Unable to find library for: $$(3) ($(2))
@@ -205,23 +233,30 @@ GTKCFLAGS := -std=c99 -Dgtk -Dnsgtk \
-D_XOPEN_SOURCE=600 \
-D_POSIX_C_SOURCE=200112L \
-D_NETBSD_SOURCE \
+ -DGTK_RESPATH=\"$(NETSURF_GTK_RESOURCES)\" \
$(WARNFLAGS) -I. -g $(OPT2FLAGS) \
$(shell $(PKG_CONFIG) --cflags libglade-2.0 gtk+-2.0) \
$(shell xml2-config --cflags)
-GTKCFLAGS += $(FEATURE_CFLAGS)
GTKLDFLAGS := $(shell $(PKG_CONFIG) --cflags --libs libglade-2.0 gtk+-2.0 gthread-2.0 gmodule-2.0 lcms)
-GTKLDFLAGS += $(FEATURE_LDFLAGS)
CFLAGS += $(GTKCFLAGS)
LDFLAGS += $(GTKLDFLAGS)
+# ----------------------------------------------------------------------------
+# Windows flag setup
+# ----------------------------------------------------------------------------
+
ifeq ($(HOST),Windows_NT)
CFLAGS += -U__STRICT_ANSI__
endif
endif
+# ----------------------------------------------------------------------------
+# RISC OS target flag setup
+# ----------------------------------------------------------------------------
+
ifeq ($(TARGET),riscos)
CFLAGS += -I. $(OPTFLAGS) $(WARNFLAGS) -Driscos \
-std=c99 -D_BSD_SOURCE -D_POSIX_C_SOURCE \
@@ -234,8 +269,7 @@ ifeq ($(HOST),riscos)
CFLAGS += -I<OSLib$$Dir> -mthrowback
endif
ASFLAGS += -xassembler-with-cpp -I. -I$(GCCSDK_INSTALL_ENV)/include
-LDFLAGS += -L$(GCCSDK_INSTALL_ENV)/lib -lrufl -lpencil \
- -lsvgtiny
+LDFLAGS += -L$(GCCSDK_INSTALL_ENV)/lib -lrufl
ifeq ($(HOST),riscos)
LDFLAGS += -LOSLib: -lOSLib32
else
@@ -249,6 +283,10 @@ endif
endif
endif
+# ----------------------------------------------------------------------------
+# BeOS target flag setup
+# ----------------------------------------------------------------------------
+
ifeq ($(TARGET),beos)
CFLAGS += -I. -O $(WARNFLAGS) -Dnsbeos \
-D_BSD_SOURCE -D_POSIX_C_SOURCE \
@@ -293,6 +331,9 @@ endif
LDFLAGS += -lbe -ltranslation $(NETLDFLAGS)
endif
+# ----------------------------------------------------------------------------
+# Debug target setup
+# ----------------------------------------------------------------------------
ifeq ($(TARGET),debug)
CFLAGS += -std=c99 -DDEBUG_BUILD \
@@ -306,6 +347,10 @@ CFLAGS += -std=c99 -DDEBUG_BUILD \
LDFLAGS += $(shell $(PKG_CONFIG) --libs librosprite)
endif
+# ----------------------------------------------------------------------------
+# General make rules
+# ----------------------------------------------------------------------------
+
$(OBJROOT)/created:
$(VQ)echo " MKDIR: $(OBJROOT)"
$(Q)$(MKDIR) $(OBJROOT)
diff --git a/Makefile.config b/Makefile.config
index d89aa9520..b3dd3591f 100644
--- a/Makefile.config
+++ b/Makefile.config
@@ -2,19 +2,68 @@
# NetSurf build configuration
#
# Some of these options support an 'AUTO' option, as well as YES and NO. If
-# AUTO is set, the Makefile will attempt to detect if that feature is available
+# AUTO is available, the Makefile will attempt to detect if that feature is
+# available when such is used.
+
+# ----------------------------------------------------------------------------
+# Options relating to all versions of NetSurf
+# ----------------------------------------------------------------------------
+
+# Enable NetSurf's built-in BMP support
+# Valid options: YES, NO
+NETSURF_USE_BMP=YES
+
+# Enable NetSurf's built-in GIF support
+# Valid options: YES, NO
+NETSURF_USE_GIF=YES
+
+# Enable NetSurf's use of IJG's libjpeg
+# Valid options: YES, NO
+NETSURF_USE_JPEG=YES
+
+# Enable NetSurf's use of libmng for displaying MNGs and PNGs
+# Valid options: YES, NO
+NETSURF_USE_MNG=YES
# Use libharu to enable PDF export and GTK printing support. There is no
-# auto-detection available for this, as it does not have a pkg-config file.
+# auto-detection available for this, as it does not have a pkg-config file
+# Valid options: YES, NO
NETSURF_USE_HARU_PDF=YES
-# The following options are GTK-specific
+# ----------------------------------------------------------------------------
+# RISC OS-specific options
+# ----------------------------------------------------------------------------
+ifeq ($(TARGET),riscos)
+
+# Use James Bursa's libsvgtiny for rendering SVG images
+# Valid options: YES, NO
+NETSURF_USE_NSSVG=YES
+
+# Use pencil to enable export to Drawfile
+# Valid options: YES, NO
+NETSURF_USE_DRAW=YES
+
+# Enable NetSurf's RISC OS Sprite support via Tinct
+# Valid options: YES, NO
+NETSURF_USE_SPRITE=YES
+
+endif
+
+# ----------------------------------------------------------------------------
+# GTK-specific options
+# ----------------------------------------------------------------------------
ifeq ($(TARGET),gtk)
+# Where to search for NetSurf's resources after looking in ~/.netsurf and
+# $NETSURFRES. It must have a trailing /
+NETSURF_GTK_RESOURCES=/usr/local/share/netsurf/
+
# Use librsvg in conjunction with Cairo to render SVG images
+# Valid options: YES, NO, AUTO
NETSURF_USE_RSVG=AUTO
# Use James Shaw's librosprite for rendering RISC OS Sprites
+# Valid options: YES, NO, AUTO
NETSURF_USE_ROSPRITE=AUTO
endif
diff --git a/gtk/dialogs/gtk_options.c b/gtk/dialogs/gtk_options.c
index d3ce5669d..b205d2d87 100644
--- a/gtk/dialogs/gtk_options.c
+++ b/gtk/dialogs/gtk_options.c
@@ -20,6 +20,7 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
+#include <math.h>
#include <gtk/gtk.h>
#include <glade/glade.h>
#include "utils/log.h"
diff --git a/gtk/gtk_gui.c b/gtk/gtk_gui.c
index 2682bdaf1..02176c2af 100644
--- a/gtk/gtk_gui.c
+++ b/gtk/gtk_gui.c
@@ -59,9 +59,6 @@
#include "utils/utf8.h"
#include "utils/utils.h"
-/* Where to search for shared resources. Must have trailing / */
-#define RESPATH "/usr/share/netsurf/"
-
bool gui_in_multitask = false;
char *default_stylesheet_url;
@@ -127,7 +124,7 @@ static char *find_resource(char *buf, const char *filename, const char *def)
return buf;
}
- strcpy(t, RESPATH);
+ strcpy(t, GTK_RESPATH);
strcat(t, filename);
realpath(t, buf);
if (access(buf, R_OK) == 0)
diff --git a/riscos/filetype.c b/riscos/filetype.c
index c70407fad..a4fc353bc 100644
--- a/riscos/filetype.c
+++ b/riscos/filetype.c
@@ -302,8 +302,9 @@ int ro_content_filetype_from_type(content_type type) {
#ifdef WITH_ARTWORKS
case CONTENT_ARTWORKS: return 0xd94;
#endif
+#ifdef WITH_NS_SVG
case CONTENT_SVG: return 0xaad;
-
+#endif
default: break;
}
return 0;
diff --git a/riscos/window.c b/riscos/window.c
index 4f80647f5..5da8662b6 100644
--- a/riscos/window.c
+++ b/riscos/window.c
@@ -1437,7 +1437,11 @@ void ro_gui_window_redraw(wimp_draw *redraw)
/* rendering textplain has no advantages using knockout rendering other
* than to slow things down. */
- if (c->type == CONTENT_TEXTPLAIN || c->type == CONTENT_SVG)
+ if (c->type == CONTENT_TEXTPLAIN
+#ifdef WITH_NS_SVG
+ || c->type == CONTENT_SVG
+#endif
+ )
knockout = false;
/* HTML rendering handles scale itself */
diff --git a/utils/config.h b/utils/config.h
index 91eadb6fa..d5aca43e7 100644
--- a/utils/config.h
+++ b/utils/config.h
@@ -46,18 +46,6 @@ char *strndup(const char *s, size_t n);
#define WITH_SSL
#endif
-/* Image renderering modules */
-#define WITH_BMP
-#define WITH_JPEG
-#define WITH_MNG
-#define WITH_GIF
-#if defined(riscos)
- #define WITH_NS_SVG /* internal SVG renderer */
- #define WITH_DRAW
- #define WITH_SPRITE
- #define WITH_ARTWORKS
-#endif
-
/* Platform specific features */
#if defined(riscos)
/* Plugin module */