diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2010-01-06 16:56:04 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2010-01-06 16:56:04 +0000 |
commit | 5e173f639d10c44567e3dc2c53d459a0b102fb84 (patch) | |
tree | bce192aedda45c4d2260ce29344ccad46b37358c | |
parent | c245c9a32687edd068bd9eacb16e966c3b6dd8c8 (diff) | |
download | libpencil-5e173f639d10c44567e3dc2c53d459a0b102fb84.tar.gz libpencil-5e173f639d10c44567e3dc2c53d459a0b102fb84.tar.bz2 |
Port to core buildsystemreleases/0.0.1
svn path=/trunk/pencil/; revision=9793
-rw-r--r-- | Makefile | 55 | ||||
-rw-r--r-- | include/pencil.h (renamed from pencil.h) | 0 | ||||
-rw-r--r-- | libpencil.pc.in | 10 | ||||
-rw-r--r-- | makefile | 50 | ||||
-rw-r--r-- | src/Makefile | 4 | ||||
-rw-r--r-- | src/pencil_build.c (renamed from pencil_build.c) | 4 | ||||
-rw-r--r-- | src/pencil_internal.h (renamed from pencil_internal.h) | 2 | ||||
-rw-r--r-- | src/pencil_save.c (renamed from pencil_save.c) | 26 | ||||
-rw-r--r-- | test/Makefile | 4 | ||||
-rw-r--r-- | test/pencil_test.c (renamed from pencil_test.c) | 6 |
10 files changed, 94 insertions, 67 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e93d3d8 --- /dev/null +++ b/Makefile @@ -0,0 +1,55 @@ +# Component settings +COMPONENT := pencil +COMPONENT_VERSION := 0.0.1 +# Default to a static library +COMPONENT_TYPE ?= lib-static + +# Setup the tooling +include build/makefiles/Makefile.tools + +TESTRUNNER := $(ECHO) + +# Toolchain flags +WARNFLAGS := -Wall -W -Wundef -Wpointer-arith -Wcast-align \ + -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \ + -Wmissing-declarations -Wnested-externs -pedantic +# BeOS/Haiku/AmigaOS4 standard library headers create warnings +ifneq ($(TARGET),beos) + ifneq ($(TARGET),AmigaOS) + WARNFLAGS := $(WARNFLAGS) -Werror + endif +endif +CFLAGS := -I$(CURDIR)/include/ -I$(CURDIR)/src $(WARNFLAGS) $(CFLAGS) +ifneq ($(GCCVER),2) + CFLAGS := $(CFLAGS) -std=c99 +else + # __inline__ is a GCCism + CFLAGS := $(CFLAGS) -Dinline="__inline__" +endif + +# OSLib +ifneq ($(findstring clean,$(MAKECMDGOALS)),clean) + ifeq ($(TARGET),riscos) + CFLAGS := $(CFLAGS) -I$(PREFIX)/include + LDFLAGS := $(LDFLAGS) -lOSLib32 + endif +endif + +# RUfl +ifneq ($(findstring clean,$(MAKECMDGOALS)),clean) + ifneq ($(PKGCONFIG),) + CFLAGS := $(CFLAGS) $(shell $(PKGCONFIG) librufl --cflags) + LDFLAGS := $(LDFLAGS) $(shell $(PKGCONFIG) librufl --libs) + else + CFLAGS := $(CFLAGS) -I$(PREFIX)/include + LDFLAGS := $(LDFLAGS) -lrufl + endif +endif + +include build/makefiles/Makefile.top + +# Extra installation rules +I := /include +INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):include/pencil.h +INSTALL_ITEMS := $(INSTALL_ITEMS) /lib/pkgconfig:lib$(COMPONENT).pc.in +INSTALL_ITEMS := $(INSTALL_ITEMS) /lib:$(OUTPUT) diff --git a/pencil.h b/include/pencil.h index 9205d5a..9205d5a 100644 --- a/pencil.h +++ b/include/pencil.h diff --git a/libpencil.pc.in b/libpencil.pc.in new file mode 100644 index 0000000..6863e73 --- /dev/null +++ b/libpencil.pc.in @@ -0,0 +1,10 @@ +prefix=PREFIX +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: libpencil +Description: Pencil: a drawfile creation library +Version: VERSION +Libs: -L${libdir} -lpencil +Cflags: -I${includedir} diff --git a/makefile b/makefile deleted file mode 100644 index b31e1e6..0000000 --- a/makefile +++ /dev/null @@ -1,50 +0,0 @@ -# -# This file is part of Pencil -# Licensed under the MIT License, -# http://www.opensource.org/licenses/mit-license -# Copyright 2005 James Bursa <james@semichrome.net> -# - -SOURCE = pencil_build.c pencil_save.c -HDRS = pencil.h pencil_internal.h - -GCCSDK_INSTALL_CROSSBIN ?= /home/riscos/cross/bin -GCCSDK_INSTALL_ENV ?= /home/riscos/env - -.PHONY: all install clean - -CC := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc) -AR := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*ar) -CFLAGS = -std=c99 -O3 -W -Wall -Wundef -Wpointer-arith -Wcast-qual \ - -Wcast-align -Wwrite-strings -Wstrict-prototypes \ - -Wmissing-prototypes -Wmissing-declarations \ - -Wnested-externs -Winline -Wno-cast-align \ - -mpoke-function-name -I$(GCCSDK_INSTALL_ENV)/include -ARFLAGS = cr -LIBS = -L$(GCCSDK_INSTALL_ENV)/lib -lOSLib32 -lrufl -INSTALL = $(GCCSDK_INSTALL_ENV)/ro-install -ifneq (,$(findstring arm-unknown-riscos-gcc,$(CC))) - EXEEXT=,e1f -else - EXEEXT=,ff8 -endif - -OBJS = $(SOURCE:.c=.o) - -all: libpencil.a pencil_test$(EXEEXT) - -libpencil.a: $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) - -pencil_test$(EXEEXT): pencil_test.c libpencil.a - $(CC) $(CFLAGS) $(LIBS) -o $@ $^ - -install: libpencil.a - $(INSTALL) libpencil.a $(GCCSDK_INSTALL_ENV)/lib/libpencil.a - $(INSTALL) pencil.h $(GCCSDK_INSTALL_ENV)/include/pencil.h - -clean: - -rm *.o libpencil.a pencil_test$(EXEEXT) - -.c.o: $(HDRS) - $(CC) $(CFLAGS) -c -o $@ $< diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..99d4a1a --- /dev/null +++ b/src/Makefile @@ -0,0 +1,4 @@ +# Sources +DIR_SOURCES := pencil_build.c pencil_save.c + +include build/makefiles/Makefile.subdir diff --git a/pencil_build.c b/src/pencil_build.c index 4b411e5..460b0af 100644 --- a/pencil_build.c +++ b/src/pencil_build.c @@ -224,7 +224,7 @@ void pencil_free_item(struct pencil_item *item) void pencil_dump(struct pencil_diagram *diagram) { printf("diagram %p: current group %p\n", - diagram, diagram->current_group); + (void *) diagram, (void *) diagram->current_group); pencil_dump_item(diagram->root, 0); } @@ -234,7 +234,7 @@ void pencil_dump_item(struct pencil_item *item, unsigned int depth) for (unsigned int i = 0; i != depth; i++) printf(" "); - printf("%p ", item); + printf("%p ", (void *) item); switch (item->type) { case pencil_GROUP: printf("GROUP"); diff --git a/pencil_internal.h b/src/pencil_internal.h index df9fca9..49aabf0 100644 --- a/pencil_internal.h +++ b/src/pencil_internal.h @@ -54,7 +54,7 @@ struct pencil_item { pencil_pattern pattern; int width, height; - const char *sprite; + const void *sprite; struct { int x0; diff --git a/pencil_save.c b/src/pencil_save.c index 2d6bab4..f5c23fb 100644 --- a/pencil_save.c +++ b/src/pencil_save.c @@ -36,8 +36,8 @@ struct pencil_save_context { char **font_list; unsigned int font_count; struct pencil_item *item; - char *buffer; - char *b; + void *buffer; + void *b; os_box bbox; }; @@ -65,10 +65,10 @@ pencil_code pencil_save_drawfile(struct pencil_diagram *diagram, { INT_MAX, INT_MAX, INT_MIN, INT_MIN } }; unsigned int i; size_t size, font_table_size; - char *buffer; + void *buffer, *b; drawfile_diagram *header; drawfile_object *font_table; - char *b, *f; + char *f; *drawfile_buffer = 0; *drawfile_size = 0; @@ -111,19 +111,19 @@ pencil_code pencil_save_drawfile(struct pencil_diagram *diagram, for (i = strlen(source); i < 12; i++) header->source[i] = ' '; header->bbox = context.bbox; - b = buffer + sizeof(drawfile_diagram_base); + b = (char *) buffer + sizeof(drawfile_diagram_base); /* font table */ font_table = (drawfile_object *) b; font_table->type = drawfile_TYPE_FONT_TABLE; font_table->size = font_table_size; - f = b + 8; + f = (char *) b + 8; for (i = 0; i != context.font_count; i++) { *f++ = i + 1; strcpy(f, context.font_list[i]); f += strlen(context.font_list[i]) + 1; } - b += font_table_size; + b = (char *) b + font_table_size; /* pass 2 */ context.buffer = buffer; @@ -374,7 +374,7 @@ void pencil_save_pass2(struct pencil_save_context *context, object->data.group.bbox.y0 = item->bbox.y0; object->data.group.bbox.x1 = item->bbox.x1; object->data.group.bbox.y1 = item->bbox.y1; - context->b += object->size; + context->b = (char *) context->b + object->size; break; case pencil_TEXT: context->item = item; @@ -412,7 +412,7 @@ void pencil_save_pass2(struct pencil_save_context *context, object->data.path_with_pattern.pattern. elements[0] = 1536 * item->thickness; } - path = (int *) (context->b + object->size - + path = (int *) (void *) ((char *) context->b + object->size - item->path_size * 4); for (i = 0; i != item->path_size; ) { switch (item->path[i]) { @@ -439,7 +439,7 @@ void pencil_save_pass2(struct pencil_save_context *context, assert(0); } } - context->b += object->size; + context->b = (char *) context->b + object->size; break; case pencil_SPRITE: object->type = drawfile_TYPE_SPRITE; @@ -451,7 +451,7 @@ void pencil_save_pass2(struct pencil_save_context *context, object->data.sprite.bbox.y1 = item->bbox.y1; memcpy(&object->data.sprite.header, item->sprite, object->size - 24); - context->b += object->size; + context->b = (char *) context->b + object->size; break; default: assert(0); @@ -464,7 +464,7 @@ void pencil_save_pass2(struct pencil_save_context *context, } if (group) - object->size = context->b - (char *) object; + object->size = (char *) context->b - (char *) object; } @@ -529,5 +529,5 @@ void pencil_save_pass2_text_callback(void *c, object->size = 24 + 56 + ((utf8_length + 4) & ~3); } - context->b += object->size; + context->b = (char *) context->b + object->size; } diff --git a/test/Makefile b/test/Makefile new file mode 100644 index 0000000..2df56da --- /dev/null +++ b/test/Makefile @@ -0,0 +1,4 @@ +# Tests +DIR_TEST_ITEMS := pencil_test:pencil_test.c + +include build/makefiles/Makefile.subdir diff --git a/pencil_test.c b/test/pencil_test.c index 6be26c4..04522ee 100644 --- a/pencil_test.c +++ b/test/pencil_test.c @@ -23,6 +23,9 @@ int main(int argc, char *argv[]) { rufl_code code; + (void) argc; + (void) argv; + code = rufl_init(); if (code != rufl_OK) { printf("rufl_init failed: %i\n", code); @@ -138,7 +141,8 @@ void test_pencil(void) assert(drawfile_buffer); error = xosfile_save_stamped("DrawFile", osfile_TYPE_DRAW, - drawfile_buffer, drawfile_buffer + drawfile_size); + (byte *) drawfile_buffer, + (byte *) drawfile_buffer + drawfile_size); if (error) { printf("xosfile_save_stamped failed: 0x%x: %s\n", error->errnum, error->errmess); |