diff mbox series

[bug#58261,v2,01/13] gnu: Add fast-float.

Message ID 20221007152148.32591-2-david.elsing@posteo.net
State Accepted
Headers show
Series [bug#58261,v2,01/13] gnu: Add fast-float. | expand

Commit Message

David Elsing Oct. 7, 2022, 3:21 p.m. UTC
* gnu/packages/cpp.scm (fast-float): New variable.
---
 gnu/packages/cpp.scm | 54 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

Comments

Liliana Marie Prikler Oct. 9, 2022, 10:04 a.m. UTC | #1
Am Freitag, dem 07.10.2022 um 15:21 +0000 schrieb David Elsing:
> * gnu/packages/cpp.scm (fast-float): New variable.
> ---
>  gnu/packages/cpp.scm | 54
> ++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 54 insertions(+)
> 
> diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
> index d03e0bc7e1..a7404df563 100644
> --- a/gnu/packages/cpp.scm
> +++ b/gnu/packages/cpp.scm
> @@ -29,6 +29,7 @@
>  ;;; Copyright © 2022 muradm <mail@muradm.net>
>  ;;; Copyright © 2022 Attila Lendvai <attila@lendvai.name>
>  ;;; Copyright © 2022 Arun Isaac <arunisaac@systemreboot.net>
> +;;; Copyright © 2022 David Elsing <david.elsing@posteo.net>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -1907,3 +1908,56 @@ (define-public cpp-mustache
>  templated string type for compatibility with any STL-like string
> (std::string,
>  std::wstring, etc).")
>      (license license:boost1.0)))
> +
> +(define-public fast-float
> +  (package
> +    (name "fast-float")
> +    (version "3.5.1")
> +    (source (origin
> +              (method git-fetch)
> +              (uri (git-reference
> +                    (url "https://github.com/fastfloat/fast_float")
> +                    (commit (string-append "v" version))))
> +              (file-name (git-file-name name version))
> +              (sha256
> +               (base32
> +               
> "0z3rxxd0pwvw70dbnv63rm67biw829vdqf50y16isxm6g3sbrz8g"))))
> +    (build-system cmake-build-system)
> +    (arguments
> +     (list
> +      #:configure-flags
> +      #~(list
> +         "-DFASTFLOAT_TEST=ON"
> +         "-DSYSTEM_DOCTEST=ON")
> +      #:phases
> +      #~(modify-phases %standard-phases
> +          (add-after 'unpack 'patch-cmake-tests
> +            (lambda _
> +              (substitute* "tests/CMakeLists.txt"
> +               
> (("FetchContent_GetProperties\\(supplemental_test_files.*")
> +                 "")
> +                (("if\\(NOT supplemental_test_files_POPULATED.*")
> +                 (string-append
> +                  "set(supplemental_test_files_BINARY_DIR "
> +                  #$(this-package-native-input "test-data") "/data"
> +                  ")\nif(0)\n"))))))))
> +    (native-inputs
> +     `(("test-data"
> +        ,(let ((commit "97a0b2e638feb479387554cf253e346500541e7e"))
> +           (origin
> +             (method git-fetch)
> +             (uri (git-reference
> +                   (url
> +                   
> "https://github.com/fastfloat/supplemental_test_files.git")
> +                   (commit commit)))
> +             (file-name (git-file-name "fast_float_test-data"
> commit))
> +             (sha256
> +              (base32
> +              
> "0dxbiyzyh7i847i89ablfzypfc3ckhm7f74w98jsh73v1mppmxlf")))))
You can use the origin directly in the recipe via #$.  Alternatively,
search-input-directory "data" would probably also work.
> +       ("doctest" ,doctest)))
> +    (home-page "https://github.com/fastfloat/fast_float")
> +    (synopsis "Floating point number parser for C++")
> +    (description "@code{fast_float} is a header-only C++ library for
> parsing
> +floating point numbers from strings.  It implements the C++
> from_chars
> +functions for the float and double types.")
> +    (license (list license:asl2.0 license:expat)))) ; dual licensed
Cheers
diff mbox series

Patch

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index d03e0bc7e1..a7404df563 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -29,6 +29,7 @@ 
 ;;; Copyright © 2022 muradm <mail@muradm.net>
 ;;; Copyright © 2022 Attila Lendvai <attila@lendvai.name>
 ;;; Copyright © 2022 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2022 David Elsing <david.elsing@posteo.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1907,3 +1908,56 @@  (define-public cpp-mustache
 templated string type for compatibility with any STL-like string (std::string,
 std::wstring, etc).")
     (license license:boost1.0)))
+
+(define-public fast-float
+  (package
+    (name "fast-float")
+    (version "3.5.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/fastfloat/fast_float")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0z3rxxd0pwvw70dbnv63rm67biw829vdqf50y16isxm6g3sbrz8g"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      #:configure-flags
+      #~(list
+         "-DFASTFLOAT_TEST=ON"
+         "-DSYSTEM_DOCTEST=ON")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'patch-cmake-tests
+            (lambda _
+              (substitute* "tests/CMakeLists.txt"
+                (("FetchContent_GetProperties\\(supplemental_test_files.*")
+                 "")
+                (("if\\(NOT supplemental_test_files_POPULATED.*")
+                 (string-append
+                  "set(supplemental_test_files_BINARY_DIR "
+                  #$(this-package-native-input "test-data") "/data"
+                  ")\nif(0)\n"))))))))
+    (native-inputs
+     `(("test-data"
+        ,(let ((commit "97a0b2e638feb479387554cf253e346500541e7e"))
+           (origin
+             (method git-fetch)
+             (uri (git-reference
+                   (url
+                    "https://github.com/fastfloat/supplemental_test_files.git")
+                   (commit commit)))
+             (file-name (git-file-name "fast_float_test-data" commit))
+             (sha256
+              (base32
+               "0dxbiyzyh7i847i89ablfzypfc3ckhm7f74w98jsh73v1mppmxlf")))))
+       ("doctest" ,doctest)))
+    (home-page "https://github.com/fastfloat/fast_float")
+    (synopsis "Floating point number parser for C++")
+    (description "@code{fast_float} is a header-only C++ library for parsing
+floating point numbers from strings.  It implements the C++ from_chars
+functions for the float and double types.")
+    (license (list license:asl2.0 license:expat)))) ; dual licensed