make image content handlers build conditional from teh makefile

svn path=/trunk/netsurf/; revision=12673
This commit is contained in:
Vincent Sanders 2011-08-28 14:29:15 +00:00
parent 401072e305
commit cd554e6f1e
33 changed files with 129 additions and 218 deletions

View File

@ -302,10 +302,12 @@ define pkg_config_find_and_add
LDFLAGS += $$(shell $$(PKG_CONFIG) --libs $(2)) $$(NETSURF_FEATURE_$(1)_LDFLAGS)
ifneq ($(MAKECMDGOALS),clean)
$$(info M.CONFIG: $(3) ($(2)) auto-enabled (NETSURF_USE_$(1) := AUTO))
NETSURF_USE_$(1) := YES
endif
else
ifneq ($(MAKECMDGOALS),clean)
$$(info M.CONFIG: $(3) ($(2)) auto-disabled (NETSURF_USE_$(1) := AUTO))
NETSURF_USE_$(1) := NO
endif
endif
else ifeq ($$(NETSURF_USE_$(1)),NO)
@ -372,22 +374,25 @@ CLEANS := clean-target clean-testament
POSTEXES :=
# ----------------------------------------------------------------------------
# General source file setup
# ----------------------------------------------------------------------------
include Makefile.sources
# ----------------------------------------------------------------------------
# Target specific setup
# ----------------------------------------------------------------------------
include $(TARGET)/Makefile.target
# ----------------------------------------------------------------------------
# General source file setup
# ----------------------------------------------------------------------------
include Makefile.sources
# ----------------------------------------------------------------------------
# Source file setup
# ----------------------------------------------------------------------------
# Force exapnsion of source file list
SOURCES := $(SOURCES)
ifeq ($(SOURCES),)
$(error Unable to build NetSurf, could not determine set of sources to build)
endif

View File

@ -37,9 +37,19 @@ S_COMMON := $(addprefix content/,$(S_CONTENT)) \
$(addprefix desktop/,$(S_DESKTOP))
# S_IMAGE are sources related to image management
S_IMAGE := bmp.c gif.c ico.c image.c jpeg.c mng.c nssprite.c png.c \
svg.c rsvg.c webp.c
S_IMAGE := $(addprefix image/,$(S_IMAGE))
S_IMAGE_YES := image.c
S_IMAGE_NO :=
S_IMAGE_$(NETSURF_USE_BMP) += bmp.c ico.c
S_IMAGE_$(NETSURF_USE_GIF) += gif.c
S_IMAGE_$(NETSURF_USE_JPEG) += jpeg.c
S_IMAGE_$(NETSURF_USE_MNG) += mng.c
S_IMAGE_$(NETSURF_USE_NSSPRITE) += nssprite.c
S_IMAGE_$(NETSURF_USE_PNG) += png.c
S_IMAGE_$(NETSURF_USE_NSSVG) += svg.c
S_IMAGE_$(NETSURF_USE_RSVG) += rsvg.c
S_IMAGE_$(NETSURF_USE_WEBP) += webp.c
S_IMAGE := $(addprefix image/,$(S_IMAGE_YES))
# S_PDF are sources of the pdf plotter + the ones for paged-printing
S_PDF := pdf_plotters.c font_haru.c

View File

@ -77,5 +77,7 @@ S_AMIGA := gui.c tree.c history.c hotlist.c schedule.c \
stringview/stringview.c stringview/urlhistory.c
S_AMIGA := $(addprefix amiga/,$(S_AMIGA))
# complete source file list
SOURCES := $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_AMIGA) $(S_PDF)
# This is the final source build list
# Note this is deliberately *not* expanded here as common and image
# are not yet available
SOURCES = $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_AMIGA) $(S_PDF)

View File

@ -42,8 +42,10 @@ S_ATARI := gui.c findfile.c filetype.c misc.c bitmap.c schedule.c \
global_evnt.c osspec.c dragdrop.c system_colour.c
S_ATARI := $(addprefix atari/,$(S_ATARI))
SOURCES := $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_ATARI)
# This is the final source build list
# Note this is deliberately *not* expanded here as common and image
# are not yet available
SOURCES = $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_ATARI)
EXETARGET := ns$(SUBTARGET).prg

View File

