make formula resemble official version

Add handling for different environments.  Patch the prefix path. Etc.