Hello,
here I submit some patches for libnsfb,
some of the stuff is not MiNT specific,... I tried to make it as generic
as possible. I'm not an Makefile Guru..., so maybe I didn't do some things
perfect, please tell me how to do it better.
Makefile-rev10485.patch
---
Added some special Flags setup when compiling with MiNT.
Make use of the new Makefile options that I added to surface Makefile.
Described below.
src_surface_Makefile-rev1048.patch
---
Patch for Makefile in src/surface,
I added the Options:
DISABLE_SDL_SURFACE
DISABLE_VNC_SURFACE
DISABLE_ABLE_SURFACE
DISABLE_RAM_SURFACE
DISABLE_LINUX_SURFACE
DISABLE_X_SURFACE
if one of these Vars is set to YES, this Surface won't be added to
compilation process.
Please let me know if it is OK to use Variables not initialized within
Makefiles.
Otherwise I would have to Init them with the Default Value => NO.
test_polystar-rev9865.c.patch
---
nanosleep() is not available for MiNT, use usleep.
test_polystar2-rev9947.c.patch
---
nanosleep() is not available for MiNT, use usleep.
One patch is missing - that's the plotter patches for Amiga! I really
appreciate these Patches, at least the patch for 16bit plotter is tested
and works well with my Atari. Amiga and Atari users really need these
patches! I don't know about other bitdepth, but I believe they also need
patching to make them work with Atari or Amiga. I expect these patches were
already submitted, so I left them out.
All of the patches have been applied and tested to SVN reversion 10577 of
libnsfb. The revision contained in the filename marks the last changed
revision of the file that this patch must be applied to.
Greets,
Ole
--- Makefile.orig Sun Jun 20 16:18:50 2010
+++ Makefile Sun Jun 20 14:50:12 2010
@@ -3,6 +3,7 @@
COMPONENT_VERSION := 0.0.1
# Default to a static library
COMPONENT_TYPE ?= lib-static
+HOST := $(shell uname -s)
# Setup the tooling
include build/makefiles/Makefile.tools
@@ -11,15 +12,30 @@
TESTRUNNER = test/runtest.sh $(BUILDDIR) $(EXEEXT)
# Toolchain flags
-WARNFLAGS := -Wall -Wextra -Wundef -Wpointer-arith -Wcast-align \
- -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \
- -Wmissing-declarations -Wnested-externs -Werror -pedantic \
- -Wno-overlength-strings # For nsglobe.c
+ifeq ($(HOST),FreeMiNT)
+ WARNFLAGS := -Wall -Wextra -Wundef -Wpointer-arith -Wcast-align \
+ -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \
+ -Wmissing-declarations -Wnested-externs -pedantic \
+ -Wno-overlength-strings # For nsglobe.c
+else
+ WARNFLAGS := -Wall -Wextra -Wundef -Wpointer-arith -Wcast-align \
+ -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \
+ -Wmissing-declarations -Wnested-externs -Werror -pedantic \
+ -Wno-overlength-strings # For nsglobe.c
+endif
+
CFLAGS := -g -std=c99 -D_BSD_SOURCE -I$(CURDIR)/include/ \
-I$(CURDIR)/src $(WARNFLAGS) $(CFLAGS)
# TODO: probably want to retrieve SDL from pkg-config
-TESTLDFLAGS = -Wl,--whole-archive -l$(COMPONENT) -Wl,--no-whole-archive -lSDL
-lxcb-icccm -lxcb -lxcb-image
+ifeq ($(HOST),FreeMiNT)
+ TESTLDFLAGS = -Wl,--whole-archive -l$(COMPONENT) -Wl,--no-whole-archive -lSDL
-lgem -lm
+ DISABLE_X_SURFACE = YES
+ DISABLE_ABLE_SURFACE = YES
+ DISABLE_LINUX_SURFACE = YES
+else
+ TESTLDFLAGS = -Wl,--whole-archive -l$(COMPONENT) -Wl,--no-whole-archive
-lSDL -lxcb-icccm -lxcb -lxcb-image
+endif
include build/makefiles/Makefile.top
--- src/surface/Makefile.orig Sun Jun 20 16:20:14 2010
+++ src/surface/Makefile Sun Jun 20 14:46:34 2010
@@ -1,4 +1,23 @@
# Sources
-DIR_SOURCES := surface.c sdl.c vnc.c able.c ram.c linux.c x.c
+DIR_SOURCES := surface.c
+
+ifneq ($(DISABLE_SDL_SURFACE),YES)
+ DIR_SOURCES += sdl.c
+endif
+ifneq ($(DISABLE_VNC_SURFACE),YES)
+ DIR_SOURCES += vnc.c
+endif
+ifneq ($(DISABLE_ABLE_SURFACE),YES)
+ DIR_SOURCES += able.c
+endif
+ifneq ($(DISABLE_RAM_SURFACE),YES)
+ DIR_SOURCES += ram.c
+endif
+ifneq ($(DISABLE_LINUX_SURFACE),YES)
+ DIR_SOURCES += linux.c
+endif
+ifneq ($(DISABLE_X_SURFACE),YES)
+ DIR_SOURCES += x.c
+endif
include build/makefiles/Makefile.subdir
--- test/polystar2.c.orig Sun Jun 20 16:21:10 2010
+++ test/polystar2.c Sun Jun 20 15:32:28 2010
@@ -10,14 +10,19 @@
#include "libnsfb.h"
#include "libnsfb_plot.h"
#include "libnsfb_event.h"
-
-
+#ifdef __MINT__
+#include <unistd.h>
+#endif
#include <time.h>
// Sleep milliseconds
-static void sleepMilli(long ms)
+static void sleepMilli(long ms)
{
- const struct timespec ts = {ms / 1000, ms % 1000 * 1000000};
- nanosleep(&ts, NULL);
+#ifndef __MINT__
+ const struct timespec ts = {ms / 1000, ms % 1000 * 1000000};
+ nanosleep(&ts, NULL);
+#else
+ usleep(ms*1000);
+#endif
}
#define UNUSED(x) ((x) = (x))
--- test/polystar.c.orig Sun Jun 20 16:21:04 2010
+++ test/polystar.c Sun Jun 20 15:32:52 2010
@@ -10,14 +10,20 @@
#include "libnsfb.h"
#include "libnsfb_plot.h"
#include "libnsfb_event.h"
-
+#ifdef __MINT__
+#include <unistd.h>
+#endif
#include <time.h>
// Sleep milliseconds
static void sleepMilli(long ms)
{
+#ifndef __MINT__
const struct timespec ts = {ms / 1000, ms % 1000 * 1000000};
nanosleep(&ts, NULL);
+#else
+ usleep(ms*1000);
+#endif
}
#define UNUSED(x) ((x) = (x))