commit:     eea031d253fac214034a2b18e2ee16d4c3295a14
Author:     Hans de Graaff <graaff <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 21 07:47:55 2020 +0000
Commit:     Hans de Graaff <graaff <AT> gentoo <DOT> org>
CommitDate: Sun Jun 21 07:48:06 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=eea031d2

dev-ruby/x25519: precomputed impl only works on amd64

The precomputed implementation only works on amd64, so avoid it
on other arches and let them fall back to the unoptimized reference
implementation.

Closes: https://bugs.gentoo.org/728420
Closes: https://bugs.gentoo.org/728888
Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Hans de Graaff <graaff <AT> gentoo.org>

 dev-ruby/x25519/x25519-1.0.8.ebuild | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/dev-ruby/x25519/x25519-1.0.8.ebuild 
b/dev-ruby/x25519/x25519-1.0.8.ebuild
index 36e65576f66..cd2b4a702e7 100644
--- a/dev-ruby/x25519/x25519-1.0.8.ebuild
+++ b/dev-ruby/x25519/x25519-1.0.8.ebuild
@@ -26,16 +26,27 @@ all_ruby_prepare() {
        sed -i -e '/bundler/ s:^:#: ; /coverall/I s:^:#:' spec/spec_helper.rb 
|| die
 
        sed -i -e 's/git ls-files -z/find . -print0/' ${RUBY_FAKEGEM_GEMSPEC} 
|| die
+
+       # The precomputed implementation only works on amd64
+       if ! use amd64 ; then
+               sed -i -e 
'/\(x25519_precomputed\|X25519::Provider::Precomputed\)/ s:^:#:' lib/x25519.rb 
|| die
+       fi
 }
 
 each_ruby_configure() {
-       ${RUBY} -Cext/x25519_precomputed extconf.rb || die
+       if use amd64 ; then
+               ${RUBY} -Cext/x25519_precomputed extconf.rb || die
+       fi
+
        ${RUBY} -Cext/x25519_ref10 extconf.rb || die
 }
 
 each_ruby_compile() {
-       emake V=1 -Cext/x25519_precomputed
-       cp ext/x25519_precomputed/x25519_precomputed.so lib/ || die
+       if use amd64 ; then
+               emake V=1 -Cext/x25519_precomputed
+               cp ext/x25519_precomputed/x25519_precomputed.so lib/ || die
+       fi
+
        emake V=1 -Cext/x25519_ref10
        cp ext/x25519_ref10/x25519_ref10.so lib/ || die
 }

Reply via email to