From 2654dfa04e0fe8a85706ef549438a647ce856eda Mon Sep 17 00:00:00 2001
From: lemmi <lemmi@nerd2nerd.org>
Date: Thu, 26 Dec 2019 09:24:58 +0100
Subject: [PATCH] darktable: update to 3.0.2.

closes #17787
---
 ...01-only-use-target_clones-with-glibc.patch | 25 +++++++++++++
 srcpkgs/darktable/patches/altivec.patch       | 37 -------------------
 srcpkgs/darktable/template                    | 22 ++++++++---
 3 files changed, 41 insertions(+), 43 deletions(-)
 create mode 100644 srcpkgs/darktable/patches/0001-only-use-target_clones-with-glibc.patch
 delete mode 100644 srcpkgs/darktable/patches/altivec.patch

diff --git a/srcpkgs/darktable/patches/0001-only-use-target_clones-with-glibc.patch b/srcpkgs/darktable/patches/0001-only-use-target_clones-with-glibc.patch
new file mode 100644
index 0000000000..22ea16ba9b
--- /dev/null
+++ b/srcpkgs/darktable/patches/0001-only-use-target_clones-with-glibc.patch
@@ -0,0 +1,25 @@
+From 17a2b728e834ae046d6ba4a9e37868f2476be3ab Mon Sep 17 00:00:00 2001
+From: lemmi <lemmi@nerd2nerd.org>
+Date: Sat, 18 Apr 2020 09:24:45 +0200
+Subject: [PATCH] only use target_clones with glibc
+
+---
+ src/common/darktable.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git src/common/darktable.h src/common/darktable.h
+index b3ad929..ae871a0 100644
+--- src/common/darktable.h
++++ src/common/darktable.h
+@@ -102,7 +102,7 @@ typedef unsigned int u_int;
+ /* 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(__SSE__)
++#if __has_attribute(target_clones) && !defined(_WIN32) && defined(__SSE__) && defined(__GLIBC__)
+ #define __DT_CLONE_TARGETS__ __attribute__((target_clones("default", "sse2", "sse3", "sse4.1", "sse4.2", "popcnt", "avx", "avx2", "avx512f", "fma4")))
+ #else
+ #define __DT_CLONE_TARGETS__
+-- 
+2.26.1
+
diff --git a/srcpkgs/darktable/patches/altivec.patch b/srcpkgs/darktable/patches/altivec.patch
deleted file mode 100644
index 4bed6ef4b5..0000000000
--- a/srcpkgs/darktable/patches/altivec.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-This fixes compilation on ppc with opencl on. Prevent opencl
-headers from defining keywords as macros which would conflict
-with C++ keywords as well as C99 keyword macro bool.
-
---- src/external/CL/cl_platform.h
-+++ src/external/CL/cl_platform.h
-@@ -275,14 +275,23 @@ typedef unsigned int cl_GLenum;
- 
- /* Define basic vector types */
- #if defined( __VEC__ )
-+   #ifndef __APPLE_ALTIVEC__
-+     /* prevent gcc from defining the keywords as macros
-+      * do not manually undef for c99 stdbool.h compat
-+      */
-+     #define __APPLE_ALTIVEC__ 1
-+     #include <altivec.h>
-+     #undef __APPLE_ALTIVEC__
-+   #else
-    #include <altivec.h>   /* may be omitted depending on compiler. AltiVec spec provides no way to detect whether the header is required. */
--   typedef vector unsigned char     __cl_uchar16;
--   typedef vector signed char       __cl_char16;
--   typedef vector unsigned short    __cl_ushort8;
--   typedef vector signed short      __cl_short8;
--   typedef vector unsigned int      __cl_uint4;
--   typedef vector signed int        __cl_int4;
--   typedef vector float             __cl_float4;
-+   #endif
-+   typedef __vector unsigned char     __cl_uchar16;
-+   typedef __vector signed char       __cl_char16;
-+   typedef __vector unsigned short    __cl_ushort8;
-+   typedef __vector signed short      __cl_short8;
-+   typedef __vector unsigned int      __cl_uint4;
-+   typedef __vector signed int        __cl_int4;
-+   typedef __vector float             __cl_float4;
-    #define  __CL_UCHAR16__  1
-    #define  __CL_CHAR16__   1
-    #define  __CL_USHORT8__  1
diff --git a/srcpkgs/darktable/template b/srcpkgs/darktable/template
index f54cbd9e2a..5d1246342c 100644
--- a/srcpkgs/darktable/template
+++ b/srcpkgs/darktable/template
@@ -1,9 +1,9 @@
 # Template file for 'darktable'
 pkgname=darktable
-version=2.6.3
-revision=3
+version=3.0.2
+revision=1
 # upstream only supports these archs:
-archs="i686* x86_64* aarch64* ppc64le*"
+archs="x86_64* aarch64* ppc64le*"
 build_style=cmake
 # this makes sure to use -march=generic and -msse3
 configure_args="-DBINARY_PACKAGE_BUILD=ON -DBUILD_NOISE_TOOLS=ON
@@ -13,8 +13,8 @@ makedepends="gtk+3-devel glib-devel exiv2-devel libglade-devel libxslt-devel
  dbus-glib-devel libcurl-devel libgphoto2-devel libwebp-devel libsoup-devel
  lensfun-devel sqlite-devel librsvg-devel lua-devel json-glib-devel
  libgomp-devel libopenjpeg2-devel libopenexr-devel libgraphicsmagick-devel
- libsecret-devel pugixml-devel libosmgpsmap-devel flickcurl-devel
- colord-gtk-devel desktop-file-utils"
+ libsecret-devel pugixml-devel libosmgpsmap-devel colord-gtk-devel
+ desktop-file-utils"
 depends="adwaita-icon-theme"
 short_desc="Virtual lighttable and darkroom for photographers"
 maintainer="lemmi <lemmi@nerd2nerd.org>"
@@ -22,4 +22,14 @@ license="GPL-3.0-or-later"
 homepage="http://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=a518999c8458472edfc04577026ce5047d74553052af0f52d10ba8ce601b78f0
+checksum=6abaf661fe9414e92bdb33b58b98ef024ccf6132b7876abaf0751ec2109f36fb
+
+# Temporarily disable OpenMP for aarch64:
+#
+# see https://github.com/void-linux/void-packages/issues/21105
+
+case $XBPS_TARGET_MACHINE in
+	aarch64*)
+		configure_args+=" -DUSE_OPENMP=OFF"
+		;;
+esac