From 53accccfb27ec497ba33b87534cdc5457dbc9842 Mon Sep 17 00:00:00 2001 From: Michael Cho Date: Thu, 21 Dec 2023 12:08:18 -0500 Subject: [PATCH] formula_cellar_checks: detect cpuid in static libs --- Library/Homebrew/formula_cellar_checks.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Library/Homebrew/formula_cellar_checks.rb b/Library/Homebrew/formula_cellar_checks.rb index 8a24fcdee6..5c6f562642 100644 --- a/Library/Homebrew/formula_cellar_checks.rb +++ b/Library/Homebrew/formula_cellar_checks.rb @@ -324,6 +324,14 @@ module FormulaCellarChecks cpuid_instruction?(file, objdump) end + hardlinks = Set.new + return if formula.lib.directory? && formula.lib.find.any? do |pn| + next false if pn.symlink? || pn.directory? || pn.extname != ".a" + next false unless hardlinks.add? [pn.stat.dev, pn.stat.ino] + + cpuid_instruction?(pn, objdump) + end + "No `cpuid` instruction detected. #{formula} should not use `ENV.runtime_cpu_detection`." end