ENV/std: port superenv SDK changes
This commit is contained in:
parent
d5ffb96d24
commit
41a666febb
@ -41,7 +41,7 @@ module Stdenv
|
|||||||
self["LC_CTYPE"] = "C"
|
self["LC_CTYPE"] = "C"
|
||||||
|
|
||||||
# Add lib and include etc. from the current macosxsdk to compiler flags:
|
# Add lib and include etc. from the current macosxsdk to compiler flags:
|
||||||
macosxsdk MacOS.version
|
macosxsdk(formula: formula)
|
||||||
|
|
||||||
return unless MacOS::Xcode.without_clt?
|
return unless MacOS::Xcode.without_clt?
|
||||||
|
|
||||||
@ -49,15 +49,15 @@ module Stdenv
|
|||||||
append_path "PATH", "#{MacOS::Xcode.toolchain_path}/usr/bin"
|
append_path "PATH", "#{MacOS::Xcode.toolchain_path}/usr/bin"
|
||||||
end
|
end
|
||||||
|
|
||||||
def remove_macosxsdk(version = MacOS.version)
|
def remove_macosxsdk(version = nil)
|
||||||
# Clear all lib and include dirs from CFLAGS, CPPFLAGS, LDFLAGS that were
|
# Clear all lib and include dirs from CFLAGS, CPPFLAGS, LDFLAGS that were
|
||||||
# previously added by macosxsdk
|
# previously added by macosxsdk
|
||||||
version = version.to_s
|
|
||||||
remove_from_cflags(/ ?-mmacosx-version-min=10\.\d+/)
|
remove_from_cflags(/ ?-mmacosx-version-min=10\.\d+/)
|
||||||
delete("CPATH")
|
delete("CPATH")
|
||||||
remove "LDFLAGS", "-L#{HOMEBREW_PREFIX}/lib"
|
remove "LDFLAGS", "-L#{HOMEBREW_PREFIX}/lib"
|
||||||
|
|
||||||
return unless (sdk = MacOS.sdk_path_if_needed(version))
|
sdk = self["SDKROOT"] || MacOS.sdk_path_if_needed(version)
|
||||||
|
return unless sdk
|
||||||
|
|
||||||
delete("SDKROOT")
|
delete("SDKROOT")
|
||||||
remove_from_cflags "-isysroot#{sdk}"
|
remove_from_cflags "-isysroot#{sdk}"
|
||||||
@ -72,15 +72,18 @@ module Stdenv
|
|||||||
remove "CMAKE_FRAMEWORK_PATH", "#{sdk}/System/Library/Frameworks"
|
remove "CMAKE_FRAMEWORK_PATH", "#{sdk}/System/Library/Frameworks"
|
||||||
end
|
end
|
||||||
|
|
||||||
def macosxsdk(version = MacOS.version)
|
def macosxsdk(version = nil, formula: nil)
|
||||||
# Sets all needed lib and include dirs to CFLAGS, CPPFLAGS, LDFLAGS.
|
# Sets all needed lib and include dirs to CFLAGS, CPPFLAGS, LDFLAGS.
|
||||||
remove_macosxsdk
|
remove_macosxsdk
|
||||||
version = version.to_s
|
min_version = version || MacOS.version
|
||||||
append_to_cflags("-mmacosx-version-min=#{version}")
|
append_to_cflags("-mmacosx-version-min=#{min_version}")
|
||||||
self["CPATH"] = "#{HOMEBREW_PREFIX}/include"
|
self["CPATH"] = "#{HOMEBREW_PREFIX}/include"
|
||||||
prepend "LDFLAGS", "-L#{HOMEBREW_PREFIX}/lib"
|
prepend "LDFLAGS", "-L#{HOMEBREW_PREFIX}/lib"
|
||||||
|
|
||||||
return unless (sdk = MacOS.sdk_path_if_needed(version))
|
sdk = formula ? MacOS.sdk_for_formula(formula, version) : MacOS.sdk(version)
|
||||||
|
return if !MacOS.sdk_root_needed? && sdk.source != :xcode
|
||||||
|
|
||||||
|
sdk = sdk.path
|
||||||
|
|
||||||
# Extra setup to support Xcode 4.3+ without CLT.
|
# Extra setup to support Xcode 4.3+ without CLT.
|
||||||
self["SDKROOT"] = sdk
|
self["SDKROOT"] = sdk
|
||||||
@ -99,10 +102,10 @@ module Stdenv
|
|||||||
# Some configure scripts won't find libxml2 without help
|
# Some configure scripts won't find libxml2 without help
|
||||||
# This is a no-op with macOS SDK 10.15.4 and later
|
# This is a no-op with macOS SDK 10.15.4 and later
|
||||||
def libxml2
|
def libxml2
|
||||||
sdk = MacOS.sdk_path_if_needed
|
sdk = self["SDKROOT"] || MacOS.sdk_path_if_needed
|
||||||
if !sdk
|
if !sdk
|
||||||
append "CPPFLAGS", "-I/usr/include/libxml2"
|
append "CPPFLAGS", "-I/usr/include/libxml2"
|
||||||
elsif !(sdk/"usr/include/libxml").directory?
|
elsif !Pathname("#{sdk}/usr/include/libxml").directory?
|
||||||
# Use the includes form the sdk
|
# Use the includes form the sdk
|
||||||
append "CPPFLAGS", "-I#{sdk}/usr/include/libxml2"
|
append "CPPFLAGS", "-I#{sdk}/usr/include/libxml2"
|
||||||
end
|
end
|
||||||
|
@ -20,9 +20,6 @@ begin
|
|||||||
error_pipe = UNIXSocket.open(ENV["HOMEBREW_ERROR_PIPE"], &:recv_io)
|
error_pipe = UNIXSocket.open(ENV["HOMEBREW_ERROR_PIPE"], &:recv_io)
|
||||||
error_pipe.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
|
error_pipe.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
|
||||||
|
|
||||||
ENV.extend(Stdenv)
|
|
||||||
ENV.setup_build_environment
|
|
||||||
|
|
||||||
trap("INT", old_trap)
|
trap("INT", old_trap)
|
||||||
|
|
||||||
formula = Homebrew.args.resolved_formulae.first
|
formula = Homebrew.args.resolved_formulae.first
|
||||||
@ -30,6 +27,9 @@ begin
|
|||||||
formula.extend(Homebrew::FreePort)
|
formula.extend(Homebrew::FreePort)
|
||||||
formula.extend(Debrew::Formula) if Homebrew.args.debug?
|
formula.extend(Debrew::Formula) if Homebrew.args.debug?
|
||||||
|
|
||||||
|
ENV.extend(Stdenv)
|
||||||
|
ENV.setup_build_environment(formula)
|
||||||
|
|
||||||
# tests can also return false to indicate failure
|
# tests can also return false to indicate failure
|
||||||
Timeout.timeout TEST_TIMEOUT_SECONDS do
|
Timeout.timeout TEST_TIMEOUT_SECONDS do
|
||||||
raise "test returned false" if formula.run_test == false
|
raise "test returned false" if formula.run_test == false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user