me
/
guix
Archived
1
0
Fork 0

gnu: ruby-x25519: Fix build on non x86_64.

* gnu/packages/patches/ruby-x25519-automatic-fallback-non-x86_64.patch:
New patch.
* gnu/packages/ruby.scm (ruby-x25519)[source]: Use it.
* gnu/local.mk (dist_patch_DATA): Register it.

Change-Id: If9c3b8dd8d818094f4cc5392bd5717f1430c369a
Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
master
Zheng Junjie 2024-03-09 16:21:07 +08:00 committed by Efraim Flashner
parent a42ce77f1b
commit fc1762fe38
No known key found for this signature in database
GPG Key ID: 41AAE7DCCA3D8351
3 changed files with 51 additions and 2 deletions

View File

@ -1999,6 +1999,7 @@ dist_patch_DATA = \
%D%/packages/patches/ruby-latex-decode-fix-test.patch \
%D%/packages/patches/ruby-mustache-1.1.1-fix-race-condition-tests.patch \
%D%/packages/patches/ruby-nokogiri.patch \
%D%/packages/patches/ruby-x25519-automatic-fallback-non-x86_64.patch \
%D%/packages/patches/rustc-1.54.0-src.patch \
%D%/packages/patches/rust-1.64-fix-riscv64-bootstrap.patch \
%D%/packages/patches/rust-1.70-fix-rustix-build.patch \

View File

@ -0,0 +1,45 @@
from https://patch-diff.githubusercontent.com/raw/RubyCrypto/x25519/pull/36.patch
From 5886507e08488c0ed116b1979a073b78b9495683 Mon Sep 17 00:00:00 2001
From: Eric Long <i@hack3r.moe>
Date: Sat, 15 Apr 2023 02:58:26 +0800
Subject: [PATCH] Add automatic fallback for non-x86_64 targets
---
Rakefile | 2 +-
ext/x25519_precomputed/extconf.rb | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/Rakefile b/Rakefile
index 535697c..6e4f4d3 100644
--- a/Rakefile
+++ b/Rakefile
@@ -7,7 +7,7 @@ CLEAN.include("**/*.o", "**/*.so", "**/*.bundle", "pkg", "tmp")
require "rake/extensiontask"
%w[precomputed ref10].each do |provider|
- next if provider == "precomputed" && RUBY_PLATFORM =~ /arm64-darwin/
+ next if provider == "precomputed" && RUBY_PLATFORM !~ /x86_64|x64/
Rake::ExtensionTask.new("x25519_#{provider}") do |ext|
ext.ext_dir = "ext/x25519_#{provider}"
diff --git a/ext/x25519_precomputed/extconf.rb b/ext/x25519_precomputed/extconf.rb
index 7f2ba4d..b049f98 100644
--- a/ext/x25519_precomputed/extconf.rb
+++ b/ext/x25519_precomputed/extconf.rb
@@ -4,12 +4,12 @@
require "mkmf"
-if RUBY_PLATFORM =~ /arm64-darwin|aarch64-linux/
- File.write("Makefile", "install clean: ;")
-else
+if RUBY_PLATFORM =~ /x86_64|x64/
$CFLAGS << " -Wall -O3 -pedantic -std=c99 -mbmi -mbmi2 -march=haswell"
create_makefile "x25519_precomputed"
+else
+ File.write("Makefile", "install clean: ;")
end
# rubocop:enable Style/GlobalVars

View File

@ -34,7 +34,7 @@
;;; Copyright © 2023 Yovan Naumovski <yovan@gorski.stream>
;;; Copyright © 2023 gemmaro <gemmaro.dev@gmail.com>
;;; Copyright © 2023 Janneke Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2023 Zheng Junjie <873216071@qq.com>
;;; Copyright © 2023, 2024 Zheng Junjie <873216071@qq.com>
;;; Copyright © 2023, 2024 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;;
;;; This file is part of GNU Guix.
@ -3258,7 +3258,10 @@ error streams.")
(file-name (git-file-name name version))
(sha256
(base32
"1g0311ly32f6hfn4q5fvkbjbl2bhv1l9fx6s0kglxfsrwq51926y"))))
"1g0311ly32f6hfn4q5fvkbjbl2bhv1l9fx6s0kglxfsrwq51926y"))
(patches
(search-patches
"ruby-x25519-automatic-fallback-non-x86_64.patch"))))
(build-system ruby-build-system)
(arguments
(list #:test-target "spec"