GNU bug report logs - #69670
[PATCH] gnu: ruby-x25519: Fix build on non x86_64.

Previous Next

Package: guix-patches;

Reported by: Zheng Junjie <zhengjunjie <at> iscas.ac.cn>

Date: Sat, 9 Mar 2024 08:30:02 UTC

Severity: normal

Tags: patch

Done: Efraim Flashner <efraim <at> flashner.co.il>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 69670 in the body.
You can then email your comments to 69670 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix <at> cbaines.net, guix-patches <at> gnu.org:
bug#69670; Package guix-patches. (Sat, 09 Mar 2024 08:30:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Zheng Junjie <zhengjunjie <at> iscas.ac.cn>:
New bug report received and forwarded. Copy sent to guix <at> cbaines.net, guix-patches <at> gnu.org. (Sat, 09 Mar 2024 08:30:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Zheng Junjie <zhengjunjie <at> iscas.ac.cn>
To: guix-patches <at> gnu.org
Subject: [PATCH] gnu: ruby-x25519: Fix build on non x86_64.
Date: Sat,  9 Mar 2024 16:21:07 +0800
* 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): Regist it.

Change-Id: If9c3b8dd8d818094f4cc5392bd5717f1430c369a
---
 gnu/local.mk                                  |  1 +
 ...x25519-automatic-fallback-non-x86_64.patch | 45 +++++++++++++++++++
 gnu/packages/ruby.scm                         |  7 ++-
 3 files changed, 51 insertions(+), 2 deletions(-)
 create mode 100644 gnu/packages/patches/ruby-x25519-automatic-fallback-non-x86_64.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index e5d1700077..1e21ab43f1 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1989,6 +1989,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/rocm-comgr-3.1.0-dependencies.patch 	\
   %D%/packages/patches/rocm-opencl-runtime-4.3-noclinfo.patch 	\
   %D%/packages/patches/rottlog-direntry.patch 			\
+  %D%/packages/patches/ruby-x25519-automatic-fallback-non-x86_64.patch \
   %D%/packages/patches/ruby-hiredis-use-system-hiredis.patch	\
   %D%/packages/patches/ruby-hydra-minimal-no-byebug.patch	\
   %D%/packages/patches/ruby-anystyle-data-immutable-install.patch	\
diff --git a/gnu/packages/patches/ruby-x25519-automatic-fallback-non-x86_64.patch b/gnu/packages/patches/ruby-x25519-automatic-fallback-non-x86_64.patch
new file mode 100644
index 0000000000..cd501bb343
--- /dev/null
+++ b/gnu/packages/patches/ruby-x25519-automatic-fallback-non-x86_64.patch
@@ -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 <at> 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
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index e6d51b94e2..9a28ecf9f5 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -34,7 +34,7 @@
 ;;; Copyright © 2023 Yovan Naumovski <yovan <at> gorski.stream>
 ;;; Copyright © 2023 gemmaro <gemmaro.dev <at> gmail.com>
 ;;; Copyright © 2023 Janneke Nieuwenhuizen <janneke <at> gnu.org>
-;;; Copyright © 2023 Zheng Junjie <873216071 <at> qq.com>
+;;; Copyright © 2023, 2024 Zheng Junjie <873216071 <at> qq.com>
 ;;; Copyright © 2023, 2024 Hartmut Goebel <h.goebel <at> crazy-compilers.com>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -3258,7 +3258,10 @@ (define-public ruby-x25519
               (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"

base-commit: a10cce5246e333be52acd7d334f59228895db89a
prerequisite-patch-id: 5a904c413bc4e5484fed86ec8a7862b20ef3156e
-- 
2.41.0





Reply sent to Efraim Flashner <efraim <at> flashner.co.il>:
You have taken responsibility. (Tue, 12 Mar 2024 11:57:03 GMT) Full text and rfc822 format available.

Notification sent to Zheng Junjie <zhengjunjie <at> iscas.ac.cn>:
bug acknowledged by developer. (Tue, 12 Mar 2024 11:57:03 GMT) Full text and rfc822 format available.

Message #10 received at 69670-done <at> debbugs.gnu.org (full text, mbox):

From: Efraim Flashner <efraim <at> flashner.co.il>
To: Zheng Junjie <zhengjunjie <at> iscas.ac.cn>
Cc: Christopher Baines <guix <at> cbaines.net>, 69670-done <at> debbugs.gnu.org
Subject: Re: [bug#69670] [PATCH] gnu: ruby-x25519: Fix build on non x86_64.
Date: Tue, 12 Mar 2024 13:54:26 +0200
[Message part 1 (text/plain, inline)]
Looks good to me. Thanks! Patch pushed.

-- 
Efraim Flashner   <efraim <at> flashner.co.il>   רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 10 Apr 2024 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 128 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.