2013-06-01 16:27:53 -05:00
|
|
|
require 'hardware'
|
2013-08-19 12:32:59 -05:00
|
|
|
require 'extend/ENV/shared'
|
2013-08-19 12:32:59 -05:00
|
|
|
require 'extend/ENV/std'
|
2013-08-19 12:32:59 -05:00
|
|
|
require 'extend/ENV/super'
|
2013-08-19 12:32:57 -05:00
|
|
|
|
|
|
|
def superenv?
|
2014-04-22 15:35:54 -05:00
|
|
|
Superenv.bin && Superenv.bin.directory? && ARGV.env != "std"
|
2013-08-19 12:32:57 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
module EnvActivation
|
|
|
|
def activate_extensions!
|
|
|
|
if superenv?
|
|
|
|
extend(Superenv)
|
|
|
|
else
|
2013-08-19 12:32:59 -05:00
|
|
|
extend(Stdenv)
|
2013-08-19 12:32:57 -05:00
|
|
|
end
|
|
|
|
end
|
2013-08-19 12:32:59 -05:00
|
|
|
|
|
|
|
def with_build_environment
|
|
|
|
old_env = to_hash.dup
|
|
|
|
tmp_env = to_hash.dup.extend(EnvActivation)
|
|
|
|
tmp_env.activate_extensions!
|
|
|
|
tmp_env.setup_build_environment
|
|
|
|
replace(tmp_env)
|
|
|
|
yield
|
|
|
|
ensure
|
|
|
|
replace(old_env)
|
|
|
|
end
|
2013-08-19 12:32:57 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
ENV.extend(EnvActivation)
|