@ -106,6 +106,8 @@ RDEP_BEOS := $(addprefix beos/res/,$(RDEP_BEOS)) \
$(wildcard beos/res/throbber/throbber*.png)
# complete source file list
SOURCES := $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_BEOS)
# This is the final source build list
# Note this is deliberately *not* expanded here as common and image
# are not yet available
SOURCES = $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_BEOS)
EXETARGET := NetSurf

View File

@ -118,9 +118,10 @@ S_TABBAR := \
S_COCOA := $(addprefix cocoa/,$(S_COCOA))
S_TABBAR := $(addprefix cocoa/PSMTabBarControl/,$(S_TABBAR))
# complete source file list
SOURCES := $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_COCOA) $(S_TABBAR)
SOURCES := $(addprefix $(shell pwd)/,$(SOURCES))
# This is the final source build list
# Note this is deliberately *not* expanded here as common and image
# are not yet available
SOURCES = $(addprefix $(shell pwd)/,$(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_COCOA) $(S_TABBAR))
# Since we prefix the sources with the pwd, also create a special
# prefixed rule so that the testament is run
@ -169,7 +170,7 @@ $$(OBJROOT)/$(2).lproj/$(1:.xib=.nib): cocoa/res/$(1) $$(OBJROOT)/created
$(VQ)echo Compiling XIB $(1) for language $(2)
$(Q)mkdir -p $$(OBJROOT)/$(2).lproj
$(Q)cocoa/compile-xib.sh $(DEVELOPER_PATH) cocoa/res/$(1) $(2) $$@
ifeq ($(wildcard cocoa/res/$(2).lproj/$(1).strings),cocoa/res/$(2).lproj/$(1).strings)
$$(OBJROOT)/$(2).lproj/$(1:.xib=.nib): cocoa/res/$(2).lproj/$(1).strings
endif

View File

@ -149,6 +149,8 @@ endif
S_FRAMEBUFFER := $(addprefix framebuffer/,$(S_FRAMEBUFFER)) $(addprefix framebuffer/fbtk/,$(S_FRAMEBUFFER_FBTK))
# complete source file list
SOURCES := $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_FRAMEBUFFER) $(S_IMAGES)
# This is the final source build list
# Note this is deliberately *not* expanded here as common and image
# are not yet available
SOURCES = $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_FRAMEBUFFER) $(S_IMAGES)
EXETARGET := nsfb$(SUBTARGET)

View File

@ -72,5 +72,8 @@ S_GTK := font_pango.c bitmap.c gui.c schedule.c thumbnail.c plotters.c \
S_GTK := $(addprefix gtk/,$(S_GTK)) $(addprefix utils/,container.c)
# code in utils/container.ch is non-universal it seems
SOURCES := $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_PDF) $(S_GTK)
# This is the final source build list
# Note this is deliberately *not* expanded here as common and image
# are not yet available
SOURCES = $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_PDF) $(S_GTK)
EXETARGET := nsgtk

View File

