Subject: [bug#48785] [PATCH 1/3] gnu: Add fast-double-parser.

From: Vinicius Monego <[email-masked]>
Date: Tue, 1 Jun 2021 22:06:41 +0000

* gnu/packages/cpp.scm (fast-double-parser): New variable.
---
 gnu/packages/cpp.scm | 38 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 3089094eb8..1cddf7209b 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -10,7 +10,7 @@
 ;;; Copyright © 2020 Roel Janssen <[email-masked]>
 ;;; Copyright © 2020 Ricardo Wurmus <[email-masked]>
 ;;; Copyright © 2020 Brice Waegeneire <[email-masked]>
-;;; Copyright © 2020 Vinicius Monego <[email-masked]>
+;;; Copyright © 2020, 2021 Vinicius Monego <[email-masked]>
 ;;; Copyright © 2020 Marius Bakke <[email-masked]>
 ;;; Copyright © 2020 Michael Rohleder <[email-masked]>
 ;;; Copyright © 2020 Alexandros Theodotou <[email-masked]>
@@ -330,6 +330,42 @@ functions, class methods, and stl containers.
 @end enumerate\n")
     (license license:bsd-3)))
 
+(define-public fast-double-parser
+  (package
+    (name "fast-double-parser")
+    (version "0.5.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/lemire/fast_double_parser")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "10mfpy4i7lpavghb15s4d0920nlwsac1ri2sxkcqbrj9iq94qj71"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (replace 'install ;no install target, have to do it manually
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out-include (string-append (assoc-ref outputs "out")
+                                               "/include")))
+               (mkdir-p out-include)
+               (copy-file "../source/include/fast_double_parser.h"
+                          (string-append out-include
+                                         "/fast_double_parser.h"))))))))
+    (home-page "https://github.com/lemire/fast_double_parser")
+    (synopsis "Parse strings into double (binary64) floating-point values")
+    (description "Fast function to parse strings containing decimal numbers
+into double-precision (binary64) floating-point values.  That is, given the
+string \"1.0e10\", it should return a 64-bit floating-point value equal to
+10000000000.  The function will match exactly (down the smallest bit) the
+result of a standard function like @code{strtod}.")
+    ;; Dual-licensed, either license applies.
+    (license (list license:asl2.0
+                   license:boost1.0))))
+
 (define-public fifo-map
   (let* ((commit "0dfbf5dacbb15a32c43f912a7e66a54aae39d0f9")
          (revision "0")
-- 
2.31.1