aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorPiotr Kubaj <pkubaj@FreeBSD.org>2021-09-30 15:48:31 +0000
committerPiotr Kubaj <pkubaj@FreeBSD.org>2021-09-30 15:48:31 +0000
commitfc75da3a3b2adf1148010fe1f3cd75528387bdcc (patch)
tree68e76609d2183d0c1177067fa27b41b48e721469 /graphics
parent0b1a2445881a621e0c85eb573593b2612bb42cf0 (diff)
downloadports-fc75da3a3b2adf1148010fe1f3cd75528387bdcc.tar.gz
ports-fc75da3a3b2adf1148010fe1f3cd75528387bdcc.zip
graphics/libjxl: fix build on powerpc64*
Add FreeBSD variants for linux code. The include in cpu.cc is not actually necessary, so I did not include anything for FreeBSD.
Diffstat (limited to 'graphics')
-rw-r--r--graphics/libjxl/files/patch-third__party_highway_hwy_nanobenchmark.cc30
-rw-r--r--graphics/libjxl/files/patch-tools_cpu_cpu.cc13
2 files changed, 43 insertions, 0 deletions
diff --git a/graphics/libjxl/files/patch-third__party_highway_hwy_nanobenchmark.cc b/graphics/libjxl/files/patch-third__party_highway_hwy_nanobenchmark.cc
new file mode 100644
index 000000000000..a4dcea0f17e3
--- /dev/null
+++ b/graphics/libjxl/files/patch-third__party_highway_hwy_nanobenchmark.cc
@@ -0,0 +1,30 @@
+--- third_party/highway/hwy/nanobenchmark.cc.orig 2021-09-30 15:38:30 UTC
++++ third_party/highway/hwy/nanobenchmark.cc
+@@ -47,7 +47,12 @@
+
+ #include "hwy/base.h"
+ #if HWY_ARCH_PPC
++#if linux
+ #include <sys/platform/ppc.h> // NOLINT __ppc_get_timebase_freq
++#elif __FreeBSD__
++#include <sys/types.h>
++#include <sys/sysctl.h> /* must come after sys/types.h */
++#endif
+ #elif HWY_ARCH_X86
+
+ #if HWY_COMPILER_MSVC
+@@ -400,7 +405,14 @@ double NominalClockRate() {
+
+ double InvariantTicksPerSecond() {
+ #if HWY_ARCH_PPC
++#if linux
+ return __ppc_get_timebase_freq();
++#elif __FreeBSD__
++ static double cycles_per_second = 0;
++ size_t length = sizeof(cycles_per_second);
++ sysctlbyname("kern.timecounter.tc.timebase.frequency", &cycles_per_second,
++ &length, NULL, 0);
++#endif
+ #elif HWY_ARCH_X86
+ // We assume the TSC is invariant; it is on all recent Intel/AMD CPUs.
+ return NominalClockRate();
diff --git a/graphics/libjxl/files/patch-tools_cpu_cpu.cc b/graphics/libjxl/files/patch-tools_cpu_cpu.cc
new file mode 100644
index 000000000000..6a50f6aa0951
--- /dev/null
+++ b/graphics/libjxl/files/patch-tools_cpu_cpu.cc
@@ -0,0 +1,13 @@
+--- tools/cpu/cpu.cc.orig 2021-09-30 15:38:45 UTC
++++ tools/cpu/cpu.cc
+@@ -19,7 +19,9 @@
+ #endif
+
+ #if JXL_ARCH_PPC
+-#include <sys/platform/ppc.h> // __ppc_get_timebase_freq
++#if linux
++#include <sys/platform/ppc.h> // NOLINT __ppc_get_timebase_freq
++#endif
+ #endif
+
+ #if JXL_ARCH_ARM