@ -21,25 +21,24 @@
* Content for image/bmp (implementation)
*/
#include "utils/config.h"
#ifdef WITH_BMP
#include <assert.h>
#include <string.h>
#include <stdbool.h>
#include <stdlib.h>
#include <libnsbmp.h>
#include "utils/config.h"
#include "content/content_protected.h"
#include "content/hlcache.h"
#include "desktop/plotters.h"
#include "image/bitmap.h"
#include "image/bmp.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/talloc.h"
#include "utils/utils.h"
#include "image/bitmap.h"
#include "image/bmp.h"
typedef struct nsbmp_content {
struct content base;
@ -275,5 +274,3 @@ static const char *nsbmp_types[] = {
};
CONTENT_FACTORY_REGISTER_TYPES(nsbmp, nsbmp_types, nsbmp_content_handler);
#endif

View File

@ -24,11 +24,8 @@
#ifndef _NETSURF_IMAGE_BMP_H_
#define _NETSURF_IMAGE_BMP_H_
#include "utils/config.h"
#ifdef WITH_BMP
#include <stdbool.h>
#include <libnsbmp.h>
#include "image/bitmap.h"
extern bmp_bitmap_callback_vt bmp_bitmap_callbacks; /** Only to be used by ICO code. */
@ -36,11 +33,4 @@ extern bmp_bitmap_callback_vt bmp_bitmap_callbacks; /** Only to be used by ICO c
nserror nsbmp_init(void);
void nsbmp_fini(void);
#else
#define nsbmp_init() NSERROR_OK
#define nsbmp_fini() ((void) 0)
#endif /* WITH_BMP */
#endif

View File

@ -28,9 +28,6 @@
* [rjw] - Sun 4th April 2004
*/
#include "utils/config.h"
#ifdef WITH_GIF
#include <assert.h>
#include <string.h>
#include <stdbool.h>
@ -425,5 +422,3 @@ static const char *nsgif_types[] = {
};
CONTENT_FACTORY_REGISTER_TYPES(nsgif, nsgif_types, nsgif_content_handler);
#endif

View File

@ -24,20 +24,7 @@
#ifndef _NETSURF_IMAGE_GIF_H_
#define _NETSURF_IMAGE_GIF_H_
#include "utils/config.h"
#ifdef WITH_GIF
#include <stdbool.h>
#include <libnsgif.h>
nserror nsgif_init(void);
void nsgif_fini(void);
#else
#define nsgif_init() NSERROR_OK
#define nsgif_fini() ((void) 0)
#endif /* WITH_GIF */
#endif

View File

@ -20,9 +20,6 @@
* Content for image/ico (implementation)
*/
#include "utils/config.h"
#ifdef WITH_BMP
#include <assert.h>
#include <string.h>
#include <stdbool.h>
@ -237,5 +234,3 @@ static const char *nsico_types[] = {
};
CONTENT_FACTORY_REGISTER_TYPES(nsico, nsico_types, nsico_content_handler);
#endif

View File

@ -23,22 +23,7 @@
#ifndef _NETSURF_IMAGE_ICO_H_
#define _NETSURF_IMAGE_ICO_H_
#include "utils/config.h"
#ifdef WITH_BMP
#include <stdbool.h>
#include <libnsbmp.h>
#include "utils/errors.h"
nserror nsico_init(void);
void nsico_fini(void);
#else
#define nsico_init() NSERROR_OK
#define nsico_fini() ((void) 0)
#endif /* WITH_BMP */
#endif

View File

@ -16,8 +16,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "image/image.h"
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include "utils/errors.h"
#include "image/image.h"
#include "image/bmp.h"
#include "image/gif.h"
#include "image/ico.h"
@ -29,6 +34,8 @@
#include "image/svg.h"
#include "image/webp.h"
#include "utils/config.h"
/**
* Initialise image content handlers
*
@ -38,49 +45,70 @@ nserror image_init(void)
{
nserror error;
#ifdef WITH_BMP
error = nsbmp_init();
if (error != NSERROR_OK)
return error;
#endif
#ifdef WITH_GIF
error = nsgif_init();
if (error != NSERROR_OK)
return error;
#endif
#ifdef WITH_BMP
error = nsico_init();
if (error != NSERROR_OK)
return error;
#endif
#ifdef WITH_JPEG
error = nsjpeg_init();
if (error != NSERROR_OK)
return error;
#endif
#ifdef WITH_MNG
error = nsmng_init();
if (error != NSERROR_OK)
return error;
/* Prefer libpng over libmng for pngs by registering later */
error = nsjpng_init();
if (error != NSERROR_OK)
return error;
#endif
#ifdef WITH_PNG
/* Prefer libpng over libmng for pngs by registering later */
error = nspng_init();
if (error != NSERROR_OK)
return error;
#endif
#ifdef WITH_NSSPRITE
error = nssprite_init();
if (error != NSERROR_OK)
return error;
#endif
/* Prefer rsvg over libsvgtiny for svgs */
#ifdef WITH_NS_SVG
error = svg_init();
if (error != NSERROR_OK)
return error;
#endif
#ifdef WITH_RSVG
error = nsrsvg_init();
if (error != NSERROR_OK)
return error;
#endif
#ifdef WITH_WEBP
error = webp_init();
if (error != NSERROR_OK)
return error;
#endif /* WITH_WEBP */
return NSERROR_OK;
}
@ -90,16 +118,45 @@ nserror image_init(void)
*/
void image_fini(void)
{
#ifdef WITH_BMP
nsbmp_fini();
#endif
#ifdef WITH_GIF
nsgif_fini();
#endif
#ifdef WITH_BMP
nsico_fini();
#endif
#ifdef WITH_JPEG
nsjpeg_fini();
#endif
#ifdef WITH_MNG
nsmng_fini();
nsjpng_fini();
#endif
#ifdef WITH_NSSPRITE
nssprite_fini();
#endif
#ifdef WITH_PNG
nspng_fini();
#endif
#ifdef WITH_RSVG
nsrsvg_fini();
#endif
#ifdef WITH_NS_SVG
svg_fini();
#endif
#ifdef WITH_WEBP
webp_fini();
#endif
}

