pkgbuild: various improvements

This is similar to #29, although there's also some PKGBUILD changes. The commit message should be sufficient, but if not just ask.