Added documentation on how to build a completely useless SDL library. :)
authorSam Lantinga <slouken@libsdl.org>
Wed, 08 Mar 2006 08:30:17 +0000
changeset 1484b2b476a4a73c
parent 1483 52a61c7b323b
child 1485 e507811313ee
Added documentation on how to build a completely useless SDL library. :)
Makefile.minimal
README.Porting
include/SDL_config.h
include/SDL_config.h.minimal
src/timer/dummy/SDL_systimer.c
test/.cvsignore
test/testcdrom.c
test/testfile.c
test/testtimer.c
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/Makefile.minimal	Wed Mar 08 08:30:17 2006 +0000
     1.3 @@ -0,0 +1,38 @@
     1.4 +# Makefile to build the SDL library
     1.5 +
     1.6 +INCLUDE = -I./include
     1.7 +CFLAGS  = -g -O2 $(INCLUDE)
     1.8 +AR	= ar
     1.9 +RANLIB	= ranlib
    1.10 +
    1.11 +TARGET  = libSDL.a
    1.12 +SOURCES = \
    1.13 +	src/*.c \
    1.14 +	src/audio/*.c \
    1.15 +	src/cdrom/*.c \
    1.16 +	src/cpuinfo/*.c \
    1.17 +	src/events/*.c \
    1.18 +	src/file/*.c \
    1.19 +	src/joystick/*.c \
    1.20 +	src/stdlib/*.c \
    1.21 +	src/thread/*.c \
    1.22 +	src/timer/*.c \
    1.23 +	src/video/*.c \
    1.24 +	src/audio/disk/*.c \
    1.25 +	src/video/dummy/*.c \
    1.26 +	src/joystick/dummy/*.c \
    1.27 +	src/cdrom/dummy/*.c \
    1.28 +	src/thread/generic/*.c \
    1.29 +	src/timer/dummy/*.c \
    1.30 +	src/loadso/dummy/*.c \
    1.31 +
    1.32 +OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g')
    1.33 +
    1.34 +all: $(TARGET)
    1.35 +
    1.36 +$(TARGET): $(OBJECTS)
    1.37 +	$(AR) crv $@ $^
    1.38 +	$(RANLIB) $@
    1.39 +
    1.40 +clean:
    1.41 +	rm -f $(TARGET) $(OBJECTS)
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/README.Porting	Wed Mar 08 08:30:17 2006 +0000
     2.3 @@ -0,0 +1,56 @@
     2.4 +
     2.5 +* Porting To A New Platform
     2.6 +
     2.7 +  The first thing you have to do when porting to a new platform, is look at
     2.8 +include/SDL_platform.h and create an entry there for your operating system.
     2.9 +The standard format is __PLATFORM__, where PLATFORM is the name of the OS.
    2.10 +Ideally SDL_platform.h will be able to auto-detect the system it's building
    2.11 +on based on C preprocessor symbols.
    2.12 +
    2.13 +There are two basic ways of building SDL at the moment:
    2.14 +
    2.15 +1. The "UNIX" way:  ./configure; make; make install
    2.16 +
    2.17 +   If you have a GNUish system, then you might try this.  Edit configure.in,
    2.18 +   take a look at the large section labelled:
    2.19 +	"Set up the configuration based on the target platform!"
    2.20 +   Add a section for your platform, and then re-run autogen.sh and build!
    2.21 +
    2.22 +2. Using an IDE:
    2.23 +
    2.24 +   If you're using an IDE or other non-configure build system, you'll probably
    2.25 +   want to create a custom SDL_config.h for your platform.  Edit SDL_config.h,
    2.26 +   add a section for your platform, and create a custom SDL_config_{platform}.h,
    2.27 +   based on SDL_config.h.minimal and SDL_config.h.in
    2.28 +
    2.29 +   Add the top level include directory to the header search path, and then add
    2.30 +   the following sources to the project:
    2.31 +	src/*.c
    2.32 +	src/audio/*.c
    2.33 +	src/cdrom/*.c
    2.34 +	src/cpuinfo/*.c
    2.35 +	src/events/*.c
    2.36 +	src/file/*.c
    2.37 +	src/joystick/*.c
    2.38 +	src/stdlib/*.c
    2.39 +	src/thread/*.c
    2.40 +	src/timer/*.c
    2.41 +	src/video/*.c
    2.42 +	src/audio/disk/*.c
    2.43 +	src/video/dummy/*.c
    2.44 +	src/joystick/dummy/*.c
    2.45 +	src/cdrom/dummy/*.c
    2.46 +	src/thread/generic/*.c
    2.47 +	src/timer/dummy/*.c
    2.48 +	src/loadso/dummy/*.c
    2.49 +
    2.50 +
    2.51 +Once you have a working library without any drivers, you can go back to each
    2.52 +of the major subsystems and start implementing drivers for your platform.
    2.53 +
    2.54 +If you have any questions, don't hesitate to ask on the SDL mailing list:
    2.55 +	http://www.libsdl.org/mailing-list.php
    2.56 +
    2.57 +Enjoy!
    2.58 +	Sam Lantinga				(slouken@libsdl.org)
    2.59 +
     3.1 --- a/include/SDL_config.h	Wed Mar 08 06:21:04 2006 +0000
     3.2 +++ b/include/SDL_config.h	Wed Mar 08 08:30:17 2006 +0000
     3.3 @@ -51,6 +51,28 @@
     3.4  typedef unsigned int uint32_t;
     3.5  typedef unsigned int size_t;
     3.6  typedef unsigned long uintptr_t;
     3.7 -#endif
     3.8 +
     3.9 +/* Enable the disk audio driver (src/audio/disk/\*.c) */
    3.10 +#define SDL_AUDIO_DRIVER_DISK	1
    3.11 +
    3.12 +/* Enable the stub cdrom driver (src/cdrom/dummy/\*.c) */
    3.13 +#define SDL_CDROM_DISABLED	1
    3.14 +
    3.15 +/* Enable the stub joystick driver (src/joystick/dummy/\*.c) */
    3.16 +#define SDL_JOYSTICK_DISABLED	1
    3.17 +
    3.18 +/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
    3.19 +#define SDL_LOADSO_DISABLED	1
    3.20 +
    3.21 +/* Enable the stub thread support (src/thread/generic/\*.c) */
    3.22 +#define SDL_THREADS_DISABLED	1
    3.23 +
    3.24 +/* Enable the stub timer support (src/timer/dummy/\*.c) */
    3.25 +#define SDL_TIMERS_DISABLED	1
    3.26 +
    3.27 +/* Enable the dummy video driver (src/video/dummy/\*.c) */
    3.28 +#define SDL_VIDEO_DRIVER_DUMMY	1
    3.29 +
    3.30 +#endif /* platform config */
    3.31  
    3.32  #endif /* _SDL_config_h */
     4.1 --- a/include/SDL_config.h.minimal	Wed Mar 08 06:21:04 2006 +0000
     4.2 +++ b/include/SDL_config.h.minimal	Wed Mar 08 08:30:17 2006 +0000
     4.3 @@ -51,6 +51,28 @@
     4.4  typedef unsigned int uint32_t;
     4.5  typedef unsigned int size_t;
     4.6  typedef unsigned long uintptr_t;
     4.7 -#endif
     4.8 +
     4.9 +/* Enable the disk audio driver (src/audio/disk/\*.c) */
    4.10 +#define SDL_AUDIO_DRIVER_DISK	1
    4.11 +
    4.12 +/* Enable the stub cdrom driver (src/cdrom/dummy/\*.c) */
    4.13 +#define SDL_CDROM_DISABLED	1
    4.14 +
    4.15 +/* Enable the stub joystick driver (src/joystick/dummy/\*.c) */
    4.16 +#define SDL_JOYSTICK_DISABLED	1
    4.17 +
    4.18 +/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
    4.19 +#define SDL_LOADSO_DISABLED	1
    4.20 +
    4.21 +/* Enable the stub thread support (src/thread/generic/\*.c) */
    4.22 +#define SDL_THREADS_DISABLED	1
    4.23 +
    4.24 +/* Enable the stub timer support (src/timer/dummy/\*.c) */
    4.25 +#define SDL_TIMERS_DISABLED	1
    4.26 +
    4.27 +/* Enable the dummy video driver (src/video/dummy/\*.c) */
    4.28 +#define SDL_VIDEO_DRIVER_DUMMY	1
    4.29 +
    4.30 +#endif /* platform config */
    4.31  
    4.32  #endif /* _SDL_config_h */
     5.1 --- a/src/timer/dummy/SDL_systimer.c	Wed Mar 08 06:21:04 2006 +0000
     5.2 +++ b/src/timer/dummy/SDL_systimer.c	Wed Mar 08 08:30:17 2006 +0000
     5.3 @@ -21,6 +21,9 @@
     5.4  */
     5.5  #include "SDL_config.h"
     5.6  
     5.7 +#include "SDL_timer.h"
     5.8 +#include "../SDL_timer_c.h"
     5.9 +
    5.10  void SDL_StartTicks(void)
    5.11  {
    5.12  }
     6.1 --- a/test/.cvsignore	Wed Mar 08 06:21:04 2006 +0000
     6.2 +++ b/test/.cvsignore	Wed Mar 08 08:30:17 2006 +0000
     6.3 @@ -15,10 +15,9 @@
     6.4  testbitmap
     6.5  testblitspeed
     6.6  testcdrom
     6.7 -testcpuinfo
     6.8  testdyngl
     6.9 -testendian
    6.10  testerror
    6.11 +testfile
    6.12  testgamma
    6.13  testgl
    6.14  testhread
    6.15 @@ -28,13 +27,12 @@
    6.16  testoverlay
    6.17  testoverlay2
    6.18  testpalette
    6.19 +testplatform
    6.20  testsem
    6.21  testsprite
    6.22  testtimer
    6.23 -testtypes
    6.24  testver
    6.25  testvidinfo
    6.26  testwin
    6.27  testwm
    6.28 -threadwin
    6.29  torturethread
     7.1 --- a/test/testcdrom.c	Wed Mar 08 06:21:04 2006 +0000
     7.2 +++ b/test/testcdrom.c	Wed Mar 08 08:30:17 2006 +0000
     7.3 @@ -2,9 +2,9 @@
     7.4  /* Test the SDL CD-ROM audio functions */
     7.5  
     7.6  #include <stdlib.h>
     7.7 +#include <stdio.h>
     7.8 +#include <string.h>
     7.9  #include <ctype.h>
    7.10 -#include <stdlib.h>
    7.11 -#include <string.h>
    7.12  
    7.13  #include "SDL.h"
    7.14  
     8.1 --- a/test/testfile.c	Wed Mar 08 06:21:04 2006 +0000
     8.2 +++ b/test/testfile.c	Wed Mar 08 08:30:17 2006 +0000
     8.3 @@ -1,7 +1,7 @@
     8.4  
     8.5  /* sanity tests on SDL_rwops.c (usefull for alternative implementations of stdio rwops) */
     8.6  
     8.7 -
     8.8 +#include <stdlib.h>
     8.9  
    8.10  #include "SDL.h"
    8.11  #include "SDL_endian.h"
     9.1 --- a/test/testtimer.c	Wed Mar 08 06:21:04 2006 +0000
     9.2 +++ b/test/testtimer.c	Wed Mar 08 08:30:17 2006 +0000
     9.3 @@ -37,7 +37,7 @@
     9.4  	SDL_TimerID t1, t2, t3;
     9.5  
     9.6  	if ( SDL_Init(SDL_INIT_TIMER) < 0 ) {
     9.7 -		fprintf(stderr, "Couldn't load SDL: %s\n", SDL_GetError());
     9.8 +		fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
     9.9  		return(1);
    9.10  	}
    9.11