View | Details | Raw Unified | Return to bug 259047
Collapse All | Expand All

(-)b/databases/clickhouse/Makefile (-2 / +3 lines)
Lines 11-18 COMMENT= Fast open-source OLAP database management system Link Here
11
11
12
LICENSE=	APACHE20
12
LICENSE=	APACHE20
13
13
14
ONLY_FOR_ARCHS=	amd64
14
ONLY_FOR_ARCHS=	aarch64 amd64
15
ONLY_FOR_ARCHS_REASON=	"Only supported on amd64"
15
ONLY_FOR_ARCHS_REASON=	"Only supported on aarch64 and amd64"
16
16
17
BUILD_DEPENDS=	bash:shells/bash
17
BUILD_DEPENDS=	bash:shells/bash
18
RUN_DEPENDS=	bash:shells/bash
18
RUN_DEPENDS=	bash:shells/bash
Lines 215-220 SOVERSION= ${PORTVERSION} Link Here
215
215
216
post-patch:
216
post-patch:
217
	@${REINPLACE_CMD} -e 's|/var/lib/clickhouse|/var/db/clickhouse|;s|/var/log/clickhouse-server|/var/log/clickhouse|;s|/etc/clickhouse-server|${PREFIX}/etc/clickhouse-server|' ${WRKSRC}/programs/server/config.xml
217
	@${REINPLACE_CMD} -e 's|/var/lib/clickhouse|/var/db/clickhouse|;s|/var/log/clickhouse-server|/var/log/clickhouse|;s|/etc/clickhouse-server|${PREFIX}/etc/clickhouse-server|' ${WRKSRC}/programs/server/config.xml
218
	cd ${WRKSRC}/contrib/openldap-cmake && ${LN} -s freebsd_x86_64 freebsd_aarch64
218
219
219
post-install:
220
post-install:
220
	@${RM} ${STAGEDIR}${PREFIX}/bin/config-processor
221
	@${RM} ${STAGEDIR}${PREFIX}/bin/config-processor
(-)b/databases/clickhouse/files/patch-cmake_find_ldap.cmake (+10 lines)
Added Link Here
1
--- cmake/find/ldap.cmake.orig	2021-09-13 15:27:47.655692000 +0200
2
+++ cmake/find/ldap.cmake	2021-09-13 15:28:02.970539000 +0200
3
@@ -64,6 +64,7 @@ if (NOT OPENLDAP_FOUND AND NOT MISSING_INTERNAL_LDAP_L
4
         ( "${_system_name}" STREQUAL "linux"   AND "${_system_processor}" STREQUAL "aarch64" ) OR
5
         ( "${_system_name}" STREQUAL "linux"   AND "${_system_processor}" STREQUAL "ppc64le" ) OR
6
         ( "${_system_name}" STREQUAL "freebsd" AND "${_system_processor}" STREQUAL "x86_64"  ) OR
7
+        ( "${_system_name}" STREQUAL "freebsd" AND "${_system_processor}" STREQUAL "aarch64" ) OR
8
         ( "${_system_name}" STREQUAL "darwin"  AND "${_system_processor}" STREQUAL "x86_64"  ) OR
9
         ( "${_system_name}" STREQUAL "darwin"  AND "${_system_processor}" STREQUAL "aarch64"   )
10
     )
(-)b/databases/clickhouse/files/patch-contrib_boringssl_crypto_cpu-aarch64-linux.c (+75 lines)
Added Link Here
1
--- contrib/boringssl/crypto/cpu-aarch64-linux.c.orig	2019-10-21 10:14:54 UTC
2
+++ contrib/boringssl/crypto/cpu-aarch64-linux.c
3
@@ -14,49 +14,47 @@
4
 
5
 #include <openssl/cpu.h>
6
 
7
-#if defined(OPENSSL_AARCH64) && defined(OPENSSL_LINUX) && \
8
-    !defined(OPENSSL_STATIC_ARMCAP)
9
+#if defined(OPENSSL_AARCH64)
10
 
11
-#include <sys/auxv.h>
12
-
13
 #include <openssl/arm_arch.h>
14
 
