Permalink
Browse files

Extending `brew --env` to include formula info

Extending `brew --env` to include formula include paths so you can easily find keg only formula from outside of brew.
  • Loading branch information...
ashgti committed Feb 4, 2012
1 parent b597ac0 commit ba4e2507e224843755a347c212297fc467083b3b
Showing with 15 additions and 0 deletions.
  1. +15 −0 Library/Homebrew/cmd/--env.rb
@@ -6,6 +6,21 @@ def __env
ENV.extend(HomebrewEnvExtension)
ENV.setup_build_environment
ENV.universal_binary if ARGV.build_universal?
+ ARGV.formulae.each do |f|
+ # NOTE: Copied from build.rb def install (line ~63)
+ # TODO: Refactor to have a single instance of this code.
+ if dep.keg_only?
+ ENV.prepend 'LDFLAGS', "-L#{dep.lib}"
+ ENV.prepend 'CPPFLAGS', "-I#{dep.include}"
+ ENV.prepend 'PATH', "#{dep.bin}", ':'
+
+ pcdir = dep.lib/'pkgconfig'
+ ENV.prepend 'PKG_CONFIG_PATH', pcdir, ':' if pcdir.directory?
+
+ acdir = dep.share/'aclocal'
+ ENV.prepend 'ACLOCAL_PATH', acdir, ':' if acdir.directory?
+ end
+ end
if $stdout.tty?
dump_build_env ENV
else

0 comments on commit ba4e250

Please sign in to comment.