From eebc04ec9bfaca32024e2cb80ebf52b8ee68a7c9 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Mon, 19 Aug 2013 12:32:57 -0500 Subject: Move common stuff to extend/ENV.rb --- Library/Homebrew/extend/ENV.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'Library/Homebrew/extend') 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" -- cgit v1.2.3