add pre-build hook

As requested in the user-env-compile discussion.