View File

@ -28,5 +28,4 @@
nserror image_init(void);
void image_fini(void);
#endif

View File

@ -23,9 +23,6 @@
* This implementation uses the IJG JPEG library.
*/
#include "utils/config.h"
#ifdef WITH_JPEG
#include <assert.h>
#include <setjmp.h>
#include <string.h>
@ -357,5 +354,3 @@ static const char *nsjpeg_types[] = {
};
CONTENT_FACTORY_REGISTER_TYPES(nsjpeg, nsjpeg_types, nsjpeg_content_handler);
#endif /* WITH_JPEG */

View File

@ -23,21 +23,7 @@
#ifndef _NETSURF_IMAGE_JPEG_H_
#define _NETSURF_IMAGE_JPEG_H_
#include "utils/config.h"
#ifdef WITH_JPEG
#include <stdbool.h>
#include "utils/errors.h"
nserror nsjpeg_init(void);
void nsjpeg_fini(void);
#else
#define nsjpeg_init() NSERROR_OK
#define nsjpeg_fini() ((void) 0)
#endif /* WITH_JPEG */
#endif

View File

@ -20,9 +20,6 @@
* Content for image/mng, image/png, and image/jng (implementation).
*/
#include "utils/config.h"
#ifdef WITH_MNG
#include <assert.h>
#include <stdbool.h>
#include <string.h>
@ -811,5 +808,3 @@ static const char *nsjpng_types[] = {
};
CONTENT_FACTORY_REGISTER_TYPES(nsjpng, nsjpng_types, nsjpng_content_handler);
#endif

View File

@ -23,23 +23,10 @@
#ifndef _NETSURF_IMAGE_MNG_H_
#define _NETSURF_IMAGE_MNG_H_
#include "utils/config.h"
#ifdef WITH_MNG
#include <stdbool.h>
nserror nsmng_init(void);
void nsmng_fini(void);
nserror nsjpng_init(void);
void nsmng_fini(void);
void nsjpng_fini(void);
#else
#define nsmng_init() NSERROR_OK
#define nsmng_fini() ((void) 0)
#define nsjpng_init() NSERROR_OK
#define nsjpng_fini() ((void) 0)
#endif /* WITH_MNG */
#endif

View File

@ -21,9 +21,6 @@
*
*/
#include "utils/config.h"
#ifdef WITH_NSSPRITE
#include <assert.h>
#include <string.h>
#include <stdlib.h>
@ -240,5 +237,3 @@ static const char *nssprite_types[] = {
};
CONTENT_FACTORY_REGISTER_TYPES(nssprite, nssprite_types, nssprite_content_handler);
#endif

View File

@ -23,19 +23,7 @@
#ifndef _NETSURF_NS_SPRITE_H_
#define _NETSURF_NS_SPRITE_H_
#include "utils/config.h"
#ifdef WITH_NSSPRITE
#include <stdbool.h>
nserror nssprite_init(void);
void nssprite_fini(void);
#else
#define nssprite_init() NSERROR_OK
#define nssprite_fini() ((void) 0)
#endif /* WITH_NSSPRITE */
#endif

View File

@ -25,8 +25,6 @@
#include <png.h>
#include "utils/config.h"
#include "desktop/plotters.h"
#include "content/content_protected.h"
@ -39,8 +37,6 @@
#include "utils/talloc.h"
#include "utils/utils.h"
#ifdef WITH_PNG
/* accommodate for old versions of libpng (beware security holes!) */
#ifndef png_jmpbuf
@ -438,5 +434,3 @@ static const char *nspng_types[] = {
};
CONTENT_FACTORY_REGISTER_TYPES(nspng, nspng_types, nspng_content_handler);
#endif

View File

@ -20,22 +20,7 @@
#ifndef _NETSURF_RISCOS_PNG_H_
#define _NETSURF_RISCOS_PNG_H_
#include "utils/config.h"
#ifdef WITH_PNG
#include <stdbool.h>
#include "utils/errors.h"
nserror nspng_init(void);
void nspng_fini(void);
#else
#define nspng_init() NSERROR_OK
#define nspng_fini() ((void) 0)
#endif
#endif

View File

