Determine flags that were given for packages installed with homebrew

homebrew

Is there a way to check what flags were given when a package was installed with homebrew?

For example, the emacs formula has an absurd number of flags. If I did

brew install emacs --with-glib --with-librsvg

I would like to later determine that for the homebrew installation of emacs I gave the flags --with-glib --with-librsvg and not any other flags.

Test case with lua package:

Before installing the package, info shows all options.

$ brew info lua
lua: stable 5.2.3 (bottled)
http://www.lua.org/
Not installed
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/lua.rb
==> Options
--universal
    Build a universal binary
--with-completion
    Enables advanced readline support
--without-sigaction
    Revert to ANSI signal instead of improved POSIX sigaction

I install the package with just the --with-completion flag.

$ brew install lua --with-completion
==> Downloading http://www.lua.org/ftp/lua-5.2.3.tar.gz
######################################################################## 100.0%
==> Downloading http://luajit.org/patches/lua-5.2.0-advanced_readline.patch
######################################################################## 100.0%
==> Downloading http://lua-users.org/files/wiki_insecure/power_patches/5.2/lua-5
######################################################################## 100.0%
==> Patching
patching file Makefile
patching file src/Makefile
patching file src/lua.c
Hunk #1 succeeded at 231 (offset -5 lines).
Hunk #2 succeeded at 559 (offset -4 lines).
Hunk #3 succeeded at 575 (offset -4 lines).
patching file src/lua.c
==> make macosx INSTALL_TOP=/usr/local/Cellar/lua/5.2.3_1 INSTALL_MAN=/usr/local
==> make install INSTALL_TOP=/usr/local/Cellar/lua/5.2.3_1 INSTALL_MAN=/usr/loca
?  /usr/local/Cellar/lua/5.2.3_1: 13 files, 312K, built in 6 seconds

After installing the package, info shows all options, including those I did not use. The command does acknowledge that the package was built from source and not poured from a bottle.

$ brew info lua
lua: stable 5.2.3 (bottled)
http://www.lua.org/
/usr/local/Cellar/lua/5.2.3_1 (13 files, 312K) *
  Built from source with: --with-completion
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/lua.rb
==> Options
--universal
    Build a universal binary
--with-completion
    Enables advanced readline support
--without-sigaction
    Revert to ANSI signal instead of improved POSIX sigaction

Best Answer

When a package is built from source the flags that were used to build are shown when you do brew info <package>.

In this case: brew info emacs | grep "Built from source"