Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Accelerate linkage, deny veclibfort & lapack #6168

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 0 additions & 23 deletions Library/Homebrew/extend/os/mac/formula_cellar_checks.rb
Expand Up @@ -48,28 +48,6 @@ def check_openssl_links
EOS
end

def check_accelerate_framework_links
return unless @core_tap
return unless formula.prefix.directory?
return if formula.name == "veclibfort" # veclibfort exists to wrap accelerate

keg = Keg.new(formula.prefix)
system_accelerate = keg.mach_o_files.select do |obj|
dlls = obj.dynamically_linked_libraries
dlls.any? { |dll| %r{^/System/Library/Frameworks/Accelerate.framework}.match dll }
end
return if system_accelerate.empty?

<<~EOS
object files were linked against system Accelerate
These object files were linked against the outdated system Accelerate framework.
Core tap formulae should link against OpenBLAS instead.
Removing `depends_on "veclibfort" and/or adding `depends_on "openblas"` to the
formula may help.
#{system_accelerate * "\n "}
EOS
end

def check_python_framework_links(lib)
python_modules = Pathname.glob lib/"python*/site-packages/**/*.so"
framework_links = python_modules.select do |obj|
Expand Down Expand Up @@ -117,7 +95,6 @@ def audit_installed
generic_audit_installed
problem_if_output(check_shadowed_headers)
problem_if_output(check_openssl_links)
problem_if_output(check_accelerate_framework_links)
problem_if_output(check_python_framework_links(formula.lib))
check_linkage
end
Expand Down
4 changes: 4 additions & 0 deletions Library/Homebrew/rubocops/text.rb
Expand Up @@ -16,6 +16,10 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node)
problem "Formulae should not depend on both OpenSSL and LibreSSL (even optionally)."
end

if depends_on?("veclibfort") || depends_on?("lapack")
problem "Formulae should use OpenBLAS as the default serial linear algebra library."
end

if method_called_ever?(body_node, :virtualenv_create) ||
method_called_ever?(body_node, :virtualenv_install_with_resources)
find_method_with_args(body_node, :resource, "setuptools") do
Expand Down