@ -27,9 +27,6 @@
* function to render it for redraw requests.
*/
#include "utils/config.h"
#ifdef WITH_RSVG
#include <stdbool.h>
#include <assert.h>
#include <string.h>
@ -38,7 +35,6 @@
#include <librsvg/rsvg.h>
#include <librsvg/rsvg-cairo.h>
#include "image/rsvg.h"
#include "content/content_protected.h"
#include "desktop/plotters.h"
#include "image/bitmap.h"
@ -47,6 +43,8 @@
#include "utils/messages.h"
#include "utils/talloc.h"
#include "image/rsvg.h"
typedef struct rsvg_content {
struct content base;
@ -315,5 +313,3 @@ static const char *rsvg_types[] = {
CONTENT_FACTORY_REGISTER_TYPES(nsrsvg, rsvg_types, rsvg_content_handler);
#endif /* WITH_RSVG */

View File

@ -23,21 +23,7 @@
#ifndef _NETSURF_IMAGE_RSVG_H_
#define _NETSURF_IMAGE_RSVG_H_
#include "utils/config.h"
#ifdef WITH_RSVG
#include <stdbool.h>
#include "utils/errors.h"
nserror nsrsvg_init(void);
void nsrsvg_fini(void);
#else
#define nsrsvg_init() NSERROR_OK
#define nsrsvg_fini() ((void) 0)
#endif /* WITH_RSVG */
#endif

View File

@ -20,9 +20,6 @@
* Content for image/svg (implementation).
*/
#include "utils/config.h"
#ifdef WITH_NS_SVG
#include <assert.h>
#include <string.h>
@ -346,4 +343,4 @@ static const char *svg_types[] = {
CONTENT_FACTORY_REGISTER_TYPES(svg, svg_types, svg_content_handler);
#endif /* WITH_NS_SVG */

View File

@ -23,22 +23,7 @@
#ifndef _NETSURF_IMAGE_SVG_H_
#define _NETSURF_IMAGE_SVG_H_
#include "utils/config.h"
#ifdef WITH_NS_SVG
#include <stdbool.h>
#include "utils/errors.h"
nserror svg_init(void);
void svg_fini(void);
#else
#define svg_init() NSERROR_OK
#define svg_fini() ((void) 0)
#endif
#endif

View File

@ -21,9 +21,6 @@
*
*/
#include "utils/config.h"
#ifdef WITH_WEBP
#include <assert.h>
#include <string.h>
#include <stdlib.h>
@ -211,4 +208,3 @@ static const char *webp_types[] = {
CONTENT_FACTORY_REGISTER_TYPES(webp, webp_types, webp_content_handler);
#endif

View File

@ -23,21 +23,7 @@
#ifndef _NETSURF_WEBP_H_
#define _NETSURF_WEBP_H_
#include "utils/config.h"
#ifdef WITH_WEBP
#include <stdbool.h>
#include "utils/errors.h"
nserror webp_init(void);
void webp_fini(void);
#else
#define webp_init() NSERROR_OK
#define webp_fini() ((void) 0)
#endif /* WITH_WEBP */
#endif

View File

@ -61,5 +61,8 @@ S_MONKEY := main.c utils.c filetype.c schedule.c system_colour.c \
S_MONKEY := $(addprefix monkey/,$(S_MONKEY))
SOURCES := $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_PDF) $(S_MONKEY)
# This is the final source build list
# Note this is deliberately *not* expanded here as common and image
# are not yet available
SOURCES = $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_PDF) $(S_MONKEY)
EXETARGET := nsmonkey

View File

@ -86,8 +86,10 @@ TPL_RISCOS := de en fr nl # TODO: It'd be nice to auto-detect these
TPL_RISCOS := $(addprefix riscos/templates/,$(TPL_RISCOS))
# complete source file list
SOURCES := $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_PDF) $(S_RISCOS)
# This is the final source build list
# Note this is deliberately *not* expanded here as common and image
# are not yet available
SOURCES = $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_PDF) $(S_RISCOS)
EXETARGET := !NetSurf/!RunImage$(EXEEXT)
!NetSurf/!Run$(RUNEXT): riscos/scripts/Run $(EXETARGET)

View File

@ -65,5 +65,8 @@ S_WINDOWS := main.c window.c gui.c drawable.c misc.c plot.c findfile.c \
windbg.c system_colour.c
S_WINDOWS := $(addprefix windows/,$(S_WINDOWS))
# This is the final source build list
# Note this is deliberately *not* expanded here as common and image
# are not yet available
SOURCES := $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_WINDOWS) $(S_RESOURCES)
EXETARGET := NetSurf.exe