summary refs log tree commit diff
path: root/pkgs/development/libraries/box2d
diff options
context:
space:
mode:
authorMichael Raskin <7c6f434c@mail.ru>2010-12-17 14:15:52 +0000
committerMichael Raskin <7c6f434c@mail.ru>2010-12-17 14:15:52 +0000
commit871112b8dbd9b80689553405eb71640de0607ff1 (patch)
tree07d5579111f5eb65ae96359d916ad950595e1b93 /pkgs/development/libraries/box2d
parentaa744f88a1a51aabb42e6569ef6551c28ece2c8d (diff)
downloadnixlib-871112b8dbd9b80689553405eb71640de0607ff1.tar
nixlib-871112b8dbd9b80689553405eb71640de0607ff1.tar.gz
nixlib-871112b8dbd9b80689553405eb71640de0607ff1.tar.bz2
nixlib-871112b8dbd9b80689553405eb71640de0607ff1.tar.lz
nixlib-871112b8dbd9b80689553405eb71640de0607ff1.tar.xz
nixlib-871112b8dbd9b80689553405eb71640de0607ff1.tar.zst
nixlib-871112b8dbd9b80689553405eb71640de0607ff1.zip
Adding Box2D version 2.0.1
svn path=/nixpkgs/trunk/; revision=25174
Diffstat (limited to 'pkgs/development/libraries/box2d')
-rw-r--r--pkgs/development/libraries/box2d/2.0.1.nix78
1 files changed, 78 insertions, 0 deletions
diff --git a/pkgs/development/libraries/box2d/2.0.1.nix b/pkgs/development/libraries/box2d/2.0.1.nix
new file mode 100644
index 000000000000..d714be740eb7
--- /dev/null
+++ b/pkgs/development/libraries/box2d/2.0.1.nix
@@ -0,0 +1,78 @@
+x@{builderDefsPackage
+  , unzip, cmake, mesa, freeglut, libX11, xproto
+  , inputproto, libXi
+  , ...}:
+builderDefsPackage
+(a :  
+let 
+  helperArgNames = ["stdenv" "fetchurl" "builderDefsPackage"] ++ 
+    [];
+
+  buildInputs = map (n: builtins.getAttr n x)
+    (builtins.attrNames (builtins.removeAttrs x helperArgNames));
+  sourceInfo = rec {
+    baseName="box2d";
+    version="2.0.1";
+    name="${baseName}-${version}";
+    url="http://box2d.googlecode.com/files/Box2D_v${version}.zip";
+    hash="62857048aa089b558561074154430883cee491eedd71247f75f488cba859e21f";
+  };
+in
+rec {
+  src = a.fetchurl {
+    url = sourceInfo.url;
+    sha256 = sourceInfo.hash;
+  };
+
+  inherit (sourceInfo) name version;
+  inherit buildInputs;
+
+  phaseNames = ["fixIncludes" "setVars" "doMake" "doDeploy"];
+
+  goSrcDir = ''cd Box2D'';
+
+  fixIncludes = a.fullDepEntry ''
+    sed -i Source/Dynamics/Contacts/b2PolyContact.cpp \
+        -i Source/Dynamics/Contacts/b2CircleContact.cpp \
+        -i Source/Dynamics/Contacts/b2PolyAndCircleContact.cpp \
+        -i Source/Common/b2BlockAllocator.cpp \
+        -i Source/Collision/b2BroadPhase.cpp \
+        -i Examples/TestBed/Framework/Render.cpp \
+        -i Examples/TestBed/Tests/BroadPhaseTest.cpp \
+        -i Examples/TestBed/Tests/TestEntries.cpp \
+        -e '1i#include <string.h>'
+  '' ["minInit" "addInputs" "doUnpack"];
+
+  setVars = a.noDepEntry ''
+    export NIX_LDFLAGS="$NIX_LDFLAGS -lX11 -lXi"
+  '';
+
+  doDeploy = a.fullDepEntry ''
+    ensureDir "$out"/lib
+    ensureDir "$out"/include/Box2D
+    cp Library/* Source/Gen/float/lib*.{a,so} "$out"/lib
+    cp -r Source "$out"/include/Box2D/Source
+    find "$out"/include/Box2D/Source ! -name '*.h' -exec rm '{}' ';'
+    sed -e s@../Source@Box2D/Source@ -i Include/Box2D.h
+    cp Include/Box2D.h "$out"/include/Box2D
+    ensureDir "$out/share"
+    cp -r Examples "$out/share"
+  '' ["minInit" "addInputs" "doMake" "defEnsureDir"];
+      
+  meta = {
+    description = "2D physics engine";
+    maintainers = with a.lib.maintainers;
+    [
+      raskin
+    ];
+    platforms = with a.lib.platforms;
+      linux;
+    license = "bsd";
+  };
+  passthru = {
+    updateInfo = {
+      downloadPage = "http://code.google.com/p/box2d/downloads/list";
+    };
+  };
+}) x
+