Improve style
This commit is contained in:
parent
e46a61e181
commit
cd9fe97c55
@ -78,13 +78,8 @@ class Build
|
|||||||
ENV.keg_only_deps = keg_only_deps
|
ENV.keg_only_deps = keg_only_deps
|
||||||
ENV.deps = formula_deps
|
ENV.deps = formula_deps
|
||||||
ENV.run_time_deps = run_time_deps
|
ENV.run_time_deps = run_time_deps
|
||||||
ENV.setup_build_environment(
|
ENV.setup_build_environment(formula: formula, cc: args.cc, build_bottle: args.build_bottle?,
|
||||||
formula: formula,
|
bottle_arch: args.bottle_arch, debug_symbols: args.debug_symbols?)
|
||||||
cc: args.cc,
|
|
||||||
build_bottle: args.build_bottle?,
|
|
||||||
bottle_arch: args.bottle_arch,
|
|
||||||
debug_symbols: args.debug_symbols?,
|
|
||||||
)
|
|
||||||
reqs.each do |req|
|
reqs.each do |req|
|
||||||
req.modify_build_environment(
|
req.modify_build_environment(
|
||||||
env: args.env, cc: args.cc, build_bottle: args.build_bottle?, bottle_arch: args.bottle_arch,
|
env: args.env, cc: args.cc, build_bottle: args.build_bottle?, bottle_arch: args.bottle_arch,
|
||||||
@ -92,13 +87,8 @@ class Build
|
|||||||
end
|
end
|
||||||
deps.each(&:modify_build_environment)
|
deps.each(&:modify_build_environment)
|
||||||
else
|
else
|
||||||
ENV.setup_build_environment(
|
ENV.setup_build_environment(formula: formula, cc: args.cc, build_bottle: args.build_bottle?,
|
||||||
formula: formula,
|
bottle_arch: args.bottle_arch, debug_symbols: args.debug_symbols?)
|
||||||
cc: args.cc,
|
|
||||||
build_bottle: args.build_bottle?,
|
|
||||||
bottle_arch: args.bottle_arch,
|
|
||||||
debug_symbols: args.debug_symbols?,
|
|
||||||
)
|
|
||||||
reqs.each do |req|
|
reqs.each do |req|
|
||||||
req.modify_build_environment(
|
req.modify_build_environment(
|
||||||
env: args.env, cc: args.cc, build_bottle: args.build_bottle?, bottle_arch: args.bottle_arch,
|
env: args.env, cc: args.cc, build_bottle: args.build_bottle?, bottle_arch: args.bottle_arch,
|
||||||
|
|||||||
@ -41,22 +41,13 @@ module EnvActivation
|
|||||||
_block: T.proc.returns(T.untyped),
|
_block: T.proc.returns(T.untyped),
|
||||||
).returns(T.untyped)
|
).returns(T.untyped)
|
||||||
}
|
}
|
||||||
def with_build_environment(
|
def with_build_environment(env: nil, cc: nil, build_bottle: false, bottle_arch: nil, debug_symbols: false, &_block)
|
||||||
env: nil,
|
|
||||||
cc: nil,
|
|
||||||
build_bottle: false,
|
|
||||||
bottle_arch: nil,
|
|
||||||
debug_symbols: false,
|
|
||||||
&_block
|
|
||||||
)
|
|
||||||
old_env = to_hash.dup
|
old_env = to_hash.dup
|
||||||
tmp_env = to_hash.dup.extend(EnvActivation)
|
tmp_env = to_hash.dup.extend(EnvActivation)
|
||||||
T.cast(tmp_env, EnvActivation).activate_extensions!(env: env)
|
T.cast(tmp_env, EnvActivation).activate_extensions!(env: env)
|
||||||
T.cast(tmp_env, T.any(Superenv, Stdenv))
|
T.cast(tmp_env, T.any(Superenv, Stdenv))
|
||||||
.setup_build_environment(
|
.setup_build_environment(cc: cc, build_bottle: build_bottle, bottle_arch: bottle_arch,
|
||||||
cc: cc, build_bottle: build_bottle, bottle_arch: bottle_arch,
|
debug_symbols: debug_symbols)
|
||||||
debug_symbols: debug_symbols
|
|
||||||
)
|
|
||||||
replace(tmp_env)
|
replace(tmp_env)
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
|||||||
@ -43,14 +43,8 @@ module SharedEnvExtension
|
|||||||
debug_symbols: T.nilable(T::Boolean),
|
debug_symbols: T.nilable(T::Boolean),
|
||||||
).void
|
).void
|
||||||
}
|
}
|
||||||
def setup_build_environment(
|
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil, testing_formula: false,
|
||||||
formula: nil,
|
debug_symbols: false)
|
||||||
cc: nil,
|
|
||||||
build_bottle: false,
|
|
||||||
bottle_arch: nil,
|
|
||||||
testing_formula: false,
|
|
||||||
debug_symbols: false
|
|
||||||
)
|
|
||||||
@formula = formula
|
@formula = formula
|
||||||
@cc = cc
|
@cc = cc
|
||||||
@build_bottle = build_bottle
|
@build_bottle = build_bottle
|
||||||
|
|||||||
@ -24,14 +24,8 @@ module Stdenv
|
|||||||
debug_symbols: T.nilable(T::Boolean),
|
debug_symbols: T.nilable(T::Boolean),
|
||||||
).void
|
).void
|
||||||
}
|
}
|
||||||
def setup_build_environment(
|
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil, testing_formula: false,
|
||||||
formula: nil,
|
debug_symbols: false)
|
||||||
cc: nil,
|
|
||||||
build_bottle: false,
|
|
||||||
bottle_arch: nil,
|
|
||||||
testing_formula: false,
|
|
||||||
debug_symbols: false
|
|
||||||
)
|
|
||||||
super
|
super
|
||||||
|
|
||||||
self["HOMEBREW_ENV"] = "std"
|
self["HOMEBREW_ENV"] = "std"
|
||||||
|
|||||||
@ -58,14 +58,8 @@ module Superenv
|
|||||||
debug_symbols: T.nilable(T::Boolean),
|
debug_symbols: T.nilable(T::Boolean),
|
||||||
).void
|
).void
|
||||||
}
|
}
|
||||||
def setup_build_environment(
|
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil, testing_formula: false,
|
||||||
formula: nil,
|
debug_symbols: false)
|
||||||
cc: nil,
|
|
||||||
build_bottle: false,
|
|
||||||
bottle_arch: nil,
|
|
||||||
testing_formula: false,
|
|
||||||
debug_symbols: false
|
|
||||||
)
|
|
||||||
super
|
super
|
||||||
send(compiler)
|
send(compiler)
|
||||||
|
|
||||||
|
|||||||
@ -2,19 +2,10 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Stdenv
|
module Stdenv
|
||||||
def setup_build_environment(
|
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil, testing_formula: false,
|
||||||
formula: nil,
|
debug_symbols: false)
|
||||||
cc: nil,
|
generic_setup_build_environment(formula: formula, cc: cc, build_bottle: build_bottle, bottle_arch: bottle_arch,
|
||||||
build_bottle: false,
|
testing_formula: testing_formula, debug_symbols: debug_symbols)
|
||||||
bottle_arch: nil,
|
|
||||||
testing_formula: false,
|
|
||||||
debug_symbols: false
|
|
||||||
)
|
|
||||||
generic_setup_build_environment(
|
|
||||||
formula: formula, cc: cc, build_bottle: build_bottle,
|
|
||||||
bottle_arch: bottle_arch, testing_formula: testing_formula,
|
|
||||||
debug_symbols: debug_symbols
|
|
||||||
)
|
|
||||||
|
|
||||||
prepend_path "CPATH", HOMEBREW_PREFIX/"include"
|
prepend_path "CPATH", HOMEBREW_PREFIX/"include"
|
||||||
prepend_path "LIBRARY_PATH", HOMEBREW_PREFIX/"lib"
|
prepend_path "LIBRARY_PATH", HOMEBREW_PREFIX/"lib"
|
||||||
|
|||||||
@ -15,19 +15,10 @@ module Superenv
|
|||||||
end
|
end
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
def setup_build_environment(
|
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil, testing_formula: false,
|
||||||
formula: nil,
|
debug_symbols: false)
|
||||||
cc: nil,
|
generic_setup_build_environment(formula: formula, cc: cc, build_bottle: build_bottle, bottle_arch: bottle_arch,
|
||||||
build_bottle: false,
|
testing_formula: testing_formula, debug_symbols: debug_symbols)
|
||||||
bottle_arch: nil,
|
|
||||||
testing_formula: false,
|
|
||||||
debug_symbols: false
|
|
||||||
)
|
|
||||||
generic_setup_build_environment(
|
|
||||||
formula: formula, cc: cc, build_bottle: build_bottle,
|
|
||||||
bottle_arch: bottle_arch, testing_formula: testing_formula,
|
|
||||||
debug_symbols: debug_symbols
|
|
||||||
)
|
|
||||||
self["HOMEBREW_OPTIMIZATION_LEVEL"] = "O2"
|
self["HOMEBREW_OPTIMIZATION_LEVEL"] = "O2"
|
||||||
self["HOMEBREW_DYNAMIC_LINKER"] = determine_dynamic_linker_path
|
self["HOMEBREW_DYNAMIC_LINKER"] = determine_dynamic_linker_path
|
||||||
self["HOMEBREW_RPATH_PATHS"] = determine_rpath_paths(@formula)
|
self["HOMEBREW_RPATH_PATHS"] = determine_rpath_paths(@formula)
|
||||||
|
|||||||
@ -13,9 +13,8 @@ module SharedEnvExtension
|
|||||||
debug_symbols: false
|
debug_symbols: false
|
||||||
)
|
)
|
||||||
generic_shared_setup_build_environment(
|
generic_shared_setup_build_environment(
|
||||||
formula: formula, cc: cc, build_bottle: build_bottle,
|
formula: formula, cc: cc, build_bottle: build_bottle, bottle_arch: bottle_arch,
|
||||||
bottle_arch: bottle_arch, testing_formula: testing_formula,
|
testing_formula: testing_formula, debug_symbols: debug_symbols
|
||||||
debug_symbols: debug_symbols
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Normalise the system Perl version used, where multiple may be available
|
# Normalise the system Perl version used, where multiple may be available
|
||||||
|
|||||||
@ -18,11 +18,8 @@ module Stdenv
|
|||||||
testing_formula: false,
|
testing_formula: false,
|
||||||
debug_symbols: false
|
debug_symbols: false
|
||||||
)
|
)
|
||||||
generic_setup_build_environment(
|
generic_setup_build_environment(formula: formula, cc: cc, build_bottle: build_bottle, bottle_arch: bottle_arch,
|
||||||
formula: formula, cc: cc, build_bottle: build_bottle,
|
testing_formula: testing_formula, debug_symbols: debug_symbols)
|
||||||
bottle_arch: bottle_arch, testing_formula: testing_formula,
|
|
||||||
debug_symbols: debug_symbols
|
|
||||||
)
|
|
||||||
|
|
||||||
append "LDFLAGS", "-Wl,-headerpad_max_install_names"
|
append "LDFLAGS", "-Wl,-headerpad_max_install_names"
|
||||||
|
|
||||||
|
|||||||
@ -85,14 +85,8 @@ module Superenv
|
|||||||
end
|
end
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
def setup_build_environment(
|
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil, testing_formula: false,
|
||||||
formula: nil,
|
debug_symbols: false)
|
||||||
cc: nil,
|
|
||||||
build_bottle: false,
|
|
||||||
bottle_arch: nil,
|
|
||||||
testing_formula: false,
|
|
||||||
debug_symbols: false
|
|
||||||
)
|
|
||||||
sdk = formula ? MacOS.sdk_for_formula(formula) : MacOS.sdk
|
sdk = formula ? MacOS.sdk_for_formula(formula) : MacOS.sdk
|
||||||
is_xcode_sdk = sdk&.source == :xcode
|
is_xcode_sdk = sdk&.source == :xcode
|
||||||
|
|
||||||
@ -108,9 +102,8 @@ module Superenv
|
|||||||
end
|
end
|
||||||
|
|
||||||
generic_setup_build_environment(
|
generic_setup_build_environment(
|
||||||
formula: formula, cc: cc, build_bottle: build_bottle,
|
formula: formula, cc: cc, build_bottle: build_bottle, bottle_arch: bottle_arch,
|
||||||
bottle_arch: bottle_arch, testing_formula: testing_formula,
|
testing_formula: testing_formula, debug_symbols: debug_symbols
|
||||||
debug_symbols: debug_symbols
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Filter out symbols known not to be defined since GNU Autotools can't
|
# Filter out symbols known not to be defined since GNU Autotools can't
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user