[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[tyndur-devel] [PATCH] lbuilds: Soft And Slow
+ lbuild für diesen Software-OpenGL-Rasterizer hinzugefügt; ein Beispiel
wird mitgebaut (gears, benötigt SDL).
Signed-off-by: Max Reitz <max@xxxxxxxxxx>
---
.../soft-and-slow/master/patches/Makefile.patch | 29 +++++
lbuilds/soft-and-slow/master/patches/gears.patch | 123 ++++++++++++++++++++
lbuilds/soft-and-slow/master/patches/series | 2 +
.../master/soft-and-slow-master.lbuild | 56 +++++++++
4 files changed, 210 insertions(+), 0 deletions(-)
create mode 100644 lbuilds/soft-and-slow/master/patches/Makefile.patch
create mode 100644 lbuilds/soft-and-slow/master/patches/gears.patch
create mode 100644 lbuilds/soft-and-slow/master/patches/series
create mode 100644 lbuilds/soft-and-slow/master/soft-and-slow-master.lbuild
diff --git a/lbuilds/soft-and-slow/master/patches/Makefile.patch b/lbuilds/soft-and-slow/master/patches/Makefile.patch
new file mode 100644
index 0000000..93b98bb
--- /dev/null
+++ b/lbuilds/soft-and-slow/master/patches/Makefile.patch
@@ -0,0 +1,29 @@
+Index: src/soft-and-slow-master/lib/Makefile
+===================================================================
+--- src.orig/soft-and-slow-master/lib/Makefile 2011-09-13 20:41:00.000000000 +0200
++++ src/soft-and-slow-master/lib/Makefile 2011-09-13 22:35:42.000000000 +0200
+@@ -1,12 +1,10 @@
+ THREADING = 0
+-ASSEMBLY = 1
+-SHADERS = 1
++ASSEMBLY = 0
++SHADERS = 0
+
+-AR = ar rcs
+-CC = gcc
+ OCP = objcopy
+
+-CFLAGS = -O3 -march=native -g2 -std=c1x -Wall -Wextra -pedantic -I../include -D_GNU_SOURCE
++CFLAGS = -O3 -march=native -g2 -std=gnu99 -Wall -Wextra -pedantic -I../include -D_GNU_SOURCE -m32
+ ifeq ($(THREADING), 1)
+ CFLAGS += -DTHREADING -pthread
+ endif
+@@ -17,7 +15,7 @@
+ CFLAGS += -DUSE_SHADERS
+ endif
+
+-OCP_FROM_TEXT = -I binary -O elf64-x86-64 -B i386
++OCP_FROM_TEXT = -I binary -O elf32-i386 -B i386
+ RM = rm -f
+ ASM = fasm
+
diff --git a/lbuilds/soft-and-slow/master/patches/gears.patch b/lbuilds/soft-and-slow/master/patches/gears.patch
new file mode 100644
index 0000000..93a2539
--- /dev/null
+++ b/lbuilds/soft-and-slow/master/patches/gears.patch
@@ -0,0 +1,123 @@
+Index: src/soft-and-slow-master/test/gears/Makefile
+===================================================================
+--- src.orig/soft-and-slow-master/test/gears/Makefile 2011-09-13 22:35:20.000000000 +0200
++++ src/soft-and-slow-master/test/gears/Makefile 2011-09-13 22:41:11.000000000 +0200
+@@ -1,8 +1,6 @@
+-CC = gcc
+-LINK = gcc
+ RM = rm -f
+-CFLAGS = -rdynamic -O3 -Wall -Wextra -std=c1x -I../../include
+-LDFLAGS = -rdynamic -L../../lib -lSDL -lSASGL -lm -lrt
++CFLAGS = -O3 -Wall -Wextra -std=gnu99 -I../../include -m32
++LDFLAGS = -L../../lib -lSDL -lSASGL -lm -m32
+
+ .PHONY: all clean
+
+Index: src/soft-and-slow-master/test/gears/gears.c
+===================================================================
+--- src.orig/soft-and-slow-master/test/gears/gears.c 2011-09-13 20:41:00.000000000 +0200
++++ src/soft-and-slow-master/test/gears/gears.c 2011-09-13 23:56:08.000000000 +0200
+@@ -3,7 +3,6 @@
+ *
+ * Command line options:
+ * -info print GL implementation information
+- * -exit automatically exit after 30 seconds
+ *
+ *
+ * Brian Paul
+@@ -17,6 +16,8 @@
+ #include <soft-and-slow/gl.h>
+ #include <soft-and-slow/glu.h>
+
++#include <video/video.h>
++
+ #include <math.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+@@ -32,17 +33,16 @@
+
+ static GLint T0 = 0;
+ static GLint Frames = 0;
+-static GLint autoexit = 0;
+ static GLfloat viewDist = 40.0;
+
+
+ static long elapsed_time(void)
+ {
+- static struct timeval tv;
++ static long time = 0;
+
+- gettimeofday(&tv, NULL);
++ time += 29;
+
+- return tv.tv_sec * 1000 + tv.tv_usec / 1000;
++ return time;
+ }
+
+
+@@ -221,23 +221,6 @@
+ glPopMatrix();
+
+ glPopMatrix();
+-
+- Frames++;
+-
+- {
+- GLint t = elapsed_time();
+- if (t - T0 >= 5000) {
+- GLfloat seconds = (t - T0) / 1000.0;
+- GLfloat fps = Frames / seconds;
+- printf("%d frames in %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps);
+- fflush(stdout);
+- T0 = t;
+- Frames = 0;
+- if ((t >= 999.0 * autoexit) && (autoexit)) {
+- exit(0);
+- }
+- }
+- }
+ }
+
+
+@@ -282,7 +265,7 @@
+ glMatrixMode(GL_PROJECTION);
+
+ glLoadIdentity();
+- gluPerspective(23.f, 1.f, 1.f, 1000.f);
++ gluPerspective(23.f, 640.f / 480.f, 1.f, 1000.f);
+
+ glMatrixMode(GL_MODELVIEW);
+
+@@ -304,10 +287,10 @@
+ {
+ SDL_Init(SDL_INIT_VIDEO);
+
+- SDL_Surface *sfc = SDL_SetVideoMode(300, 300, 32, SDL_SWSURFACE);
++ SDL_Surface *sfc = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE);
+ SDL_WM_SetCaption("Gears", "Gears");
+
+- sas_context_t ctx = create_bound_sas_context(300, 300, sfc->pixels);
++ sas_context_t ctx = create_bound_sas_context(640, 480, sfc->pixels);
+ set_current_sas_context(ctx);
+
+ init(argc, argv);
+@@ -337,7 +320,7 @@
+ SDL_Event evt;
+
+ while (SDL_PollEvent(&evt))
+- if (evt.type == SDL_QUIT)
++ if ((evt.type == SDL_QUIT) || (evt.type == SDL_KEYDOWN))
+ quit = 1;
+ }
+
+@@ -346,5 +329,10 @@
+
+ destroy_sas_context(ctx);
+
++ SDL_Quit();
++
++ libvideo_destroy_bitmap(libvideo_get_frontbuffer_bitmap(0));
++ libvideo_restore_text_mode();
++
+ return 0;
+ }
diff --git a/lbuilds/soft-and-slow/master/patches/series b/lbuilds/soft-and-slow/master/patches/series
new file mode 100644
index 0000000..d7b983d
--- /dev/null
+++ b/lbuilds/soft-and-slow/master/patches/series
@@ -0,0 +1,2 @@
+Makefile.patch
+gears.patch
diff --git a/lbuilds/soft-and-slow/master/soft-and-slow-master.lbuild b/lbuilds/soft-and-slow/master/soft-and-slow-master.lbuild
new file mode 100644
index 0000000..4dced70
--- /dev/null
+++ b/lbuilds/soft-and-slow/master/soft-and-slow-master.lbuild
@@ -0,0 +1,56 @@
+include toolchain
+include lutils
+
+DESCRIPTION="OpenGL-Software-Rasterizer"
+HOMEPAGE="http://gitorious.org/asx-games/soft-and-slow"
+SRC_URI="http://gitorious.org/asx-games/soft-and-slow/archive-tarball/master"
+
+LICENSE="GPLv2"
+
+BUILD_DEPEND="lsdl-1.2.14"
+RUN_DEPEND=""
+
+MY_S="${S}/${P}"
+
+src_unpack()
+{
+ if [ "$(head -c 11 ${DISTDIR}/master)" == "The archive" ]; then
+ rm ${DISTDIR}/master
+ die "Try loading the archive again."
+ fi
+ pwd
+ cp ${DISTDIR}/master ${DISTDIR}/master.tar.gz || die "package not found"
+ lunpack master.tar.gz || die "could not unpack"
+ mv asx-games-soft-and-slow ${MY_S}
+}
+
+src_compile()
+{
+ cd ${MY_S}/lib
+
+ export CC="`tc-cc` -I`tc-incdir`"
+ export LINK="`tc-cc` -L`tc-libdir`"
+ export AR="`tc-host`-ar rcs"
+
+ lmake || die "make failed"
+
+ cd ../test/gears
+
+ lmake || die "make failed"
+
+ cd ../../..
+}
+
+src_install()
+{
+ cd ${MY_S}
+
+ install -d install -d ${D}/${R}/lib
+ install -d install -d ${D}/${R}/include
+ install -d install -d ${D}/${R}/bin
+ cp lib/libSASGL.a ${D}/${R}/lib || die "installing S&S lib failed"
+ cp -r include/soft-and-slow ${D}/${R}/include || die "installing S&S includes failed"
+ cp test/gears/gears ${D}/${R}/bin || die "installing gears failed"
+
+ cd ${S}
+}
--
1.7.6.1