2016-04-08 16:28:43 +02:00
|
|
|
#: * `sh` [`--env=std`]:
|
2017-03-05 21:45:15 -05:00
|
|
|
#: Start a Homebrew build environment shell. Uses our years-battle-hardened
|
2016-04-08 16:28:43 +02:00
|
|
|
#: Homebrew build logic to help your `./configure && make && make install`
|
|
|
|
#: or even your `gem install` succeed. Especially handy if you run Homebrew
|
|
|
|
#: in an Xcode-only configuration since it adds tools like `make` to your `PATH`
|
2017-03-05 21:45:15 -05:00
|
|
|
#: which otherwise build systems would not find.
|
|
|
|
#:
|
|
|
|
#: If `--env=std` is passed, use the standard `PATH` instead of superenv's.
|
2016-04-08 16:28:43 +02:00
|
|
|
|
2015-08-03 13:09:07 +01:00
|
|
|
require "extend/ENV"
|
|
|
|
require "formula"
|
2012-08-29 11:21:15 -04:00
|
|
|
|
2014-06-18 22:41:47 -05:00
|
|
|
module Homebrew
|
2016-09-26 01:44:51 +02:00
|
|
|
module_function
|
|
|
|
|
2012-08-29 11:21:15 -04:00
|
|
|
def sh
|
2013-08-19 12:32:56 -05:00
|
|
|
ENV.activate_extensions!
|
|
|
|
|
2012-08-29 11:21:15 -04:00
|
|
|
if superenv?
|
2016-07-12 12:01:20 +01:00
|
|
|
ENV.set_x11_env_if_installed
|
2015-06-17 22:03:50 -04:00
|
|
|
ENV.deps = Formula.installed.select { |f| f.keg_only? && f.opt_prefix.directory? }
|
2012-08-29 11:21:15 -04:00
|
|
|
end
|
|
|
|
ENV.setup_build_environment
|
2012-09-23 21:06:09 -04:00
|
|
|
if superenv?
|
2017-03-05 21:45:15 -05:00
|
|
|
# superenv stopped adding brew's bin but generally users will want it
|
2017-04-27 10:44:44 +02:00
|
|
|
ENV["PATH"] = PATH.new(PATH.new(ENV["PATH"]).to_a.insert(1, HOMEBREW_PREFIX/"bin"))
|
2012-09-23 21:06:09 -04:00
|
|
|
end
|
2015-08-03 13:09:07 +01:00
|
|
|
ENV["PS1"] = 'brew \[\033[1;32m\]\w\[\033[0m\]$ '
|
|
|
|
ENV["VERBOSE"] = "1"
|
2012-08-29 11:21:15 -04:00
|
|
|
puts <<-EOS.undent_________________________________________________________72
|
2017-03-05 21:45:15 -05:00
|
|
|
Your shell has been configured to use Homebrew's build environment;
|
2012-08-31 14:12:14 -04:00
|
|
|
this should help you build stuff. Notably though, the system versions of
|
|
|
|
gem and pip will ignore our configuration and insist on using the
|
2012-08-29 11:21:15 -04:00
|
|
|
environment they were built under (mostly). Sadly, scons will also
|
|
|
|
ignore our configuration.
|
2012-09-03 11:57:18 -04:00
|
|
|
When done, type `exit'.
|
2012-08-29 11:21:15 -04:00
|
|
|
EOS
|
2016-01-20 00:29:14 +01:00
|
|
|
$stdout.flush
|
2015-08-03 13:09:07 +01:00
|
|
|
exec ENV["SHELL"]
|
2012-08-29 11:21:15 -04:00
|
|
|
end
|
|
|
|
end
|