Max Howell bcf0d6f245 superenv: Remove HOMEBREW_PREFIX/bin from PATH
We add the bins from all deps instead. Rationale: formula find and use eg. GNU-coreutils versions of things and then break. Only allow formula to use tools that they depend on and expect.

I want to go further and only add include paths etc. for dependencies, I have done some work on this, but I fear it may be impossible. If an include path is eg. /usr/local/lib/foo/include, is it possible to know if this path is bad? Not always AFAICT.
2012-09-23 21:26:50 -04:00

30 lines
1.1 KiB
Ruby

require 'superenv'
require 'formula'
module Homebrew extend self
def sh
if superenv?
ENV.x11 = true
ENV.deps = Formula.installed.select{|f| f.keg_only? and f.opt_prefix.directory? }.map(&:name)
end
ENV.setup_build_environment
if superenv?
# superenv stopped adding brew's bin but generally user's will want it
ENV['PATH'] = ENV['PATH'].split(':').insert(1, "#{HOMEBREW_PREFIX}/bin").join(':')
end
ENV['PS1'] = 'brew \[\033[1;32m\]\w\[\033[0m\]$ '
ENV['VERBOSE'] = '1'
ENV['HOMEBREW_LOG'] = '1'
puts <<-EOS.undent_________________________________________________________72
Your shell has been configured to use Homebrew's build environment:
this should help you build stuff. Notably though, the system versions of
gem and pip will ignore our configuration and insist on using the
environment they were built under (mostly). Sadly, scons will also
ignore our configuration.
All toolchain use will be logged to: ~/Library/Homebrew/Logs/cc.log
When done, type `exit'.
EOS
exec ENV['SHELL']
end
end