aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/extend
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/extend')
-rw-r--r--Library/Homebrew/extend/ENV.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/Library/Homebrew/extend/ENV.rb b/Library/Homebrew/extend/ENV.rb
index 41850fef8..5e35bace5 100644
--- a/Library/Homebrew/extend/ENV.rb
+++ b/Library/Homebrew/extend/ENV.rb
@@ -1,4 +1,25 @@
require 'hardware'
+require 'superenv'
+
+def superenv?
+ return false if MacOS::Xcode.without_clt? && MacOS.sdk_path.nil?
+ return false unless Superenv.bin && Superenv.bin.directory?
+ return false if ARGV.include? "--env=std"
+ 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 HomebrewEnvExtension
SAFE_CFLAGS_FLAGS = "-w -pipe"