termux-packages/packages/cryptopp/cpu.cpp.patch

169 lines
4.6 KiB
Diff

diff -uNr cryptopp/cpu.cpp cryptopp.mod/cpu.cpp
--- cryptopp/cpu.cpp 2021-01-01 19:03:59.000000000 +0200
+++ cryptopp.mod/cpu.cpp 2021-01-07 14:16:48.145624898 +0200
@@ -54,7 +54,7 @@
// "$ANDROID_NDK_ROOT/sources/android/cpufeatures".
// setenv-android.sh will copy the header and source file
// into PWD and the makefile will build it in place.
-#if defined(__ANDROID__)
+#if defined(__ANDROID__) && !defined(__TERMUX__)
# include "cpu-features.h"
#endif
@@ -762,6 +762,7 @@
inline bool CPU_QueryARMv7()
{
+#ifndef __TERMUX__
#if defined(__ANDROID__) && defined(__arm__)
if (((android_getCpuFamily() & ANDROID_CPU_FAMILY_ARM) != 0) &&
((android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_ARMv7) != 0))
@@ -774,11 +775,13 @@
// Apple hardware is ARMv7 or above.
return true;
#endif
+#endif
return false;
}
inline bool CPU_QueryNEON()
{
+#ifndef __TERMUX__
#if defined(__ANDROID__) && defined(__aarch64__)
if (((android_getCpuFamily() & ANDROID_CPU_FAMILY_ARM64) != 0) &&
((android_getCpuFeatures() & ANDROID_CPU_ARM64_FEATURE_ASIMD) != 0))
@@ -800,11 +803,13 @@
// Core feature set for Aarch32 and Aarch64.
return true;
#endif
+#endif
return false;
}
inline bool CPU_QueryCRC32()
{
+#ifndef __TERMUX__
#if defined(__ANDROID__) && defined(__aarch64__)
if (((android_getCpuFamily() & ANDROID_CPU_FAMILY_ARM64) != 0) &&
((android_getCpuFeatures() & ANDROID_CPU_ARM64_FEATURE_CRC32) != 0))
@@ -823,11 +828,13 @@
// No compiler support. CRC intrinsics result in a failed compiled.
return false;
#endif
+#endif
return false;
}
inline bool CPU_QueryPMULL()
{
+#ifndef __TERMUX__
#if defined(__ANDROID__) && defined(__aarch64__)
if (((android_getCpuFamily() & ANDROID_CPU_FAMILY_ARM64) != 0) &&
((android_getCpuFeatures() & ANDROID_CPU_ARM64_FEATURE_PMULL) != 0))
@@ -846,11 +853,13 @@
// No compiler support. PMULL intrinsics result in a failed compiled.
return false;
#endif
+#endif
return false;
}
inline bool CPU_QueryAES()
{
+#ifndef __TERMUX__
#if defined(__ANDROID__) && defined(__aarch64__)
if (((android_getCpuFamily() & ANDROID_CPU_FAMILY_ARM64) != 0) &&
((android_getCpuFeatures() & ANDROID_CPU_ARM64_FEATURE_AES) != 0))
@@ -868,11 +877,13 @@
#elif defined(__APPLE__) && defined(__aarch64__)
return IsAppleMachineARMv8();
#endif
+#endif
return false;
}
inline bool CPU_QuerySHA1()
{
+#ifndef __TERMUX__
#if defined(__ANDROID__) && defined(__aarch64__)
if (((android_getCpuFamily() & ANDROID_CPU_FAMILY_ARM64) != 0) &&
((android_getCpuFeatures() & ANDROID_CPU_ARM64_FEATURE_SHA1) != 0))
@@ -890,11 +901,13 @@
#elif defined(__APPLE__) && defined(__aarch64__)
return IsAppleMachineARMv8();
#endif
+#endif
return false;
}
inline bool CPU_QuerySHA256()
{
+#ifndef __TERMUX__
#if defined(__ANDROID__) && defined(__aarch64__)
if (((android_getCpuFamily() & ANDROID_CPU_FAMILY_ARM64) != 0) &&
((android_getCpuFeatures() & ANDROID_CPU_ARM64_FEATURE_SHA2) != 0))
@@ -912,11 +925,13 @@
#elif defined(__APPLE__) && defined(__aarch64__)
return IsAppleMachineARMv8();
#endif
+#endif
return false;
}
inline bool CPU_QuerySHA512()
{
+#ifndef __TERMUX__
// Some ARMv8.4 features are disabled at the moment
#if defined(__ANDROID__) && defined(__aarch64__) && 0
if (((android_getCpuFamily() & ANDROID_CPU_FAMILY_ARM64) != 0) &&
@@ -935,11 +950,13 @@
#elif defined(__APPLE__) && defined(__aarch64__) && 0
return false;
#endif
+#endif
return false;
}
inline bool CPU_QuerySHA3()
{
+#ifndef __TERMUX__
// Some ARMv8.4 features are disabled at the moment
#if defined(__ANDROID__) && defined(__aarch64__) && 0
if (((android_getCpuFamily() & ANDROID_CPU_FAMILY_ARM64) != 0) &&
@@ -958,11 +975,13 @@
#elif defined(__APPLE__) && defined(__aarch64__) && 0
return false;
#endif
+#endif
return false;
}
inline bool CPU_QuerySM3()
{
+#ifndef __TERMUX__
// Some ARMv8.4 features are disabled at the moment
#if defined(__ANDROID__) && defined(__aarch64__) && 0
if (((android_getCpuFamily() & ANDROID_CPU_FAMILY_ARM64) != 0) &&
@@ -981,11 +1000,13 @@
#elif defined(__APPLE__) && defined(__aarch64__) && 0
return false;
#endif
+#endif
return false;
}
inline bool CPU_QuerySM4()
{
+#ifndef __TERMUX__
// Some ARMv8.4 features are disabled at the moment
#if defined(__ANDROID__) && defined(__aarch64__) && 0
if (((android_getCpuFamily() & ANDROID_CPU_FAMILY_ARM64) != 0) &&
@@ -1004,6 +1025,7 @@
#elif defined(__APPLE__) && defined(__aarch64__) && 0
return false;
#endif
+#endif
return false;
}