From f1ab2dfe3479c607efca9d66baa9bd4cc1d940cd Mon Sep 17 00:00:00 2001 From: Nav Date: Mon, 12 Jan 2015 15:11:55 +0200 Subject: [PATCH] Updated Box2D recipe and patch --- dev-games/box2d/box2d-2.1.2.recipe | 46 ++++++-- dev-games/box2d/patches/box2d-2.1.2.patch | 121 +++++++++++++++++----- 2 files changed, 129 insertions(+), 38 deletions(-) diff --git a/dev-games/box2d/box2d-2.1.2.recipe b/dev-games/box2d/box2d-2.1.2.recipe index 3740e7c64..8ce79fe03 100644 --- a/dev-games/box2d/box2d-2.1.2.recipe +++ b/dev-games/box2d/box2d-2.1.2.recipe @@ -1,22 +1,46 @@ -DESCRIPTION="Box2d is an open source 2d physics engine for games." +SUMMARY="A 2D Physics Engine for Games" +DESCRIPTION="Box2D is a feature rich 2D rigid body physics engine, written in C++. \ +It has been used in many games, including Crayon Physics Deluxe, \ +winner of the 2008 Independant Game Festival Grand Prize" HOMEPAGE="http://www.box2d.org" SRC_URI="http://box2d.googlecode.com/files/Box2D_v2.1.2.zip" -CHECKSUM_MD5="59d142cd8d4d73e8832c7b67591f590c" -REVISION="1" -STATUS_HAIKU="stable" -DEPEND="" +LICENSE="MIT" +COPYRIGHT="2007-2009 Erin Catto" +CHECKSUM_SHA256="3b351c3e51c6bf78c3e48a2b51260297f3f309fde389c9bfc21ebd484efbba54" +REVISION="2" +ARCHITECTURES="x86_gcc2 ?x86 ?x86_64" +SOURCE_DIR="Box2D_v2.1.2" + +PROVIDES=" + box2d + " + +REQUIRES=" + haiku +" + +PATCHES="box2d-2.1.2.patch" + +BUILD_PREREQUIRES=" + haiku_devel + cmd:make + cmd:cmake + cmd:gcc + devel:libgl + devel:libglu +" + +BUILD_REQUIRES="" + BUILD() { - cd Box2D_v2.1.2/Box2D - cmake . -DOPENGL_INCLUDE_DIR:=/boot/develop/headers/os/opengl/GL \ - -DHAIKU:=TRUE + cd Box2D + cmake . make } INSTALL() { - cd Box2D_v2.1.2/Box2D + cd Box2D make install } -LICENSE="MIT" -COPYRIGHT="2007-2009 Erin Catto" diff --git a/dev-games/box2d/patches/box2d-2.1.2.patch b/dev-games/box2d/patches/box2d-2.1.2.patch index e7bea1e19..8f4a8eb3a 100644 --- a/dev-games/box2d/patches/box2d-2.1.2.patch +++ b/dev-games/box2d/patches/box2d-2.1.2.patch @@ -1,7 +1,8 @@ -diff -urN Box2D_v2.1.2/Box2D/CMakeLists.txt Box2D_v2.1.2-haiku/Box2D/CMakeLists.txt ---- Box2D_v2.1.2/Box2D/CMakeLists.txt 2010-04-03 11:10:30.046661632 +0000 -+++ Box2D_v2.1.2-haiku/Box2D/CMakeLists.txt 2010-09-21 12:18:05.000000000 +0000 -@@ -26,7 +26,9 @@ +diff --git a/Box2D/CMakeLists.txt b/Box2D/CMakeLists.txt +index a8ad550..17b3069 100644 +--- a/Box2D/CMakeLists.txt ++++ b/Box2D/CMakeLists.txt +@@ -26,7 +26,9 @@ if(BOX2D_BUILD_EXAMPLES) # Testbed and dependencies. find_package(OpenGL REQUIRED) @@ -11,10 +12,11 @@ diff -urN Box2D_v2.1.2/Box2D/CMakeLists.txt Box2D_v2.1.2-haiku/Box2D/CMakeLists. add_subdirectory(glui) add_subdirectory(Testbed) endif(BOX2D_BUILD_EXAMPLES) -diff -urN Box2D_v2.1.2/Box2D/Testbed/CMakeLists.txt Box2D_v2.1.2-haiku/Box2D/Testbed/CMakeLists.txt ---- Box2D_v2.1.2/Box2D/Testbed/CMakeLists.txt 2010-04-04 11:07:26.007077888 +0000 -+++ Box2D_v2.1.2-haiku/Box2D/Testbed/CMakeLists.txt 2010-09-21 13:44:55.000000000 +0000 -@@ -72,10 +72,19 @@ +diff --git a/Box2D/Testbed/CMakeLists.txt b/Box2D/Testbed/CMakeLists.txt +index d1be5c0..ad716e4 100644 +--- a/Box2D/Testbed/CMakeLists.txt ++++ b/Box2D/Testbed/CMakeLists.txt +@@ -72,10 +72,19 @@ add_executable(Testbed ${Testbed_Tests_SRCS} ) @@ -24,27 +26,28 @@ diff -urN Box2D_v2.1.2/Box2D/Testbed/CMakeLists.txt Box2D_v2.1.2-haiku/Box2D/Tes - freeglut_static - glui - ${OPENGL_LIBRARIES} -+if(HAIKU) # Haiku has glut, so no need for freeglut +-) ++if(HAIKU) # Haiku has glut, so no need for freeglut + target_link_libraries ( + Testbed + Box2D + glui + ${OPENGL_LIBRARIES} -+) -+else(HAIKU) ++) ++else(HAIKU) + target_link_libraries ( + Testbed + Box2D + freeglut_static + glui + ${OPENGL_LIBRARIES} - ) -+endif(HAIKU) -\ No newline at end of file -diff -urN Box2D_v2.1.2/Box2D/Testbed/Framework/Render.cpp Box2D_v2.1.2-haiku/Box2D/Testbed/Framework/Render.cpp ---- Box2D_v2.1.2/Box2D/Testbed/Framework/Render.cpp 2010-02-01 02:12:46.031719424 +0000 -+++ Box2D_v2.1.2-haiku/Box2D/Testbed/Framework/Render.cpp 2010-09-21 11:29:02.000000000 +0000 -@@ -18,7 +18,11 @@ ++) ++endif(HAIKU) +diff --git a/Box2D/Testbed/Framework/Render.cpp b/Box2D/Testbed/Framework/Render.cpp +index 3a6c680..b406367 100644 +--- a/Box2D/Testbed/Framework/Render.cpp ++++ b/Box2D/Testbed/Framework/Render.cpp +@@ -18,12 +18,16 @@ #include "Render.h" @@ -56,9 +59,16 @@ diff -urN Box2D_v2.1.2/Box2D/Testbed/Framework/Render.cpp Box2D_v2.1.2-haiku/Box #include #include -diff -urN Box2D_v2.1.2/Box2D/Testbed/Framework/Test.cpp Box2D_v2.1.2-haiku/Box2D/Testbed/Framework/Test.cpp ---- Box2D_v2.1.2/Box2D/Testbed/Framework/Test.cpp 2010-02-14 12:15:52.031719424 +0000 -+++ Box2D_v2.1.2-haiku/Box2D/Testbed/Framework/Test.cpp 2010-09-21 11:28:49.000000000 +0000 + +-#include ++#include + + void DebugDraw::DrawPolygon(const b2Vec2* vertices, int32 vertexCount, const b2Color& color) + { +diff --git a/Box2D/Testbed/Framework/Test.cpp b/Box2D/Testbed/Framework/Test.cpp +index 9e6a935..f43ee39 100644 +--- a/Box2D/Testbed/Framework/Test.cpp ++++ b/Box2D/Testbed/Framework/Test.cpp @@ -19,7 +19,11 @@ #include "Test.h" #include "Render.h" @@ -71,9 +81,10 @@ diff -urN Box2D_v2.1.2/Box2D/Testbed/Framework/Test.cpp Box2D_v2.1.2-haiku/Box2D #include -diff -urN Box2D_v2.1.2/Box2D/Testbed/Tests/TestEntries.cpp Box2D_v2.1.2-haiku/Box2D/Testbed/Tests/TestEntries.cpp ---- Box2D_v2.1.2/Box2D/Testbed/Tests/TestEntries.cpp 2010-04-17 11:18:18.035127296 +0000 -+++ Box2D_v2.1.2-haiku/Box2D/Testbed/Tests/TestEntries.cpp 2010-09-21 11:30:22.000000000 +0000 +diff --git a/Box2D/Testbed/Tests/TestEntries.cpp b/Box2D/Testbed/Tests/TestEntries.cpp +index e12c102..1ca1db1 100644 +--- a/Box2D/Testbed/Tests/TestEntries.cpp ++++ b/Box2D/Testbed/Tests/TestEntries.cpp @@ -18,7 +18,11 @@ #include "../Framework/Test.h" @@ -86,9 +97,10 @@ diff -urN Box2D_v2.1.2/Box2D/Testbed/Tests/TestEntries.cpp Box2D_v2.1.2-haiku/Bo #include #include "ApplyForce.h" -diff -urN Box2D_v2.1.2/Box2D/glui/GL/glui.h Box2D_v2.1.2-haiku/Box2D/glui/GL/glui.h ---- Box2D_v2.1.2/Box2D/glui/GL/glui.h 2010-02-01 02:12:42.030408704 +0000 -+++ Box2D_v2.1.2-haiku/Box2D/glui/GL/glui.h 2010-09-21 11:25:12.000000000 +0000 +diff --git a/Box2D/glui/GL/glui.h b/Box2D/glui/GL/glui.h +index a412a77..66a846e 100644 +--- a/Box2D/glui/GL/glui.h ++++ b/Box2D/glui/GL/glui.h @@ -49,6 +49,8 @@ #ifdef __APPLE__ @@ -98,3 +110,58 @@ diff -urN Box2D_v2.1.2/Box2D/glui/GL/glui.h Box2D_v2.1.2-haiku/Box2D/glui/GL/glu #else #include "../../freeglut/GL/glut.h" //#include +diff --git a/Box2D/glui/algebra3.cpp b/Box2D/glui/algebra3.cpp +index ddc18f4..47f93b3 100644 +--- a/Box2D/glui/algebra3.cpp ++++ b/Box2D/glui/algebra3.cpp +@@ -830,11 +830,7 @@ vec4 operator*(float d, const vec4 &a) + + vec4 operator*(const mat4 &a, const vec4 &v) + { +- #define ROWCOL(i) \ +- a.v[i].n[0]*v.n[VX] + \ +- a.v[i].n[1]*v.n[VY] + \ +- a.v[i].n[2]*v.n[VZ] + \ +- a.v[i].n[3]*v.n[VW] ++ #define ROWCOL(i) a.v[i].n[0]*v.n[VX] + a.v[i].n[1]*v.n[VY] + a.v[i].n[2]*v.n[VZ] + a.v[i].n[3]*v.n[VW] + + return vec4(ROWCOL(0), ROWCOL(1), ROWCOL(2), ROWCOL(3)); + +@@ -1107,8 +1103,7 @@ mat3 operator-(const mat3 &a, const mat3 &b) + + mat3 operator*(const mat3 &a, const mat3 &b) + { +- #define ROWCOL(i, j) \ +- a.v[i].n[0]*b.v[0][j] + a.v[i].n[1]*b.v[1][j] + a.v[i].n[2]*b.v[2][j] ++ #define ROWCOL(i, j) a.v[i].n[0]*b.v[0][j] + a.v[i].n[1]*b.v[1][j] + a.v[i].n[2]*b.v[2][j] + + return mat3( + vec3(ROWCOL(0,0), ROWCOL(0,1), ROWCOL(0,2)), +@@ -1413,11 +1408,7 @@ mat4 operator-(const mat4 &a, const mat4 &b) + + mat4 operator*(const mat4 &a, const mat4 &b) + { +- #define ROWCOL(i, j) \ +- a.v[i].n[0]*b.v[0][j] + \ +- a.v[i].n[1]*b.v[1][j] + \ +- a.v[i].n[2]*b.v[2][j] + \ +- a.v[i].n[3]*b.v[3][j] ++ #define ROWCOL(i, j) a.v[i].n[0]*b.v[0][j] + a.v[i].n[1]*b.v[1][j] + a.v[i].n[2]*b.v[2][j] + a.v[i].n[3]*b.v[3][j] + + return mat4( + vec4(ROWCOL(0,0), ROWCOL(0,1), ROWCOL(0,2), ROWCOL(0,3)), +diff --git a/Box2D/glui/glui_internal.h b/Box2D/glui/glui_internal.h +index 20efc6f..8f450e1 100644 +--- a/Box2D/glui/glui_internal.h ++++ b/Box2D/glui/glui_internal.h +@@ -74,8 +74,7 @@ + + /************ check if a 2D point lies within a 2D box ***************/ + #ifndef PT_IN_BOX +-#define PT_IN_BOX( x, y, lo_x, hi_x, lo_y, hi_y ) \ +-( IN_BOUNDS(x,lo_x,hi_x) AND IN_BOUNDS(y,lo_y,hi_y) ) ++#define PT_IN_BOX( x, y, lo_x, hi_x, lo_y, hi_y ) ( IN_BOUNDS(x,lo_x,hi_x) AND IN_BOUNDS(y,lo_y,hi_y) ) + #endif + + /****** check if value lies on proper side of another value *****/ +