| 1 | from https://patch-diff.githubusercontent.com/raw/RubyCrypto/x25519/pull/36.patch
|
| 2 |
|
| 3 | From 5886507e08488c0ed116b1979a073b78b9495683 Mon Sep 17 00:00:00 2001
|
| 4 | From: Eric Long <[email protected]>
|
| 5 | Date: Sat, 15 Apr 2023 02:58:26 +0800
|
| 6 | Subject: [PATCH] Add automatic fallback for non-x86_64 targets
|
| 7 |
|
| 8 | ---
|
| 9 | Rakefile | 2 +-
|
| 10 | ext/x25519_precomputed/extconf.rb | 6 +++---
|
| 11 | 2 files changed, 4 insertions(+), 4 deletions(-)
|
| 12 |
|
| 13 | diff --git a/Rakefile b/Rakefile
|
| 14 | index 535697c..6e4f4d3 100644
|
| 15 | |
| 16 | |
| 17 | @@ -7,7 +7,7 @@ CLEAN.include("**/*.o", "**/*.so", "**/*.bundle", "pkg", "tmp")
|
| 18 |
|
| 19 | require "rake/extensiontask"
|
| 20 | %w[precomputed ref10].each do |provider|
|
| 21 | - next if provider == "precomputed" && RUBY_PLATFORM =~ /arm64-darwin/
|
| 22 | + next if provider == "precomputed" && RUBY_PLATFORM !~ /x86_64|x64/
|
| 23 |
|
| 24 | Rake::ExtensionTask.new("x25519_#{provider}") do |ext|
|
| 25 | ext.ext_dir = "ext/x25519_#{provider}"
|
| 26 | diff --git a/ext/x25519_precomputed/extconf.rb b/ext/x25519_precomputed/extconf.rb
|
| 27 | index 7f2ba4d..b049f98 100644
|
| 28 | |
| 29 | |
| 30 | @@ -4,12 +4,12 @@
|
| 31 |
|
| 32 | require "mkmf"
|
| 33 |
|
| 34 | -if RUBY_PLATFORM =~ /arm64-darwin|aarch64-linux/
|
| 35 | - File.write("Makefile", "install clean: ;")
|
| 36 | -else
|
| 37 | +if RUBY_PLATFORM =~ /x86_64|x64/
|
| 38 | $CFLAGS << " -Wall -O3 -pedantic -std=c99 -mbmi -mbmi2 -march=haswell"
|
| 39 |
|
| 40 | create_makefile "x25519_precomputed"
|
| 41 | +else
|
| 42 | + File.write("Makefile", "install clean: ;")
|
| 43 | end
|
| 44 |
|
| 45 | # rubocop:enable Style/GlobalVars
|