(15708) use pkgbuild to create mac packages

Now that PackageMaker is deprecated, update apple task to use pkgbuild instead.

Rename {pre,post}flight scripts to {pre,post}install so they'll work with pkgbuild packages.
Cleanup some unused constants and variables.