Fix build with NetBSD's current gcc 4.1.2. Bump PKGREVISION to 9. Approved by maintainer.
- add some missing #ifdef __NetBSD__ and restore some Linux #includes - use subst framework instead of hardcoding /kern paths in patches