Separate MacOS
references
This commit is contained in:
parent
0839e21425
commit
8704e79cc0
@ -73,9 +73,7 @@ module Homebrew
|
||||
EOS
|
||||
end
|
||||
|
||||
if args.new_issue?
|
||||
url = GitHub.create_issue(formula.tap, "#{formula.name} failed to build on #{MacOS.full_version}", url)
|
||||
end
|
||||
url = GitHub.create_issue(formula.tap, "#{formula.name} failed to build on #{OS_VERSION}", url) if args.new_issue?
|
||||
|
||||
puts url if url
|
||||
end
|
||||
|
@ -1,4 +1,8 @@
|
||||
# typed: strict
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "extend/os/linux/linkage_checker" if OS.linux?
|
||||
if OS.mac?
|
||||
require "extend/os/mac/linkage_checker"
|
||||
else
|
||||
require "extend/os/linux/linkage_checker"
|
||||
end
|
||||
|
@ -3,9 +3,31 @@
|
||||
|
||||
class Formula
|
||||
undef valid_platform?
|
||||
undef std_cmake_args
|
||||
|
||||
sig { returns(T::Boolean) }
|
||||
def valid_platform?
|
||||
requirements.none?(LinuxRequirement)
|
||||
end
|
||||
|
||||
sig {
|
||||
params(
|
||||
install_prefix: T.any(String, Pathname),
|
||||
install_libdir: T.any(String, Pathname),
|
||||
find_framework: String,
|
||||
).returns(T::Array[String])
|
||||
}
|
||||
def std_cmake_args(install_prefix: prefix, install_libdir: "lib", find_framework: "LAST")
|
||||
args = generic_std_cmake_args(install_prefix: install_prefix, install_libdir: install_libdir,
|
||||
find_framework: find_framework)
|
||||
|
||||
# Avoid false positives for clock_gettime support on 10.11.
|
||||
# CMake cache entries for other weak symbols may be added here as needed.
|
||||
args << "-DHAVE_CLOCK_GETTIME:INTERNAL=0" if MacOS.version == "10.11" && MacOS::Xcode.version >= "8.0"
|
||||
|
||||
# Ensure CMake is using the same SDK we are using.
|
||||
args << "-DCMAKE_OSX_SYSROOT=#{MacOS.sdk_for_formula(self).path}" if MacOS.sdk_root_needed?
|
||||
|
||||
args
|
||||
end
|
||||
end
|
||||
|
13
Library/Homebrew/extend/os/mac/linkage_checker.rb
Normal file
13
Library/Homebrew/extend/os/mac/linkage_checker.rb
Normal file
@ -0,0 +1,13 @@
|
||||
# typed: true
|
||||
# frozen_string_literal: true
|
||||
|
||||
class LinkageChecker
|
||||
undef system_libraries_exist_in_cache?
|
||||
|
||||
private
|
||||
|
||||
def system_libraries_exist_in_cache?
|
||||
# In macOS Big Sur and later, system libraries do not exist on-disk and instead exist in a cache.
|
||||
MacOS.version >= :big_sur
|
||||
end
|
||||
end
|
15
Library/Homebrew/extend/os/mac/utils/curl.rb
Normal file
15
Library/Homebrew/extend/os/mac/utils/curl.rb
Normal file
@ -0,0 +1,15 @@
|
||||
# typed: true
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Utils
|
||||
module Curl
|
||||
undef return_value_for_empty_http_status_code
|
||||
|
||||
def return_value_for_empty_http_status_code(url_type, url)
|
||||
# Hack around https://github.com/Homebrew/brew/issues/3199
|
||||
return if MacOS.version == :el_capitan
|
||||
|
||||
generic_return_value_for_empty_http_status_code url_type, url
|
||||
end
|
||||
end
|
||||
end
|
4
Library/Homebrew/extend/os/utils/curl.rb
Normal file
4
Library/Homebrew/extend/os/utils/curl.rb
Normal file
@ -0,0 +1,4 @@
|
||||
# typed: strict
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "extend/os/mac/utils/curl" if OS.mac?
|
@ -1646,7 +1646,7 @@ class Formula
|
||||
).returns(T::Array[String])
|
||||
}
|
||||
def std_cmake_args(install_prefix: prefix, install_libdir: "lib", find_framework: "LAST")
|
||||
args = %W[
|
||||
%W[
|
||||
-DCMAKE_INSTALL_PREFIX=#{install_prefix}
|
||||
-DCMAKE_INSTALL_LIBDIR=#{install_libdir}
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
@ -1655,16 +1655,8 @@ class Formula
|
||||
-Wno-dev
|
||||
-DBUILD_TESTING=OFF
|
||||
]
|
||||
|
||||
# Avoid false positives for clock_gettime support on 10.11.
|
||||
# CMake cache entries for other weak symbols may be added here as needed.
|
||||
args << "-DHAVE_CLOCK_GETTIME:INTERNAL=0" if MacOS.version == "10.11" && MacOS::Xcode.version >= "8.0"
|
||||
|
||||
# Ensure CMake is using the same SDK we are using.
|
||||
args << "-DCMAKE_OSX_SYSROOT=#{MacOS.sdk_for_formula(self).path}" if MacOS.sdk_root_needed?
|
||||
|
||||
args
|
||||
end
|
||||
alias generic_std_cmake_args std_cmake_args
|
||||
|
||||
# Standard parameters for Go builds.
|
||||
sig {
|
||||
|
@ -196,9 +196,8 @@ class LinkageChecker
|
||||
|
||||
if (dep = dylib_to_dep(dylib))
|
||||
@broken_deps[dep] |= [dylib]
|
||||
elsif MacOS.version >= :big_sur && dylib_found_via_dlopen(dylib)
|
||||
elsif system_libraries_exist_in_cache? && dylib_found_via_dlopen(dylib)
|
||||
# If we cannot associate the dylib with a dependency, then it may be a system library.
|
||||
# In macOS Big Sur and later, system libraries do not exist on-disk and instead exist in a cache.
|
||||
# If dlopen finds the dylib, then the linkage is not broken.
|
||||
@system_dylibs << dylib
|
||||
elsif !system_framework?(dylib)
|
||||
@ -227,6 +226,11 @@ class LinkageChecker
|
||||
end
|
||||
alias generic_check_dylibs check_dylibs
|
||||
|
||||
def system_libraries_exist_in_cache?
|
||||
false
|
||||
end
|
||||
alias generic_system_libraries_exist_in_cache? system_libraries_exist_in_cache?
|
||||
|
||||
def dylib_found_via_dlopen(dylib)
|
||||
Fiddle.dlopen(dylib).close
|
||||
true
|
||||
|
@ -320,12 +320,7 @@ module Utils
|
||||
break if http_status_ok?(details[:status_code])
|
||||
end
|
||||
|
||||
unless details[:status_code]
|
||||
# Hack around https://github.com/Homebrew/brew/issues/3199
|
||||
return if MacOS.version == :el_capitan
|
||||
|
||||
return "The #{url_type} #{url} is not reachable"
|
||||
end
|
||||
return return_value_for_empty_http_status_code(url_type, url) unless details[:status_code]
|
||||
|
||||
unless http_status_ok?(details[:status_code])
|
||||
return if details[:responses].any? do |response|
|
||||
@ -486,6 +481,11 @@ module Utils
|
||||
(100..299).cover?(status.to_i)
|
||||
end
|
||||
|
||||
def return_value_for_empty_http_status_code(url_type, url)
|
||||
"The #{url_type} #{url} is not reachable"
|
||||
end
|
||||
alias generic_return_value_for_empty_http_status_code return_value_for_empty_http_status_code
|
||||
|
||||
# Separates the output text from `curl` into an array of HTTP responses and
|
||||
# the final response body (i.e. content). Response hashes contain the
|
||||
# `:status_code`, `:status_text`, and `:headers`.
|
||||
@ -619,3 +619,5 @@ module Utils
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
require "extend/os/utils/curl"
|
||||
|
Loading…
x
Reference in New Issue
Block a user