15
 #include "internal.h"
16
 
17
-
18
 extern uint32_t OPENSSL_armcap_P;
19
 
20
-void OPENSSL_cpuid_setup(void) {
21
-  unsigned long hwcap = getauxval(AT_HWCAP);
22
+#include <machine/armreg.h>
23
 
24
-  // See /usr/include/asm/hwcap.h on an aarch64 installation for the source of
25
-  // these values.
26
-  static const unsigned long kNEON = 1 << 1;
27
-  static const unsigned long kAES = 1 << 3;
28
-  static const unsigned long kPMULL = 1 << 4;
29
-  static const unsigned long kSHA1 = 1 << 5;
30
-  static const unsigned long kSHA256 = 1 << 6;
31
+#ifndef ID_AA64ISAR0_AES_VAL
32
+#define ID_AA64ISAR0_AES_VAL ID_AA64ISAR0_AES
33
+#endif
34
+#ifndef ID_AA64ISAR0_AES_VAL
35
+#define ID_AA64ISAR0_AES_VAL ID_AA64ISAR0_AES
36
+#endif
37
+#ifndef ID_AA64ISAR0_SHA1_VAL
38
+#define ID_AA64ISAR0_SHA1_VAL ID_AA64ISAR0_SHA1
39
+#endif
40
+#ifndef ID_AA64ISAR0_SHA2_VAL
41
+#define ID_AA64ISAR0_SHA2_VAL ID_AA64ISAR0_SHA2
42
+#endif
43
 
44
-  if ((hwcap & kNEON) == 0) {
45
-    // Matching OpenSSL, if NEON is missing, don't report other features
46
-    // either.
47
-    return;
48
-  }
49
+void OPENSSL_cpuid_setup(void) {
50
+  uint64_t id_aa64isar0;
51
 
52
+  id_aa64isar0 = READ_SPECIALREG(id_aa64isar0_el1);
53
+
54
   OPENSSL_armcap_P |= ARMV7_NEON;
55
 
56
-  if (hwcap & kAES) {
57
+  if (ID_AA64ISAR0_AES_VAL(id_aa64isar0) >= ID_AA64ISAR0_AES_BASE) {
58
     OPENSSL_armcap_P |= ARMV8_AES;
59
   }
60
-  if (hwcap & kPMULL) {
61
+  if (ID_AA64ISAR0_AES_VAL(id_aa64isar0) == ID_AA64ISAR0_AES_PMULL) {
62
     OPENSSL_armcap_P |= ARMV8_PMULL;
63
   }
64
-  if (hwcap & kSHA1) {
65
+  if (ID_AA64ISAR0_SHA1_VAL(id_aa64isar0) == ID_AA64ISAR0_SHA1_BASE) {
66
     OPENSSL_armcap_P |= ARMV8_SHA1;
67
   }
68
-  if (hwcap & kSHA256) {
69
+  if(ID_AA64ISAR0_SHA2_VAL(id_aa64isar0) >= ID_AA64ISAR0_SHA2_BASE) {
70
     OPENSSL_armcap_P |= ARMV8_SHA256;
71
   }
72
 }
73
-
74
-#endif  // OPENSSL_AARCH64 && !OPENSSL_STATIC_ARMCAP
75
+#endif  // OPENSSL_AARCH64
(-)b/databases/clickhouse/files/patch-contrib_jemalloc-cmake_include__freebsd__aarch64_jemalloc_internal_jemalloc__internal__defs.h.in (+11 lines)
Added Link Here
1
--- contrib/jemalloc-cmake/include_freebsd_aarch64/jemalloc/internal/jemalloc_internal_defs.h.in.orig	2021-07-22 13:50:06.073516000 +0200
2
+++ contrib/jemalloc-cmake/include_freebsd_aarch64/jemalloc/internal/jemalloc_internal_defs.h.in	2021-07-22 13:50:28.909237000 +0200
3
@@ -161,7 +161,7 @@
4
  * JEMALLOC_DSS enables use of sbrk(2) to allocate extents from the data storage
5
  * segment (DSS).
6
  */
7
-#define JEMALLOC_DSS
8
+/* #undef JEMALLOC_DSS */
9
 
10
 /* Support memory filling (junk/zero). */
11
 #define JEMALLOC_FILL
(-)b/databases/clickhouse/files/patch-contrib_rocksdb-cmake_CMakeLists.txt (+14 lines)
Added Link Here
1
--- contrib/rocksdb-cmake/CMakeLists.txt.orig	2021-09-13 16:50:13.827707000 +0200
2
+++ contrib/rocksdb-cmake/CMakeLists.txt	2021-09-13 16:51:37.118209000 +0200
3
@@ -233,6 +233,11 @@ if(HAVE_AUXV_GETAUXVAL)
4
   add_definitions(-DROCKSDB_AUXV_GETAUXVAL_PRESENT)
5
 endif()
6
 
7
+check_cxx_symbol_exists(elf_aux_info sys/auxv.h HAVE_ELF_AUX_INFO)
8
+if(HAVE_ELF_AUX_INFO)
9
+  add_definitions(-DROCKSDB_AUXV_GETAUXVAL_PRESENT)
10
+endif()
11
+
12
 include_directories(${ROCKSDB_SOURCE_DIR})
13
 include_directories("${ROCKSDB_SOURCE_DIR}/include")
14
 if(WITH_FOLLY_DISTRIBUTED_MUTEX)
(-)b/databases/clickhouse/files/patch-contrib_rocksdb_CMakeLists.txt (+13 lines)
Added Link Here
1
--- contrib/rocksdb/CMakeLists.txt.orig	2021-09-13 16:40:55.686967000 +0200
2
+++ contrib/rocksdb/CMakeLists.txt	2021-09-13 16:44:42.046383000 +0200
3
@@ -553,6 +553,10 @@ check_cxx_symbol_exists(getauxval auvx.h HAVE_AUXV_GET
4
 if(HAVE_AUXV_GETAUXVAL)
5
   add_definitions(-DROCKSDB_AUXV_GETAUXVAL_PRESENT)
6
 endif()
7
+check_cxx_symbol_exists(elf_aux_info sys/auxv.h HAVE_AUXV_ELF_AUX_INFO)
8
+if(HAVE_AUXV_ELF_AUX_INFO)
9
+  add_definitions(-DROCKSDB_AUXV_GETAUXVAL_PRESENT)
10
+endif()
11
 
12
 include_directories(${PROJECT_SOURCE_DIR})
13
 include_directories(${PROJECT_SOURCE_DIR}/include)
(-)b/databases/clickhouse/files/patch-contrib_rocksdb_util_crc32c.cc (+38 lines)
Added Link Here
1
--- contrib/rocksdb/util/crc32c.cc.orig	2021-07-21 16:35:20.404459000 +0200
2
+++ contrib/rocksdb/util/crc32c.cc	2021-07-22 09:48:10.980923000 +0200
3
@@ -41,7 +41,7 @@
4
 
5
 #endif
6
 
7
-#if defined(__linux__) && defined(HAVE_ARM64_CRC)
8
+#if (defined(__FreeBSD__) || defined(__linux__)) && defined(HAVE_ARM64_CRC)
9
 bool pmull_runtime_flag = false;
10
 #endif
11
 
12
@@ -474,7 +474,7 @@ static bool isAltiVec() {
13
 }
14
 #endif
15
 
16
-#if defined(__linux__) && defined(HAVE_ARM64_CRC)
17
+#if (defined(__FreeBSD__) || defined(__linux__)) && defined(HAVE_ARM64_CRC)
18
 uint32_t ExtendARMImpl(uint32_t crc, const char *buf, size_t size) {
19
   return crc32c_arm64(crc, (const unsigned char *)buf, size);
20
 }
21
@@ -494,7 +494,7 @@ std::string IsFastCrc32Supported() {
22
   has_fast_crc = false;
23
   arch = "PPC";
24
 #endif
25
-#elif defined(__linux__) && defined(HAVE_ARM64_CRC)
26
+#elif (defined(__FreeBSD__) || defined(__linux__)) && defined(HAVE_ARM64_CRC)
27
   if (crc32c_runtime_check()) {
28
     has_fast_crc = true;
29
     arch = "Arm64";
30
@@ -1227,7 +1227,7 @@ uint32_t crc32c_3way(uint32_t crc, const char* buf, si
31
 static inline Function Choose_Extend() {
32
 #ifdef HAVE_POWER8
33
   return isAltiVec() ? ExtendPPCImpl : ExtendImpl<Slow_CRC32>;
34
-#elif defined(__linux__) && defined(HAVE_ARM64_CRC)
35
+#elif (defined(__FreeBSD__) || defined(__linux__)) && defined(HAVE_ARM64_CRC)
36
   if(crc32c_runtime_check()) {
37
     pmull_runtime_flag = crc32c_pmull_runtime_check();
38
     return ExtendARMImpl;
(-)b/databases/clickhouse/files/patch-contrib_rocksdb_util_crc32c__arm64.cc (+45 lines)
Added Link Here
1
--- contrib/rocksdb/util/crc32c_arm64.cc.orig	2021-05-13 00:21:57.000000000 +0200
2
+++ contrib/rocksdb/util/crc32c_arm64.cc	2000-01-01 02:32:56.500264000 +0100
3
@@ -5,9 +5,11 @@
4
 
5
 #include "util/crc32c_arm64.h"
6
 
7
-#if defined(__linux__) && defined(HAVE_ARM64_CRC)
8
+#if (defined(__FreeBSD__) || defined(__linux__)) && defined(HAVE_ARM64_CRC)
9
 
10
+#if defined(__linux__)
11
 #include <asm/hwcap.h>
12
+#endif // linux
13
 #ifdef ROCKSDB_AUXV_GETAUXVAL_PRESENT
14
 #include <sys/auxv.h>
15
 #endif
16
@@ -42,7 +44,14 @@ extern bool pmull_runtime_flag;
17
 
18
 uint32_t crc32c_runtime_check(void) {
19
 #ifdef ROCKSDB_AUXV_GETAUXVAL_PRESENT
20
+#if defined(__FreeBSD__)
21
+  uint64_t auxv;
22
+  int result = elf_aux_info(AT_HWCAP, &auxv, sizeof auxv);
23
+  if (result != 0)
24
+    return 0;
25
+#else
26
   uint64_t auxv = getauxval(AT_HWCAP);
27
+#endif
28
   return (auxv & HWCAP_CRC32) != 0;
29
 #else
30
   return 0;
31
@@ -51,7 +60,14 @@ uint32_t crc32c_runtime_check(void) {
32
 
33
 bool crc32c_pmull_runtime_check(void) {
34
 #ifdef ROCKSDB_AUXV_GETAUXVAL_PRESENT
35
+#if defined(__FreeBSD__)
36
+  uint64_t auxv;
37
+  int result = elf_aux_info(AT_HWCAP, &auxv, sizeof auxv);
38
+  if (result != 0)
39
+    return 0;
40
+#else
41
   uint64_t auxv = getauxval(AT_HWCAP);
42
+#endif
43
   return (auxv & HWCAP_PMULL) != 0;
44
 #else
45
   return false;
(-)b/databases/clickhouse/files/patch-src_Common_StackTrace.cpp (+11 lines)
Added Link Here
1
--- src/Common/StackTrace.cpp.orig	2021-09-13 15:30:01.608345000 +0200
2
+++ src/Common/StackTrace.cpp	2021-09-13 15:30:10.009331000 +0200
3
@@ -186,6 +186,8 @@ static void * getCallerAddress(const ucontext_t & context)
4
 #elif defined(__APPLE__) && defined(__aarch64__)
5
     return reinterpret_cast<void *>(context.uc_mcontext->__ss.__pc);
6
 
7
+#elif defined(__FreeBSD__) && defined(__aarch64__)
8
+    return reinterpret_cast<void *>(context.uc_mcontext.mc_gpregs.gp_elr);
9
 #elif defined(__aarch64__)
10
     return reinterpret_cast<void *>(context.uc_mcontext.pc);
11
 #elif defined(__powerpc64__)

Return to bug 259047