From 205a2e5e7180147957de49234cdb718a00c37317 Mon Sep 17 00:00:00 2001
From: lemmi <lemmi@nerd2nerd.org>
Date: Thu, 26 Dec 2024 07:45:09 +0100
Subject: [PATCH] darktable: update to 5.0.0.

---
 ...rget_clones-attribute-only-for-glibc.patch | 25 -------------------
 srcpkgs/darktable/template                    | 12 +++++++--
 2 files changed, 10 insertions(+), 27 deletions(-)
 delete mode 100644 srcpkgs/darktable/patches/0001-define-target_clones-attribute-only-for-glibc.patch

diff --git a/srcpkgs/darktable/patches/0001-define-target_clones-attribute-only-for-glibc.patch b/srcpkgs/darktable/patches/0001-define-target_clones-attribute-only-for-glibc.patch
deleted file mode 100644
index 67777765bc4..00000000000
--- a/srcpkgs/darktable/patches/0001-define-target_clones-attribute-only-for-glibc.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From 32c00c02073379ae0a85ecea53e57cd9c64ffe29 Mon Sep 17 00:00:00 2001
-From: lemmi <lemmi@nerd2nerd.org>
-Date: Thu, 25 Jul 2024 00:08:24 +0200
-Subject: [PATCH] define target_clones attribute only for glibc
-
----
- src/common/darktable.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/common/darktable.h b/src/common/darktable.h
-index c21248b0dc..5d9a272767 100644
---- a/src/common/darktable.h
-+++ b/src/common/darktable.h
-@@ -150,7 +150,7 @@ extern "C" {
- /* Create cloned functions for various CPU SSE generations */
- /* See for instructions https://hannes.hauswedell.net/post/2017/12/09/fmv/ */
- /* TL;DR : use only on SIMD functions containing low-level paralellized/vectorized loops */
--#if __has_attribute(target_clones) && !defined(_WIN32) && !defined(NATIVE_ARCH) && !defined(__APPLE__)
-+#if __has_attribute(target_clones) && !defined(_WIN32) && !defined(NATIVE_ARCH) && !defined(__APPLE__) && defined(__GLIBC__)
- # if defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64)
- #define __DT_CLONE_TARGETS__ __attribute__((target_clones("default", "sse2", "sse3", "sse4.1", "sse4.2", "popcnt", "avx", "avx2", "avx512f", "fma4")))
- # elif defined(__PPC64__)
--- 
-2.45.2
-
diff --git a/srcpkgs/darktable/template b/srcpkgs/darktable/template
index 683ec2e7de6..c264457b412 100644
--- a/srcpkgs/darktable/template
+++ b/srcpkgs/darktable/template
@@ -1,6 +1,6 @@
 # Template file for 'darktable'
 pkgname=darktable
-version=4.8.1
+version=5.0.0
 revision=1
 # upstream only supports these archs:
 archs="x86_64* aarch64* ppc64le*"
@@ -23,7 +23,7 @@ license="GPL-3.0-or-later"
 homepage="https://www.darktable.org/"
 changelog="https://github.com/darktable-org/darktable/releases"
 distfiles="https://github.com/darktable-org/darktable/releases/download/release-${version}/darktable-${version}.tar.xz"
-checksum=901b0e2caed36fb8619fdf4c60edfb8d31134b947d3054b5c66fd55c38af5991
+checksum=eaa136e6e624bb53127282e26aafa0441abcc189b55371465e1f5a8a493fa3a1
 
 build_options="avif gmic sdl2"
 build_options_default="avif sdl2"
@@ -32,3 +32,11 @@ case "${XBPS_TARGET_MACHINE}" in
 	aarch64) ;;
 	*) build_options_default+=" gmic" ;;
 esac
+
+# 2024-12-27 enabling openmp on anything but x86_64 causes linker errors
+# e.g. undefined reference to `_ZGVnN2vv_powf'
+
+case "${XBPS_TARGET_MACHINE}" in
+	x86_64) ;;
+	*) configure_args+=" -DUSE_OPENMP=OFF" ;;
+esac