formula_cellar_checks: fix cpuid instruction check on Mojave

The output format of `objdump` on Mojave is different from newer
versions of macOS, so I've adjusted the relevant audit to account for
this difference.
This commit is contained in:
Carlo Cabrera 2021-07-08 01:43:34 +01:00
parent d5aa9f8c67
commit 16e56907b5
No known key found for this signature in database
GPG Key ID: C74D447FC549A1D0

View File

@ -345,10 +345,15 @@ module FormulaCellarChecks
def cpuid_instruction?(file, objdump = "objdump")
@instruction_column_index ||= {}
@instruction_column_index[objdump] ||= if Utils.popen_read(objdump, "--version").include? "LLVM"
1 # `llvm-objdump` or macOS `objdump`
else
2 # GNU binutils `objdump`
@instruction_column_index[objdump] ||= begin
objdump_version = Utils.popen_read(objdump, "--version")
if (objdump_version.match?(/^Apple LLVM/) && MacOS.version <= :mojave) ||
objdump_version.exclude?("LLVM")
2 # Mojave `objdump` or GNU Binutils `objdump`
else
1 # `llvm-objdump` or Catalina+ `objdump`
end
end
has_cpuid_instruction = false