It seems homebrew has removed all the options (incl. --with-cocoa) for brew install emacs. Now it recommends to use brew cask install emacs to get a built binary from https://emacsformacosx.com/. However, it is not clear to me which options are used to build the binary. The ones I care about are:

--with-modules --with-cocoa --with-gnutls --with-librsvg

Is there still a way to use homebrew to build the latest emacs but with the options above? If not possible, then how do we build emacs from source on OS X (10.12+) with those options