[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#69126] [PATCH 2/2] gnu: Add type-safe.
From: |
Paul A. Patience |
Subject: |
[bug#69126] [PATCH 2/2] gnu: Add type-safe. |
Date: |
Wed, 14 Feb 2024 15:36:20 +0000 |
* gnu/packages/cpp.scm (type-safe): New variable.
Change-Id: I96a690b41af78e331744daacba1cf5ee77f8257a
---
gnu/packages/cpp.scm | 53 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 2456de5002..cf0771e470 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -3074,3 +3074,56 @@ (define-public debug-assert
@code{DEBUG_ASSERT()} macro, which among other features can be selectively
enabled in different parts of your code.")
(license license:zlib))))
+
+(define-public type-safe
+ (package
+ (name "type-safe")
+ (version "0.2.3")
+ (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 "0ijd5grkbzfcmkqydka5ncl7ab4rc3307qr0ywwgzqsifr3ks0fd"))
+ (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* "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)))
--
2.41.0