Make Superenv activation explicit
This commit is contained in:
parent
a04f1ac3d3
commit
bf0e329010
@ -34,6 +34,7 @@ def main
|
||||
|
||||
require 'hardware'
|
||||
require 'keg'
|
||||
require 'superenv'
|
||||
|
||||
# Force any future invocations of sudo to require the user's password to be
|
||||
# re-entered. This is in-case any build script call sudo. Certainly this is
|
||||
@ -106,7 +107,8 @@ class Build
|
||||
keg_only_deps = deps.map(&:to_formula).select(&:keg_only?)
|
||||
|
||||
pre_superenv_hacks
|
||||
require 'superenv'
|
||||
|
||||
ENV.activate_extensions!
|
||||
|
||||
deps.map(&:to_formula).each do |dep|
|
||||
opt = HOMEBREW_PREFIX/:opt/dep
|
||||
|
||||
@ -3,6 +3,8 @@ require 'hardware'
|
||||
|
||||
module Homebrew extend self
|
||||
def __env
|
||||
ENV.activate_extensions!
|
||||
|
||||
if superenv?
|
||||
ENV.deps = ARGV.formulae.map(&:name) unless ARGV.named.empty?
|
||||
end
|
||||
|
||||
@ -3,6 +3,8 @@ require 'formula'
|
||||
|
||||
module Homebrew extend self
|
||||
def sh
|
||||
ENV.activate_extensions!
|
||||
|
||||
if superenv?
|
||||
ENV.x11 = true
|
||||
ENV.deps = Formula.installed.select{|f| f.keg_only? and f.opt_prefix.directory? }.map(&:name)
|
||||
|
||||
@ -18,6 +18,19 @@ def superenv?
|
||||
true
|
||||
end
|
||||
|
||||
module EnvActivation
|
||||
def activate_extensions!
|
||||
if superenv?
|
||||
extend(Superenv)
|
||||
else
|
||||
extend(HomebrewEnvExtension)
|
||||
prepend 'PATH', "#{HOMEBREW_PREFIX}/bin", ':' unless ORIGINAL_PATHS.include? HOMEBREW_PREFIX/'bin'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ENV.extend(EnvActivation)
|
||||
|
||||
module Superenv
|
||||
attr_accessor :keg_only_deps, :deps, :x11
|
||||
alias_method :x11?, :x11
|
||||
@ -310,15 +323,6 @@ module Superenv
|
||||
end
|
||||
|
||||
|
||||
if not superenv?
|
||||
ENV.extend(HomebrewEnvExtension)
|
||||
# we must do this or tools like pkg-config won't get found by configure scripts etc.
|
||||
ENV.prepend 'PATH', "#{HOMEBREW_PREFIX}/bin", ':' unless ORIGINAL_PATHS.include? HOMEBREW_PREFIX/'bin'
|
||||
else
|
||||
ENV.extend(Superenv)
|
||||
end
|
||||
|
||||
|
||||
class Array
|
||||
def to_path_s
|
||||
map(&:to_s).uniq.select{|s| File.directory? s }.join(':').chuzzle
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user