Move common stuff to extend/ENV.rb
This commit is contained in:
parent
bf0e329010
commit
eebc04ec9b
@ -34,7 +34,7 @@ def main
|
|||||||
|
|
||||||
require 'hardware'
|
require 'hardware'
|
||||||
require 'keg'
|
require 'keg'
|
||||||
require 'superenv'
|
require 'extend/ENV'
|
||||||
|
|
||||||
# Force any future invocations of sudo to require the user's password to be
|
# 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
|
# re-entered. This is in-case any build script call sudo. Certainly this is
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
require 'superenv'
|
require 'extend/ENV'
|
||||||
require 'hardware'
|
require 'hardware'
|
||||||
|
|
||||||
module Homebrew extend self
|
module Homebrew extend self
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
require 'formula'
|
require 'formula'
|
||||||
require 'utils'
|
require 'utils'
|
||||||
require 'superenv'
|
require 'extend/ENV'
|
||||||
require 'formula_cellar_checks'
|
require 'formula_cellar_checks'
|
||||||
|
|
||||||
module Homebrew extend self
|
module Homebrew extend self
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
require 'superenv'
|
require 'extend/ENV'
|
||||||
require 'formula'
|
require 'formula'
|
||||||
|
|
||||||
module Homebrew extend self
|
module Homebrew extend self
|
||||||
|
|||||||
@ -1,4 +1,25 @@
|
|||||||
require 'hardware'
|
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
|
module HomebrewEnvExtension
|
||||||
SAFE_CFLAGS_FLAGS = "-w -pipe"
|
SAFE_CFLAGS_FLAGS = "-w -pipe"
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
require 'dependable'
|
require 'dependable'
|
||||||
require 'dependency'
|
require 'dependency'
|
||||||
require 'build_environment'
|
require 'build_environment'
|
||||||
|
require 'extend/ENV'
|
||||||
|
|
||||||
# A base class for non-formula requirements needed by formulae.
|
# A base class for non-formula requirements needed by formulae.
|
||||||
# A "fatal" requirement is one that will fail the build if it is not present.
|
# A "fatal" requirement is one that will fail the build if it is not present.
|
||||||
@ -117,7 +118,6 @@ class Requirement
|
|||||||
if instance_variable_defined?(:@satisfied)
|
if instance_variable_defined?(:@satisfied)
|
||||||
@satisfied
|
@satisfied
|
||||||
elsif @options[:build_env]
|
elsif @options[:build_env]
|
||||||
require 'superenv'
|
|
||||||
ENV.with_build_environment do
|
ENV.with_build_environment do
|
||||||
ENV.userpaths!
|
ENV.userpaths!
|
||||||
yield @proc
|
yield @proc
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
require 'extend/ENV'
|
|
||||||
require 'macos'
|
require 'macos'
|
||||||
|
|
||||||
### Why `superenv`?
|
### Why `superenv`?
|
||||||
@ -11,26 +10,6 @@ require 'macos'
|
|||||||
# 7) Simpler formula that *just work*
|
# 7) Simpler formula that *just work*
|
||||||
# 8) Build-system agnostic configuration of the tool-chain
|
# 8) Build-system agnostic configuration of the tool-chain
|
||||||
|
|
||||||
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 Superenv
|
module Superenv
|
||||||
attr_accessor :keg_only_deps, :deps, :x11
|
attr_accessor :keg_only_deps, :deps, :x11
|
||||||
alias_method :x11?, :x11
|
alias_method :x11?, :x11
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user