Merge pull request #19551 from Homebrew/runtime-cpu-detect-optflags

shims/super/cc: tweak optimisation flag handling for runtime CPU detection builds
This commit is contained in:
Carlo Cabrera 2025-03-20 07:55:34 +00:00 committed by GitHub
commit f3bd91d3af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -308,7 +308,10 @@ class Cmd
args << "-w" unless configure? args << "-w" unless configure?
args << "-#{ENV["HOMEBREW_OPTIMIZATION_LEVEL"]}" args << "-#{ENV["HOMEBREW_OPTIMIZATION_LEVEL"]}"
args.concat(optflags) unless runtime_cpu_detection? optflags.each do |optflag|
flag = optflag.split("=").first
args << optflag if !runtime_cpu_detection? || @args.none? { |arg| arg.start_with?(flag) }
end
args.concat(archflags) args.concat(archflags)
args << "-std=#{@arg0}" if /c[89]9/.match?(@arg0) args << "-std=#{@arg0}" if /c[89]9/.match?(@arg0)
args << "-g" if debug_symbols? args << "-g" if debug_symbols?