Subject: [bug#65553] [PATCH 3/6] gnu: Add arrayfire-threads.

From: Adam Faiz <[email-masked]>
Date: Sun, 27 Aug 2023 02:52:39 +0800

>From 8eb098f8c795f0bfdc036fc53c94de6f7c29eeb1 Mon Sep 17 00:00:00 2001
Message-ID: <8[email-masked]>
In-Reply-To: <[email-masked]>
References: <[email-masked]>
From: AwesomeAdam54321 <[email-masked]>
Date: Sun, 27 Aug 2023 02:06:31 +0800
Subject: [PATCH 3/6] gnu: Add arrayfire-threads.

* gnu/packages/cpp.scm (arrayfire-threads): New variable.
---
 gnu/packages/cpp.scm | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 6ab3710000..64147167c1 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -1554,6 +1554,46 @@ (define-public lager
 event loops it also provides lenses and cursors.")
      (license license:expat))))
 
+(define-public arrayfire-threads
+  (let ((commit "4d4a4f0384d1ac2f25b2c4fc1d57b9e25f4d6818")
+        (revision "0"))
+  (package
+    (name "arrayfire-threads")
+    (version (git-version "0.0.0" revision commit))
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/arrayfire/threads")
+             (commit commit)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0zipmh6rlk9nzczqp0bj9jjbqvjyk1rxnxz5rqpx83h91bvi7axa"))
+       (modules '((guix build utils)))
+       (snippet
+        #~(begin
+            (substitute* "Makefile"
+              (("g\\+\\+-4.9") "g++")
+              (("-o test" all)
+               (string-append all "\n\n"
+                              "install:\n\t"
+                              "mkdir -p $(DESTDIR)$(PREFIX)/include\n\t"
+                              "cp -r include $(DESTDIR)$(PREFIX)")))))))
+    (build-system gnu-build-system)
+    (arguments
+     (list #:make-flags
+           #~(list (string-append "DESTDIR=" #$output))
+           #:phases
+           #~(modify-phases %standard-phases
+               (delete 'configure) ; no configure
+               (delete 'build) ; building the headers fail to compile
+               (delete 'check)))) ; test.cpp is compiled in the `all` target
+    (synopsis "Threads headers for ArrayFire")
+    (description
+     "This package provides threads headers for ArrayFire.")
+    (home-page "https://github.com/arrayfire/threads")
+    (license license:bsd-3))))
+
 (define-public atomic-queue
   (package
     (name "atomic-queue")
-- 
2.41.0