summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Ferk <andrewferk@gmail.com>2021-05-11 11:05:29 -0700
committerAndrew Ferk <andrewferk@gmail.com>2021-05-11 11:05:55 -0700
commit305600997c5d2a513cf788850faa208f4aecfcb8 (patch)
tree5b05696ff473286a56c6259abf53644b3b8ee6a5
parent4430b6d5fe720f9cb84a845a0bee9abf23e22cea (diff)
downloadffi-305600997c5d2a513cf788850faa208f4aecfcb8.tar.gz
Use arm or aarch64 to identify Apple ARM CPU arch
Some versions of Ruby are identifying Apple M1 hosts as 'arm-apple-darwin20.3.0' and others 'aarch64-apple-darwin20.3.0'. * Ruby 2.6.5 - `RbConfig::CONFIG['host'] == 'arm-apple-darwin20.3.0'` * Ruby 2.6.7 - `RbConfig::CONFIG['host'] == 'aarch64-apple-darwin20.3.0'`
-rw-r--r--ext/ffi_c/extconf.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/ffi_c/extconf.rb b/ext/ffi_c/extconf.rb
index cdeaa9b..aaf558a 100644
--- a/ext/ffi_c/extconf.rb
+++ b/ext/ffi_c/extconf.rb
@@ -57,7 +57,7 @@ if RUBY_ENGINE == 'ruby' || RUBY_ENGINE == 'rbx'
append_ldflags "-Wl,--exclude-libs,ALL"
end
- ffi_alloc_default = RbConfig::CONFIG['host_os'] =~ /darwin/i && RbConfig::CONFIG['host'] =~ /arm/i
+ ffi_alloc_default = RbConfig::CONFIG['host_os'] =~ /darwin/i && RbConfig::CONFIG['host'] =~ /arm|aarch64/i
if enable_config('libffi-alloc', ffi_alloc_default)
$defs << "-DUSE_FFI_ALLOC"
end
@@ -71,7 +71,7 @@ if RUBY_ENGINE == 'ruby' || RUBY_ENGINE == 'rbx'
File.open("Makefile", "a") do |mf|
mf.puts "LIBFFI_HOST=--host=#{RbConfig::CONFIG['host_alias']}" if RbConfig::CONFIG.has_key?("host_alias")
if RbConfig::CONFIG['host_os'] =~ /darwin/i
- if RbConfig::CONFIG['host'] =~ /arm/i
+ if RbConfig::CONFIG['host'] =~ /arm|aarch64/i
mf.puts "LIBFFI_HOST=--host=aarch64-apple-#{RbConfig::CONFIG['host_os']}"
end
mf.puts "include ${srcdir}/libffi.darwin.mk"