aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/extend
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/extend')
-rw-r--r--Library/Homebrew/extend/ENV.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/Library/Homebrew/extend/ENV.rb b/Library/Homebrew/extend/ENV.rb
index 095d05b70..6ac5a0db2 100644
--- a/Library/Homebrew/extend/ENV.rb
+++ b/Library/Homebrew/extend/ENV.rb
@@ -438,6 +438,14 @@ class << ENV
self['PATH'] = paths.unshift(*self['PATH'].split(":")).uniq.join(":")
end
+ def with_build_environment
+ old_env = to_hash
+ setup_build_environment
+ yield
+ ensure
+ replace(old_env)
+ end
+
def fortran
fc_flag_vars = %w{FCFLAGS FFLAGS}