I've send a patch through email, but upstream did not agree. In https://github.com/Homebrew/homebrew/pull/22179 this solution was accepted.