Use effective_arch for rustflags
This commit is contained in:
parent
09223c700a
commit
22d42efb5c
@ -34,7 +34,7 @@ module Stdenv
|
||||
self["PKG_CONFIG_LIBDIR"] = determine_pkg_config_libdir
|
||||
|
||||
self["MAKEFLAGS"] = "-j#{make_jobs}"
|
||||
self["RUSTFLAGS"] = Hardware.rustflags_target_cpu
|
||||
self["RUSTFLAGS"] = Hardware.rustflags_target_cpu(effective_arch)
|
||||
|
||||
if HOMEBREW_PREFIX.to_s != "/usr/local"
|
||||
# /usr/local is already an -isystem and -L directory so we skip it
|
||||
|
||||
@ -62,7 +62,7 @@ module Superenv
|
||||
|
||||
self["HOMEBREW_ENV"] = "super"
|
||||
self["MAKEFLAGS"] ||= "-j#{determine_make_jobs}"
|
||||
self["RUSTFLAGS"] = Hardware.rustflags_target_cpu
|
||||
self["RUSTFLAGS"] = Hardware.rustflags_target_cpu(effective_arch)
|
||||
self["PATH"] = determine_path
|
||||
self["PKG_CONFIG_PATH"] = determine_pkg_config_path
|
||||
self["PKG_CONFIG_LIBDIR"] = determine_pkg_config_libdir
|
||||
|
||||
@ -226,16 +226,16 @@ module Hardware
|
||||
|
||||
# Returns a Rust flag to set the target CPU if necessary.
|
||||
# Defaults to nil.
|
||||
sig { returns(T.nilable(String)) }
|
||||
def rustflags_target_cpu
|
||||
sig { params(arch: Symbol).returns(T.nilable(String)) }
|
||||
def rustflags_target_cpu(arch)
|
||||
# Rust already defaults to the oldest supported cpu for each target-triplet
|
||||
# so it's safe to ignore generic archs such as :armv6 here.
|
||||
# Rust defaults to apple-m1 since Rust 1.71 for aarch64-apple-darwin.
|
||||
@target_cpu ||= case (cpu = oldest_cpu)
|
||||
@target_cpu ||= case (arch)
|
||||
when :core
|
||||
:prescott
|
||||
when :native, :ivybridge, :sandybridge, :westmere, :nehalem, :core2
|
||||
cpu
|
||||
arch
|
||||
end
|
||||
return if @target_cpu.blank?
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user