Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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...
commit ba4e2507e224843755a347c212297fc467083b3b 1 parent b597ac0
@ashgti authored committed
Showing with 15 additions and 0 deletions.
  1. +15 −0 Library/Homebrew/cmd/--env.rb
View
15 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
Please sign in to comment.
Something went wrong with that request. Please try again.