projects/guix·blob python-team · refs

45 lines · 1.5 KiB

1from https://patch-diff.githubusercontent.com/raw/RubyCrypto/x25519/pull/36.patch
2
3From 5886507e08488c0ed116b1979a073b78b9495683 Mon Sep 17 00:00:00 2001
4From: Eric Long <[email protected]>
5Date: Sat, 15 Apr 2023 02:58:26 +0800
6Subject: [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
13diff --git a/Rakefile b/Rakefile
14index 535697c..6e4f4d3 100644
15--- a/Rakefile
16+++ b/Rakefile
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}"
26diff --git a/ext/x25519_precomputed/extconf.rb b/ext/x25519_precomputed/extconf.rb
27index 7f2ba4d..b049f98 100644
28--- a/ext/x25519_precomputed/extconf.rb
29+++ b/ext/x25519_precomputed/extconf.rb
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