Bug 197852 - [MAINTAINER] devel/ChipmunkPhysics: update to 7.0.0
Summary: [MAINTAINER] devel/ChipmunkPhysics: update to 7.0.0
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Jan Beich
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-20 15:12 UTC by ports
Modified: 2015-02-25 09:18 UTC (History)
2 users (show)

See Also:


Attachments
Port patch file (5.02 KB, patch)
2015-02-20 15:12 UTC, ports
no flags Details | Diff
pre-commit fixup (1.23 KB, patch)
2015-02-22 08:57 UTC, Jan Beich
no flags Details | Diff
pre-commit fixup, v2 (1.96 KB, patch)
2015-02-23 02:18 UTC, Jan Beich
jbeich: maintainer-approval? (ports)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ports 2015-02-20 15:12:08 UTC
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.
Comment 1 Jan Beich freebsd_committer freebsd_triage 2015-02-22 08:57:18 UTC
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
Comment 2 ports 2015-02-22 22:52:10 UTC
(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()`.
Comment 3 Jan Beich freebsd_committer freebsd_triage 2015-02-23 02:18:44 UTC
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.
Comment 4 ports 2015-02-23 13:41:50 UTC
(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`.
Comment 5 commit-hook freebsd_committer freebsd_triage 2015-02-23 18:03:52 UTC
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
Comment 6 Jan Beich freebsd_committer freebsd_triage 2015-02-23 18:06:34 UTC
(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 7 Jan Beich freebsd_committer freebsd_triage 2015-02-25 08:52:16 UTC
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.
Comment 8 commit-hook freebsd_committer freebsd_triage 2015-02-25 09:18:56 UTC
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