Subject: [PATCH 2/3] gnu: Add symfpu.

From: [email-masked]
Date: Sun, 4 May 2025 19:40:27 +0200

From: Sören Tempel <[email-masked]>

* gnu/packages/maths.scm (symfpu): New variable.
---
 gnu/packages/maths.scm | 56 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 53f726f620..572912ca82 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -8218,6 +8218,62 @@ (define-public yices
 s-expression-based format.")
    (license license:gpl3+)))
 
+(define-public symfpu
+  (let ((commit "22d993d880f66b2e470c3928e0e61bdf61419702"))
+    (package
+      (name "symfpu")
+      (version (git-version "20220910" "0" commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/martin-cs/symfpu")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "1h20zzkyi225290kc6mzg8i4dwkj0p1vlwfgc9ycs61snlyd8gr8"))))
+      (build-system copy-build-system)
+      (arguments
+       (list
+        #:phases
+        #~(modify-phases %standard-phases
+            (delete 'configure)
+            (replace 'install
+              (lambda* (#:key outputs #:allow-other-keys)
+                (let* ((outdir (assoc-ref outputs "out"))
+                       (incdir (string-append outdir "/include/symfpu"))
+                       (libdir (string-append outdir "/lib"))
+
+                       (coredir (string-append incdir "/core"))
+                       (utilsdir (string-append incdir "/utils")))
+                  (mkdir-p coredir)
+                  (mkdir-p utilsdir)
+                  (copy-recursively "core" coredir)
+                  (copy-recursively "utils" utilsdir)
+                  (mkdir-p (string-append libdir "/pkgconfig"))
+                  (with-output-to-file (string-append libdir
+                                                      "/pkgconfig/symfpu.pc")
+                    (lambda _
+                      (format #t
+                       "prefix=~a~@
+                        exec_prefix=${prefix}~@
+                        includedir=${prefix}/include~@
+                        ~@
+                        ~@
+                        Name: symfpu~@
+                        Version: ~a~@
+                        Description: library for IEEE-754 floats~@
+                        Cflags: -I${includedir}~%"
+                       outdir
+                       #$version)))))))))
+      (synopsis
+       "Concrete and symbolic implementation of IEEE-754 floating-point numbers")
+      (description
+       "This library provides a C++ implementation of concrete and symbolic semantics
+for floating point numbers as defined in IEEE Standard for Floating-Point Arithmetic.")
+      (home-page "https://github.com/martin-cs/symfpu")
+      (license license:gpl3))))
+
 (define-public z3
   (package
     (name "z3")