Skip to content

Commit

Permalink
print/ghostscript9-agpl-base: Fix build on armv7
Browse files Browse the repository at this point in the history
The bundled version of tesseract requires the <asm/hwcap.h> header
to detect the availability of NEON instructions on armv7.  This
issue has already been reported to up stream.

Reported upstream:	tesseract-ocr/tesseract#3782

PR:		263003
Approved by:	portmgr (build fix blanket)
  • Loading branch information
clausecker authored and MikaelUrankar committed Apr 3, 2022
1 parent 31efc7f commit 16f0acb
Showing 1 changed file with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
--- tesseract/src/arch/simddetect.cpp.orig 2021-09-27 07:44:02 UTC
+++ tesseract/src/arch/simddetect.cpp
@@ -40,10 +40,13 @@
#if defined(HAVE_NEON) && !defined(__aarch64__)
#ifdef ANDROID
#include <cpu-features.h>
-#else
+#elif defined(__linux__)
/* Assume linux */
#include <sys/auxv.h>
#include <asm/hwcap.h>
+#elif defined(__FreeBSD__)
+#include <sys/auxv.h>
+#include <sys/elf.h>
#endif
#endif

@@ -188,9 +191,15 @@ SIMDDetect::SIMDDetect() {
neon_available_ = (android_getCpuFeatures() &
ANDROID_CPU_ARM_FEATURE_NEON);
}
-#else
+#elif defined(__linux__)
/* Assume linux */
neon_available_ = getauxval(AT_HWCAP) & HWCAP_NEON;
+#elif defined(__FreeBSD__)
+ unsigned long hwcap = 0;
+ elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap);
+ neon_available_ = hwcap & HWCAP_NEON;
+#else
+ neon_available_ = 0;
#endif
#endif

0 comments on commit 16f0acb

Please sign in to comment.