From 65ca4d56151dea56c960245e9af5b4d03d909f19 Mon Sep 17 00:00:00 2001 From: Piotr Kubaj Date: Sun, 6 Dec 2020 19:42:52 +0000 Subject: [PATCH] MFH: r557165 databases/mariadb105-server: fix build on powerpc64 Add powerpc64 as an alternative to ppc64. Fix crc32c the same way it was fixed already for databases/rocksdb. Approved by: tier 2 blanket --- .../files/patch-mysys_CMakeLists.txt | 11 +++++++++ .../files/patch-mysys_crc32_crc32c.cc | 24 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 databases/mariadb105-server/files/patch-mysys_CMakeLists.txt create mode 100644 databases/mariadb105-server/files/patch-mysys_crc32_crc32c.cc diff --git a/databases/mariadb105-server/files/patch-mysys_CMakeLists.txt b/databases/mariadb105-server/files/patch-mysys_CMakeLists.txt new file mode 100644 index 000000000000..4a6a42d61f31 --- /dev/null +++ b/databases/mariadb105-server/files/patch-mysys_CMakeLists.txt @@ -0,0 +1,11 @@ +--- mysys/CMakeLists.txt.orig 2020-12-06 15:42:44 UTC ++++ mysys/CMakeLists.txt +@@ -115,7 +115,7 @@ ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64 + COMPILE_FLAGS "-march=armv8-a+crc+crypto") + ENDIF() + ENDIF() +-ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64") ++ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(ppc64|powerpc64)") + SET(MYSYS_SOURCES ${MYSYS_SOURCES} crc32/crc32_ppc64.c crc32/crc32c_ppc.c) + SET_SOURCE_FILES_PROPERTIES(crc32/crc32_ppc64.c crc32/crc32c_ppc.c PROPERTIES + COMPILE_FLAGS "${COMPILE_FLAGS} -maltivec -mvsx -mpower8-vector -mcrypto -mpower8-vector") diff --git a/databases/mariadb105-server/files/patch-mysys_crc32_crc32c.cc b/databases/mariadb105-server/files/patch-mysys_crc32_crc32c.cc new file mode 100644 index 000000000000..68eb0a285ef8 --- /dev/null +++ b/databases/mariadb105-server/files/patch-mysys_crc32_crc32c.cc @@ -0,0 +1,24 @@ +--- mysys/crc32/crc32c.cc.orig 2020-12-06 15:58:40 UTC ++++ mysys/crc32/crc32c.cc +@@ -475,6 +475,21 @@ static int arch_ppc_probe(void) { + + return arch_ppc_crc32; + } ++#elif __FreeBSD__ ++#include ++#include ++#include ++static int arch_ppc_probe(void) { ++ unsigned long cpufeatures; ++ arch_ppc_crc32 = 0; ++ ++#if defined(__powerpc64__) ++ elf_aux_info(AT_HWCAP2, &cpufeatures, sizeof(cpufeatures)); ++ if (cpufeatures & PPC_FEATURE2_HAS_VEC_CRYPTO) arch_ppc_crc32 = 1; ++#endif /* __powerpc64__ */ ++ ++ return arch_ppc_crc32; ++} + #endif // __linux__ + + static bool isAltiVec() {