move fixup_bundle_environment() code into per-platform files