diff options
author | Paul A. Patience <paul@apatience.com> | 2024-02-20 19:33:33 +0000 |
---|---|---|
committer | Sharlatan Hellseher <sharlatanus@gmail.com> | 2024-11-03 23:33:39 +0000 |
commit | d33626fb07e5a8369b1be1dff87f399be90d85d4 (patch) | |
tree | 01d2277a25a40ea819e37351d6c752e4efdef0ac | |
parent | 84266a8f74aaf3d5eac64c679ba0124de4331bfe (diff) | |
download | guix-d33626fb07e5a8369b1be1dff87f399be90d85d4.tar guix-d33626fb07e5a8369b1be1dff87f399be90d85d4.tar.gz |
gnu: Add type-safe.
* gnu/packages/cpp.scm (type-safe): New variable.
Change-Id: I96a690b41af78e331744daacba1cf5ee77f8257a
Reviewed-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
Reviewed-by: Skyler Ferris <skyvine@protonmail.com>
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
-rw-r--r-- | gnu/packages/cpp.scm | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm index ed88a27e89..f8e8557ef1 100644 --- a/gnu/packages/cpp.scm +++ b/gnu/packages/cpp.scm @@ -3322,6 +3322,66 @@ the std::optional for C++11/14/17, with support for monadic operations added in C++23.") (license license:cc0))) +(define-public type-safe + (package + (name "type-safe") + (version "0.2.4") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/foonathan/type_safe") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "0qb4g9x22m8w9d7n9793cbig5a06wlhzqwlr276yxvz5yyzsxjfg")) + (modules '((guix build utils))) + ;; Remove bundled debug_assert. + ;; Keep external/external.cmake because it enables + ;; TYPE_SAFE_HAS_IMPORTED_TARGETS, required for installing the CMake + ;; config files. + (snippet #~(delete-file-recursively "external/debug_assert")))) + (build-system cmake-build-system) + (arguments + (list #:configure-flags + #~(list "-DTYPE_SAFE_BUILD_TEST_EXAMPLE=ON" + "-DTYPE_SAFE_BUILD_DOC=OFF") ; needs standardese + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'fix-dependencies + (lambda _ + (substitute* + (list "include/type_safe/detail/assert.hpp" + "include/type_safe/detail/force_inline.hpp") + (("#include <debug_assert.hpp>") + (string-append "#include <" + #$(this-package-input "debug-assert") + "/include/debug_assert.hpp>"))) + (substitute* "test/CMakeLists.txt" + (("^if\\(NOT EXISTS .*/catch\\.hpp\\)") "if(FALSE)") + (("^(target_include_directories\\(type_safe_test) .*" + all prefix) + (string-append all prefix " PRIVATE \"" + #$(this-package-native-input "catch2") + "/include/catch2\")\n"))))) + (add-after 'install 'fix-cmake-config + (lambda _ + (substitute* (string-append + #$output + "/lib/cmake/type_safe/type_safe-config.cmake") + (("^(find_dependency\\(debug_assert)\\)" _ prefix) + (string-append prefix " PATHS \"" + #$(this-package-input "debug-assert") + "/lib/cmake/debug_assert\")")))))))) + (native-inputs (list catch2)) + (inputs (list debug-assert)) + (home-page "https://github.com/foonathan/type_safe") + (synopsis "C++ abstractions for preventing bugs via the type system") + (description "type_safe is a C++ header-only library which provides +abstractions for defining more appropriate types, thus allowing C++'s type +system to prevent more bugs.") + (license license:expat))) + (define-public cpp-ada-url-parser (package (name "cpp-ada-url-parser") |