Skip to content
Snippets Groups Projects
Commit 35a271e9 authored by Jonathan Chang's avatar Jonathan Chang
Browse files

audit: check Accelerate linkage for core formulae

parent 0265ab75
No related branches found
No related tags found
No related merge requests found
......@@ -48,6 +48,26 @@ module FormulaCellarChecks
EOS
end
def check_accelerate_framework_links
return unless @core_tap
return unless formula.prefix.directory?
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.
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|
......@@ -95,6 +115,7 @@ module FormulaCellarChecks
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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment