diff --git a/srcpkgs/Chipmunk2D-devel b/srcpkgs/Chipmunk2D-devel new file mode 120000 index 00000000000..30953c01c83 --- /dev/null +++ b/srcpkgs/Chipmunk2D-devel @@ -0,0 +1 @@ +Chipmunk2D \ No newline at end of file diff --git a/srcpkgs/Chipmunk2D/patches/backport-zero-division.patch b/srcpkgs/Chipmunk2D/patches/backport-zero-division.patch new file mode 100644 index 00000000000..8c95a2ac832 --- /dev/null +++ b/srcpkgs/Chipmunk2D/patches/backport-zero-division.patch @@ -0,0 +1,35 @@ +From 6a5767cc5a6c8f88f8cc689c0916ddc0111308fe Mon Sep 17 00:00:00 2001 +From: Bram Stolk +Date: Fri, 30 Mar 2018 19:21:26 -0700 +Subject: [PATCH] Fix issue #144 of division by zero when setting zero mass, + zero moment. + +--- + src/cpBody.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git src/cpBody.c src/cpBody.c +index a8e0797..8ad2bc9 100644 +--- src/cpBody.c ++++ src/cpBody.c +@@ -258,7 +258,7 @@ cpBodySetMass(cpBody *body, cpFloat mass) + + cpBodyActivate(body); + body->m = mass; +- body->m_inv = 1.0f/mass; ++ body->m_inv = mass == 0.0f ? INFINITY : 1.0f/mass; + cpAssertSaneBody(body); + } + +@@ -275,7 +275,7 @@ cpBodySetMoment(cpBody *body, cpFloat moment) + + cpBodyActivate(body); + body->i = moment; +- body->i_inv = 1.0f/moment; ++ body->i_inv = moment == 0.0f ? INFINITY : 1.0f/moment; + cpAssertSaneBody(body); + } + +-- +2.21.0 + diff --git a/srcpkgs/Chipmunk2D/patches/musl-sysctl.patch b/srcpkgs/Chipmunk2D/patches/musl-sysctl.patch new file mode 100644 index 00000000000..7b154bc62a8 --- /dev/null +++ b/srcpkgs/Chipmunk2D/patches/musl-sysctl.patch @@ -0,0 +1,14 @@ +diff --git src/cpHastySpace.c src/cpHastySpace.c +index 8dca425..e087df8 100644 +--- src/cpHastySpace.c ++++ src/cpHastySpace.c +@@ -8,7 +8,9 @@ + + //#include + #ifndef _WIN32 ++#ifdef __APPLE__ + #include ++#endif + #include + #else + #ifndef WIN32_LEAN_AND_MEAN diff --git a/srcpkgs/Chipmunk2D/template b/srcpkgs/Chipmunk2D/template new file mode 100644 index 00000000000..142051ec0a4 --- /dev/null +++ b/srcpkgs/Chipmunk2D/template @@ -0,0 +1,28 @@ +# Template file for 'Chipmunk2D' +pkgname=Chipmunk2D +version=7.0.2 +revision=1 +wrksrc="Chipmunk2D-Chipmunk-${version}" +build_style=cmake +configure_args="-DBUILD_DEMOS=NO" +short_desc="Fast and lightweight 2D game physics library" +maintainer="Ekaterina Vaartis " +license="MIT" +homepage="http://chipmunk-physics.net/" +distfiles="https://github.com/slembcke/Chipmunk2D/archive/Chipmunk-${version}.tar.gz" +checksum=6b6d8d5d910c4442fb9c8c4c46a178126d8c21d075cdb3ce439a7f8d8757b0ca + +post_install() { + vlicense LICENSE.txt +} + +Chipmunk2D-devel_package() { + short_desc+=" - development files" + depends="${sourcepkg}>=${version}_${revision}" + + pkg_install() { + vmove usr/include + vmove "usr/lib/*.a" + vmove "usr/lib/*.so" + } +} diff --git a/srcpkgs/Chipmunk2D/update b/srcpkgs/Chipmunk2D/update new file mode 100644 index 00000000000..e75cea43752 --- /dev/null +++ b/srcpkgs/Chipmunk2D/update @@ -0,0 +1 @@ +pkgname=Chipmunk