dev-perl/CryptX: fix build w/ sse4.1 but w/o aesni

Closes: https://bugs.gentoo.org/916387
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Sam James
2023-12-29 23:31:01 +00:00
parent 570d28f5f7
commit 3b34816f06
2 changed files with 90 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
# TODO: unbundle libtommath, libtomcrypt. There's experimental support upstream.
# bug #732634
DIST_AUTHOR=MIK
DIST_VERSION=0.080
inherit perl-module
DESCRIPTION="Self-contained crypto toolkit"
LICENSE="|| ( Artistic GPL-1+ ) public-domain"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
IUSE="minimal"
RDEPEND="
virtual/perl-Math-BigInt
!minimal? (
dev-perl/JSON
)
"
BDEPEND="
${RDEPEND}
virtual/perl-ExtUtils-MakeMaker
test? (
>=virtual/perl-Test-Simple-0.880.0
!minimal? (
>=virtual/perl-Math-BigInt-1.999.715
>=virtual/perl-Storable-2.0.0
)
)
"
PERL_RM_FILES=(
t/002_all_pm.t
t/003_all_pm_pod.t
t/004_all_pm_pod_spelling.t
t/005_all_pm_pod_coverage.t
)
PATCHES=(
"${FILESDIR}"/${PN}-0.80.0-respect-flags.patch
"${FILESDIR}"/${PN}-0.80.0-aesni.patch
)
#src_configure() {
# CRYPTX_LDFLAGS='-ltommath -ltomcrypt' perl-module_src_configure
#}

View File

@@ -0,0 +1,38 @@
https://github.com/DCIT/perl-CryptX/pull/99
https://bugs.gentoo.org/916387
--- a/src/ltc/headers/tomcrypt_cfg.h
+++ b/src/ltc/headers/tomcrypt_cfg.h
@@ -96,6 +96,9 @@ LTC_EXPORT int LTC_CALL XSTRCMP(const char *s1, const char *s2);
#define LTC_AMD64_SSE4_1
#endif
#endif
+ #if defined(__AES__)
+ #define LTC_AMD64_AES_NI
+ #endif
#endif
/* detect PPC32 */
--- a/src/ltc/headers/tomcrypt_private.h
+++ b/src/ltc/headers/tomcrypt_private.h
@@ -77,7 +77,7 @@ typedef struct
/* tomcrypt_cipher.h */
-#if defined(LTC_AES_NI) && defined(LTC_AMD64_SSE4_1)
+#if defined(LTC_AES_NI) && defined(LTC_AMD64_AES_NI)
#define LTC_HAS_AES_NI
#endif
--- a/src/ltc/misc/crypt/crypt.c
+++ b/src/ltc/misc/crypt/crypt.c
@@ -416,7 +416,7 @@ const char *crypt_build_settings =
#if defined(LTC_ADLER32)
" ADLER32 "
#endif
-#if defined(LTC_AES_NI) && defined(LTC_AMD64_SSE4_1)
+#if defined(LTC_AES_NI) && defined(LTC_AMD64_AES_NI)
" AES-NI "
#endif
#if defined(LTC_BASE64)