test: don't try to use Xcode SDK for build requirement
This commit is contained in:
parent
993bf95877
commit
af6be13e7c
@ -2,8 +2,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stdenv
|
||||
def setup_build_environment(**options)
|
||||
generic_setup_build_environment(**options)
|
||||
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil, testing_formula: false)
|
||||
generic_setup_build_environment(formula: formula, cc: cc, build_bottle: build_bottle, bottle_arch: bottle_arch)
|
||||
|
||||
prepend_path "CPATH", HOMEBREW_PREFIX/"include"
|
||||
prepend_path "LIBRARY_PATH", HOMEBREW_PREFIX/"lib"
|
||||
|
@ -10,8 +10,8 @@ module Superenv
|
||||
end
|
||||
|
||||
# @private
|
||||
def setup_build_environment(**options)
|
||||
generic_setup_build_environment(**options)
|
||||
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil, testing_formula: false)
|
||||
generic_setup_build_environment(formula: formula, cc: cc, build_bottle: build_bottle, bottle_arch: bottle_arch)
|
||||
self["HOMEBREW_OPTIMIZATION_LEVEL"] = "O2"
|
||||
self["HOMEBREW_DYNAMIC_LINKER"] = determine_dynamic_linker_path
|
||||
self["HOMEBREW_RPATH_PATHS"] = determine_rpath_paths(@formula)
|
||||
|
@ -10,8 +10,8 @@ module Stdenv
|
||||
["#{HOMEBREW_LIBRARY}/Homebrew/os/mac/pkgconfig/#{MacOS.sdk_version}"]
|
||||
end
|
||||
|
||||
def setup_build_environment(**options)
|
||||
generic_setup_build_environment(**options)
|
||||
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil, testing_formula: false)
|
||||
generic_setup_build_environment(formula: formula, cc: cc, build_bottle: build_bottle, bottle_arch: bottle_arch)
|
||||
|
||||
# sed is strict, and errors out when it encounters files with
|
||||
# mixed character sets
|
||||
@ -19,7 +19,7 @@ module Stdenv
|
||||
self["LC_CTYPE"] = "C"
|
||||
|
||||
# Add lib and include etc. from the current macosxsdk to compiler flags:
|
||||
macosxsdk(formula: @formula)
|
||||
macosxsdk(formula: @formula, testing_formula: testing_formula)
|
||||
|
||||
return unless MacOS::Xcode.without_clt?
|
||||
|
||||
@ -50,7 +50,7 @@ module Stdenv
|
||||
remove "CMAKE_FRAMEWORK_PATH", "#{sdk}/System/Library/Frameworks"
|
||||
end
|
||||
|
||||
def macosxsdk(version = nil, formula: nil)
|
||||
def macosxsdk(version = nil, formula: nil, testing_formula: false)
|
||||
# Sets all needed lib and include dirs to CFLAGS, CPPFLAGS, LDFLAGS.
|
||||
remove_macosxsdk
|
||||
min_version = version || MacOS.version
|
||||
@ -58,7 +58,11 @@ module Stdenv
|
||||
self["CPATH"] = "#{HOMEBREW_PREFIX}/include"
|
||||
prepend "LDFLAGS", "-L#{HOMEBREW_PREFIX}/lib"
|
||||
|
||||
sdk = formula ? MacOS.sdk_for_formula(formula, version) : MacOS.sdk(version)
|
||||
sdk = if formula
|
||||
MacOS.sdk_for_formula(formula, version, check_only_runtime_requirements: testing_formula)
|
||||
else
|
||||
MacOS.sdk(version)
|
||||
end
|
||||
return if !MacOS.sdk_root_needed? && sdk&.source != :xcode
|
||||
|
||||
Homebrew::Diagnostic.checks(:fatal_setup_build_environment_checks)
|
||||
|
@ -106,8 +106,7 @@ module Superenv
|
||||
end
|
||||
|
||||
# @private
|
||||
def setup_build_environment(**options)
|
||||
formula = options[:formula]
|
||||
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil, testing_formula: false)
|
||||
sdk = formula ? MacOS.sdk_for_formula(formula) : MacOS.sdk
|
||||
if MacOS.sdk_root_needed? || sdk&.source == :xcode
|
||||
Homebrew::Diagnostic.checks(:fatal_setup_build_environment_checks)
|
||||
@ -122,7 +121,7 @@ module Superenv
|
||||
self["HOMEBREW_SDKROOT"] = nil
|
||||
self["HOMEBREW_DEVELOPER_DIR"] = nil
|
||||
end
|
||||
generic_setup_build_environment(**options)
|
||||
generic_setup_build_environment(formula: formula, cc: cc, build_bottle: build_bottle, bottle_arch: bottle_arch)
|
||||
|
||||
# Filter out symbols known not to be defined since GNU Autotools can't
|
||||
# reliably figure this out with Xcode 8 and above.
|
||||
|
@ -120,9 +120,16 @@ module OS
|
||||
sdk_locator.sdk_if_applicable(v)
|
||||
end
|
||||
|
||||
def sdk_for_formula(f, v = nil)
|
||||
def sdk_for_formula(f, v = nil, check_only_runtime_requirements: false)
|
||||
# If the formula requires Xcode, don't return the CLT SDK
|
||||
return Xcode.sdk if f.requirements.any? { |req| req.is_a? XcodeRequirement }
|
||||
# If check_only_runtime_requirements is true, don't necessarily return the
|
||||
# Xcode SDK if the XcodeRequirement is only a build or test requirment.
|
||||
return Xcode.sdk if f.requirements.any? do |req|
|
||||
next false unless req.is_a? XcodeRequirement
|
||||
next false if check_only_runtime_requirements && req.build? && !req.test?
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
sdk(v)
|
||||
end
|
||||
|
@ -36,7 +36,7 @@ begin
|
||||
formula.extend(Debrew::Formula) if args.debug?
|
||||
|
||||
ENV.extend(Stdenv)
|
||||
T.cast(ENV, Stdenv).setup_build_environment(formula: formula)
|
||||
T.cast(ENV, Stdenv).setup_build_environment(formula: formula, testing_formula: true)
|
||||
|
||||
# tests can also return false to indicate failure
|
||||
Timeout.timeout TEST_TIMEOUT_SECONDS do
|
||||
|
Loading…
x
Reference in New Issue
Block a user