Created attachment 153221 [details] Port patch file ChipmunkPhysics has been updated from 6.2.1 to 7.0.0. This is a major upgrade, so expect incompatibilities if you're using an older version. Changelog can be found in the "VERSION.txt" file in any of the archives, or here: https://github.com/slembcke/Chipmunk2D/blob/7133e4afddb886fd98247993f84e9d06230e848f/VERSION.txt I have decided *NOT* to create a separate `ChipmunkPhysics6` port. If this is a problem, let me know and I'll create it. Two patches had to be applied in order to get this to build in FreeBSD (one of the issues is only a problem for the demo program). I'll report the problems upstream; hopefully, they'll be fixed by the next version.
Created attachment 153308 [details] pre-commit fixup Doesn't build on 8.4R and 9.3R: In file included from src/cpHastySpace.c:9: /usr/include/sys/sysctl.h:801: error: expected declaration specifiers or '...' before 'u_int' >++++ include/chipmunk/chipmunk.h >+@@ -32,6 +32,8 @@ >+ #ifdef WIN32 >+ // For alloca(). >+ #include <malloc.h> >++#elif defined(__FreeBSD__) >++ /* already included in <stdlib.h> */ Don't leave out DragonFly or better include all BSDs as alloca() in <stdlib.h> dates back to at least 4.4BSD Lite. https://svnweb.freebsd.org/base/vendor/CSRG/bsd_44_lite/include/stdlib.h?view=markup >+ #else >+ #include <alloca.h> >+ #endif
(In reply to Jan Beich from comment #1) Hey there. Thanks for the heads-up; any suggestions as to how to proceed? I should note that it would appear that the 7.0.0 release is also broken in Windows (one of the *officially* targeted platforms, unlike FreeBSD), because of that <sys/sysctl.h> include. Perhaps the best solution would be to wait for the next release that comes after this, *assuming* upstream fixes things up? As for the `alloca()` include, I'm taking suggestions. For now, I'll recommend to the author (if I can reach him) that he adds a #define for completely disabling any `alloca()` use in favor of `malloc()` / `free()`.
Created attachment 153349 [details] pre-commit fixup, v2 (In reply to ports from comment #2) > I should note that it would appear that the 7.0.0 release is also > broken in Windows (one of the *officially* targeted platforms, > unlike FreeBSD), because of that <sys/sysctl.h> include. Maybe limit sys/sysctl.h to __APPLE__ or convert to more portable code? Here's an example for the latter.
(In reply to Jan Beich from comment #3) I don't have access to a FreeBSD system at the moment (I will in a few days), but if anyone can confirm that the update works, feel free to use it. When I get back, I'll see if I can get Chipmunk working properly on as many platforms as I can (though granted, with my limited knowledge of other BSDs or OS X). One note/question though: Shouldn't `_SC_NPROCESSORS_ONLN` be used instead of `_SC_NPROCESSORS_CONF`? I've read that it's recommended to use `_ONLN` instead of `_CONF` because an OS might disable individual processors (or cores). Although I'm not sure what the implications would be: both for performance, i.e., would an OS re-enable them automagically in the `_CONF` case; and for portability, i.e., how well is `_ONLN` supported compared to `_CONF`.
A commit references this bug: Author: jbeich Date: Mon Feb 23 18:03:00 UTC 2015 New revision: 379695 URL: https://svnweb.freebsd.org/changeset/ports/379695 Log: - Update to 7.0.0 [1] - Convert to option helpers Changes: https://github.com/slembcke/Chipmunk2D/blob/7133e4a/VERSION.txt PR: 197852 [1] Submitted by: Tim Cas <ports@stdrand.com> (maintainer) [1] Changes: head/devel/ChipmunkPhysics/Makefile head/devel/ChipmunkPhysics/distinfo head/devel/ChipmunkPhysics/files/ head/devel/ChipmunkPhysics/files/patch-demo_CMakeLists.txt head/devel/ChipmunkPhysics/files/patch-include_chipmunk_chipmunk.h head/devel/ChipmunkPhysics/files/patch-src_cpHastySpace.c head/devel/ChipmunkPhysics/pkg-plist
(In reply to ports from comment #4) Thanks. Committed with minor changes: option helpers and s/_CONF/_ONLN/. chipmunk_demos seem to work fine within a poudriere jail. > Shouldn't `_SC_NPROCESSORS_ONLN` be used instead of `_SC_NPROCESSORS_CONF`? _CONF is the closest equivalent of hw.ncpu or .dwNumberOfProcessors. _ONLN is similar to active processor mask, non-sysconf API of which is more complicated, see {sched,cpuset}_getaffinity(). > I've read that it's recommended to use `_ONLN` instead of `_CONF` because an OS > might disable individual processors (or cores). Depends on the app e.g., NSPR switched to _CONF some time ago for consistency in behavior across #ifdef spaghetti: https://bugzilla.mozilla.org/show_bug.cgi?id=663970#c27 > > Although I'm not sure what the implications would be: both for performance, > i.e., would an OS re-enable them automagically in the `_CONF` case; and for I'm not familar with scheduling topics: power-saving, CPU hotplug, NUMA. > portability, i.e., how well is `_ONLN` supported compared to `_CONF`. DragonFly, FreeBSD and OpenBSD implement both _CONF and _ONLN via hw.ncpu which maybe either a bug or a feature. NetBSD uses hw.ncpuonline for _ONLN while FreeBSD can probably leverage kern.smp.cpus. Both _CONF and _ONLN may not be available on old versions of BSDs or OS X. "Old" is around 5 years for OpenBSD but it has very short support cycle to care about anything non-CURRENT.
Comment on attachment 153221 [details] Port patch file >++++ demo/CMakeLists.txt >+@@ -27,6 +27,10 @@ if(NOT MSVC) >+ list(APPEND chipmunk_demos_libraries m) >+ endif(NOT MSVC) >+ >++if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") >++ list(APPEND chipmunk_demos_libraries BlocksRuntime) >++endif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") >++ Doh, I didn't notice this breaks DEMOS build on FreeBSD 8.x: /usr/bin/ld: cannot find -lBlocksRuntime /usr/lib/libBlockRuntime.so exists since 9.0R while Clang is used by default since 10.0R.
A commit references this bug: Author: jbeich Date: Wed Feb 25 09:18:30 UTC 2015 New revision: 379888 URL: https://svnweb.freebsd.org/changeset/ports/379888 Log: - Unbreak DEMOS on FreeBSD 8.x after r379695 - Bump PORTREVISION to remove -lBlocksRuntime on 9.x PR: 197852 Pointy hat: jbeich Changes: head/devel/ChipmunkPhysics/Makefile head/devel/ChipmunkPhysics/files/patch-demo_CMakeLists.txt