* [bug#69126] [PATCH 0/2] gnu: Add type-safe.
@ 2024-02-14 15:33 Paul A. Patience
2024-02-14 15:36 ` [bug#69126] [PATCH 1/2] gnu: Add debug-assert Paul A. Patience
` (5 more replies)
0 siblings, 6 replies; 14+ messages in thread
From: Paul A. Patience @ 2024-02-14 15:33 UTC (permalink / raw)
To: 69126; +Cc: Paul A. Patience
Paul A. Patience (2):
gnu: Add debug-assert.
gnu: Add type-safe.
gnu/packages/cpp.scm | 81 +++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 80 insertions(+), 1 deletion(-)
base-commit: 570ef13a87bb54d3410c431700ba78316a2641e2
--
2.41.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* [bug#69126] [PATCH 1/2] gnu: Add debug-assert.
2024-02-14 15:33 [bug#69126] [PATCH 0/2] gnu: Add type-safe Paul A. Patience
@ 2024-02-14 15:36 ` Paul A. Patience
2024-02-14 21:29 ` Skyler Ferris via Guix-patches via
2024-02-14 15:36 ` [bug#69126] [PATCH 2/2] gnu: Add type-safe Paul A. Patience
` (4 subsequent siblings)
5 siblings, 1 reply; 14+ messages in thread
From: Paul A. Patience @ 2024-02-14 15:36 UTC (permalink / raw)
To: 69126; +Cc: Paul A. Patience
* gnu/packages/cpp.scm (debug-assert): New variable.
Change-Id: I4cee49ea2f5b761ab72bb7b063c2ea8fd99b991c
---
gnu/packages/cpp.scm | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 62a1923571..2456de5002 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -38,7 +38,7 @@
;;; Copyright © 2023 Liliana Marie Prikler <liliana.prikler@gmail.com>
;;; Copyright © 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
;;; Copyright © 2023 Foundation Devices, Inc. <hello@foundationdevices.com>
-;;; Copyright © 2023 Paul A. Patience <paul@apatience.com>
+;;; Copyright © 2023-2024 Paul A. Patience <paul@apatience.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -3048,3 +3048,29 @@ (define-public tl-optional
the std::optional for C++11/14/17, with support for monadic operations added in
C++23.")
(license license:cc0)))
+
+(define-public debug-assert
+ ;; Newer version than last release, which was in 2018, is required for
+ ;; type_safe.
+ (let ((commit "d33781479baccf52a28e5c3c5a6da5ac59b09179")
+ (revision "0"))
+ (package
+ (name "debug-assert")
+ (version (git-version "1.3.3" revision commit))
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/foonathan/debug_assert")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "0njbzx767pndpl8hq5falr4c8m0xsr6njh0943xf8xkcqq6splpz"))))
+ (build-system cmake-build-system)
+ (arguments (list #:tests? #f)) ; no tests
+ (home-page "https://github.com/foonathan/debug_assert")
+ (synopsis "Assertion macro for C++")
+ (description "debug_assert is a C++11 header-only library which provides the
+@code{DEBUG_ASSERT()} macro, which among other features can be selectively
+enabled in different parts of your code.")
+ (license license:zlib))))
--
2.41.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [bug#69126] [PATCH 2/2] gnu: Add type-safe.
2024-02-14 15:33 [bug#69126] [PATCH 0/2] gnu: Add type-safe Paul A. Patience
2024-02-14 15:36 ` [bug#69126] [PATCH 1/2] gnu: Add debug-assert Paul A. Patience
@ 2024-02-14 15:36 ` Paul A. Patience
2024-02-14 21:30 ` Skyler Ferris via Guix-patches via
2024-02-14 21:27 ` [bug#69126] [PATCH 0/2] " Skyler Ferris via Guix-patches via
` (3 subsequent siblings)
5 siblings, 1 reply; 14+ messages in thread
From: Paul A. Patience @ 2024-02-14 15:36 UTC (permalink / raw)
To: 69126; +Cc: Paul A. Patience
* 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
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [bug#69126] [PATCH 0/2] gnu: Add type-safe.
2024-02-14 15:33 [bug#69126] [PATCH 0/2] gnu: Add type-safe Paul A. Patience
2024-02-14 15:36 ` [bug#69126] [PATCH 1/2] gnu: Add debug-assert Paul A. Patience
2024-02-14 15:36 ` [bug#69126] [PATCH 2/2] gnu: Add type-safe Paul A. Patience
@ 2024-02-14 21:27 ` Skyler Ferris via Guix-patches via
2024-02-15 14:25 ` [bug#69126] [PATCH v2] " Paul A. Patience
` (2 subsequent siblings)
5 siblings, 0 replies; 14+ messages in thread
From: Skyler Ferris via Guix-patches via @ 2024-02-14 21:27 UTC (permalink / raw)
To: Paul A. Patience, 69126
Hi Paul,
I am adding some review notes to this issue. To avoid any potential
confusion I want to be clear that I am not a committer, but I am adding
these notes in hopes that it will help a committer process these patches
more efficiently.
Regards,
Skyler
^ permalink raw reply [flat|nested] 14+ messages in thread
* [bug#69126] [PATCH 1/2] gnu: Add debug-assert.
2024-02-14 15:36 ` [bug#69126] [PATCH 1/2] gnu: Add debug-assert Paul A. Patience
@ 2024-02-14 21:29 ` Skyler Ferris via Guix-patches via
2024-02-15 14:02 ` Paul A. Patience
0 siblings, 1 reply; 14+ messages in thread
From: Skyler Ferris via Guix-patches via @ 2024-02-14 21:29 UTC (permalink / raw)
To: Paul A. Patience, 69126
Things needing attention:
`guix lint` issues a warning that the beginning of the description
starts with a lowercase letter. IMO this is reasonable because the first
word is the name of the project, and it is a common convention for
project names to remain lowercased (the README in the project follows
this convention). However I am not sure how the Guix maintainers
consider this.
The arguments form is attached to a comment saying that there are no
tests, but it looks like the repository does contain a test in the
`test_package` directory with a separate CMakelists.txt file. I haven't
spent much time with the cmake build system in Guix, would it be
reasonable to replace the check phase with a procedure that uses the
file in this directory? If not then it might be helpful to replace the
comment with one explaining that, while tests exist, it is not feasible
to run them for some specific reason.
More details:
This diff applies cleanly to commit
ac470c516e19f194228edf9e348bdbc7fc10f97a.
The following paragraph contains notes about the confidence level of
source integrity. These notes are provided to indicate that due
attention has been given to this matter and to provide transparency into
the level of confidence in the source as well as the entities trusted
with maintaining integrity. The "optimal" level of confidence is
use-case dependent, as is the trustability of any given entity. These
notes are provided for transparency to the committer and any other
interested parties and should not be interpreted as criticism of the commit.
The commit used in the source form is signed by PGP key
5DE3E0509C47EA3CF04A42D34AEE18F83AFDEB23. The key is expired but NOT
revoked. It is available on the Ubuntu keyserver
(http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x5de3e0509c47ea3cf04a42d34aee18f83afdeb23)
with several other signatures, though none that are trusted by my
keyring. It is also available on the OpenPGP keyserver
(https://keys.openpgp.org/vks/v1/by-fingerprint/5DE3E0509C47EA3CF04A42D34AEE18F83AFDEB23)
but without a UID, meaning the email address was not verified. Note that
one of the UIDs listed in the Ubuntu server is "GitHub (web-flow
commit)", implying that the GitHub server is ultimately responsible for
maintaining integrity.
`./pre-inst-env guix build debug-assert` succeeded on my machine, an
x86_64 Xen guest. Additionally, the following program (based on the
example in the README) successfully compiled and produced the expected
output.
main.cpp
```
#include <debug_assert.hpp>
struct mymodule : debug_assert::default_handler,
debug_assert::set_level<static_cast<unsigned int>(-1)> {};
int main(void) {
DEBUG_ASSERT(1 +1 == 3, my_module{}, debug_assert::level<2>{});
}
```
```
$ ./pre-inst-env guix shell gcc-toolchain debug-assert -C -- g++
-std=c++11 main.cpp
$ ./a.out
[debug assert] main.cpp:6: Assertion '1 +1 == 3' failed.
Aborted
```
The LICENSE file provided in the source repository matches the contents
I see at https://directory.fsf.org/wiki/License:Zlib.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [bug#69126] [PATCH 2/2] gnu: Add type-safe.
2024-02-14 15:36 ` [bug#69126] [PATCH 2/2] gnu: Add type-safe Paul A. Patience
@ 2024-02-14 21:30 ` Skyler Ferris via Guix-patches via
2024-02-15 14:23 ` Paul A. Patience
0 siblings, 1 reply; 14+ messages in thread
From: Skyler Ferris via Guix-patches via @ 2024-02-14 21:30 UTC (permalink / raw)
To: Paul A. Patience, 69126
Things needing attention:
When I tried to compile a file which included `type_safe/integer.hpp`
from a container (see below for exact commands & source), I got an error
that the debug_assert header could not be found. I resolved this by
changing the debug-assert package from a normal input into a propagated
input, but there could be other ways to solve this.
main.cpp
```
#include <type_safe/integer.hpp>
int main(void) {
type_safe::integer<int> tsi(1);
return tsi.get();
}
```
```
$ ./pre-inst-env guix shell gcc-toolchain type-safe -C -- g++ -std=c++11
main.cpp
<error indicating that debug_assert.hpp was not found>
```
More details:
This diff applies cleanly to commit
ac470c516e19f194228edf9e348bdbc7fc10f97a, after applying the previous
commit in this series.
As with the review on the previous patch, notes about confidence in
source integrity are provided as an indication of attention and to
provide transparency. The commit tagged v0.2.3 does not have a signature
on it, but the commit 3 steps prior has a good signature. It uses the
same signing key as debug-assert, so all of the notes from there apply
here as well.
`./pre-inst-env guix build type-safe` succeeded on my machine, an x86_64
Xen guest. Additionally, after fixing the issue noted in the "Things
needing attention" section, the following test file produced an expected
compiler error indicating that the type_safe::integer needs an initial
value.
main.cpp
```
#include <type_safe/integer.hpp>
int main(void) {
type_safe::integer<int> tsi;
return tsi.get();
}
```
Once I added an initial value as shown in the "Things needing attention"
section, the file built successfully and the executable returned the
expected exit code.
```
$ ./pre-inst-env guix shell gcc-toolchain type-safe -C -- g++ -std=c++11
main.cpp
$ ./a.out
$ echo $?
1
```
The license file in the project matches the contents I see at
https://directory.fsf.org/wiki/License:Expat.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [bug#69126] [PATCH 1/2] gnu: Add debug-assert.
2024-02-14 21:29 ` Skyler Ferris via Guix-patches via
@ 2024-02-15 14:02 ` Paul A. Patience
0 siblings, 0 replies; 14+ messages in thread
From: Paul A. Patience @ 2024-02-15 14:02 UTC (permalink / raw)
To: Skyler Ferris; +Cc: 69126
Hello,
Thanks for reviewing my patches.
On 2024-02-14 16:29:05-05:00, Skyler Ferris wrote:
> `guix lint` issues a warning that the beginning of the description
> starts with a lowercase letter. IMO this is reasonable because the first
> word is the name of the project, and it is a common convention for
> project names to remain lowercased (the README in the project follows
> this convention). However I am not sure how the Guix maintainers
> consider this.
I was aware of the issue, and I share your opinion.
Sometimes project authors write the project name lowercased but in a
fixed-width font, in which case I use either @samp{} or @code{}, which
guix lint does not raise an error for.
However, this author does not, so I left it as such.
For what it's worth, I counted a few hundred instances of a lowercased
project name without @samp{} or @code{} in the first line of the
description across the Guix codebase.
I will leave it to the discretion of the committer.
> The arguments form is attached to a comment saying that there are no
> tests, but it looks like the repository does contain a test in the
> `test_package` directory with a separate CMakelists.txt file. I haven't
> spent much time with the cmake build system in Guix, would it be
> reasonable to replace the check phase with a procedure that uses the
> file in this directory? If not then it might be helpful to replace the
> comment with one explaining that, while tests exist, it is not feasible
> to run them for some specific reason.
The test_package directory seems to test the installation of
debug_assert with the Conan package manager, so there is nothing to do
here.
Best regards,
Paul
^ permalink raw reply [flat|nested] 14+ messages in thread
* [bug#69126] [PATCH 2/2] gnu: Add type-safe.
2024-02-14 21:30 ` Skyler Ferris via Guix-patches via
@ 2024-02-15 14:23 ` Paul A. Patience
0 siblings, 0 replies; 14+ messages in thread
From: Paul A. Patience @ 2024-02-15 14:23 UTC (permalink / raw)
To: Skyler Ferris; +Cc: 69126
On 2024-02-14 16:30:57-05:00, Skyler Ferris wrote:
> When I tried to compile a file which included `type_safe/integer.hpp`
> from a container (see below for exact commands & source), I got an error
> that the debug_assert header could not be found. I resolved this by
> changing the debug-assert package from a normal input into a propagated
> input, but there could be other ways to solve this.
Nice catch.
I have been using the type_safe library via CMake, which I made work in
the fix-cmake-config phase, but I forgot to consider the case you raised.
I've fixed the issue and will submit a patch presently.
Thanks for providing sample code and invocation, it made it quicker to
test.
Best regards,
Paul
^ permalink raw reply [flat|nested] 14+ messages in thread
* [bug#69126] [PATCH v2] gnu: Add type-safe.
2024-02-14 15:33 [bug#69126] [PATCH 0/2] gnu: Add type-safe Paul A. Patience
` (2 preceding siblings ...)
2024-02-14 21:27 ` [bug#69126] [PATCH 0/2] " Skyler Ferris via Guix-patches via
@ 2024-02-15 14:25 ` Paul A. Patience
2024-02-17 8:43 ` Liliana Marie Prikler
2024-02-20 19:33 ` [bug#69126] [PATCH v3 0/2] " Paul A. Patience
2024-11-03 23:37 ` bug#69126: [PATCH 0/2] " Sharlatan Hellseher
5 siblings, 1 reply; 14+ messages in thread
From: Paul A. Patience @ 2024-02-15 14:25 UTC (permalink / raw)
To: 69126; +Cc: Paul A. Patience
* gnu/packages/cpp.scm (type-safe): New variable.
Change-Id: I96a690b41af78e331744daacba1cf5ee77f8257a
---
This patch addresses the issue raised by Skylar Ferris.
gnu/packages/cpp.scm | 60 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 60 insertions(+)
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 2456de5002..f7e502d1bf 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -3074,3 +3074,63 @@ (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*
+ (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)))
base-commit: 0191a95edf076b5cd24326d49e54ce13f2bdb0d4
--
2.41.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [bug#69126] [PATCH v2] gnu: Add type-safe.
2024-02-15 14:25 ` [bug#69126] [PATCH v2] " Paul A. Patience
@ 2024-02-17 8:43 ` Liliana Marie Prikler
0 siblings, 0 replies; 14+ messages in thread
From: Liliana Marie Prikler @ 2024-02-17 8:43 UTC (permalink / raw)
To: Paul A. Patience, 69126
Am Donnerstag, dem 15.02.2024 um 14:25 +0000 schrieb Paul A. Patience:
> * gnu/packages/cpp.scm (type-safe): New variable.
>
> Change-Id: I96a690b41af78e331744daacba1cf5ee77f8257a
> ---
> This patch addresses the issue raised by Skylar Ferris.
Hi, the convention when renewing patches is to keep the order of the
old. Even if you don't resend all of them (which many for the record
do), it makes sense to still calls this v2 2/2 unless 1/2 is already
pushed.
> gnu/packages/cpp.scm | 60
> ++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 60 insertions(+)
>
> diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
> index 2456de5002..f7e502d1bf 100644
> --- a/gnu/packages/cpp.scm
> +++ b/gnu/packages/cpp.scm
> @@ -3074,3 +3074,63 @@ (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"))))
You could also rewrite the top-level CMake file so that this is not an
issue. Alternatively, use the (let ((keep …)) …) pattern, so that the
code is self-explanatory.
> + (build-system cmake-build-system)
> + (arguments
> + (list #:configure-flags
> + #~(list "-DTYPE_SAFE_BUILD_TEST_EXAMPLE=ON"
> + "-DTYPE_SAFE_BUILD_DOC=OFF") ; needs standardese
Can we package that or is there some bootstrapping issue?
> + #: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>")))
Use search-input-file.
> + (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")))))
Use search-input-directory.
> + (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\")"))))))))
In general, I'd encourage writing a patch to fix both this and the
issues pointed out above. Note, that CMake has its way of locating
packages per cmake files or pkgconfig, so hard-coding directories as
done here is typically *not* needed.
> + (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)))
Cheers
^ permalink raw reply [flat|nested] 14+ messages in thread
* [bug#69126] [PATCH v3 0/2] gnu: Add type-safe.
2024-02-14 15:33 [bug#69126] [PATCH 0/2] gnu: Add type-safe Paul A. Patience
` (3 preceding siblings ...)
2024-02-15 14:25 ` [bug#69126] [PATCH v2] " Paul A. Patience
@ 2024-02-20 19:33 ` Paul A. Patience
2024-02-20 19:33 ` [bug#69126] [PATCH v3 1/2] gnu: Add debug-assert Paul A. Patience
2024-02-20 19:33 ` [bug#69126] [PATCH v3 2/2] gnu: Add type-safe Paul A. Patience
2024-11-03 23:37 ` bug#69126: [PATCH 0/2] " Sharlatan Hellseher
5 siblings, 2 replies; 14+ messages in thread
From: Paul A. Patience @ 2024-02-20 19:33 UTC (permalink / raw)
To: 69126; +Cc: Paul A. Patience
Resubmitting the patch series as per Liliana Marie Prikler's suggestion.
No changes since the last.
Paul A. Patience (2):
gnu: Add debug-assert.
gnu: Add type-safe.
gnu/packages/cpp.scm | 88 +++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 87 insertions(+), 1 deletion(-)
base-commit: 570ef13a87bb54d3410c431700ba78316a2641e2
--
2.41.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* [bug#69126] [PATCH v3 1/2] gnu: Add debug-assert.
2024-02-20 19:33 ` [bug#69126] [PATCH v3 0/2] " Paul A. Patience
@ 2024-02-20 19:33 ` Paul A. Patience
2024-02-20 19:33 ` [bug#69126] [PATCH v3 2/2] gnu: Add type-safe Paul A. Patience
1 sibling, 0 replies; 14+ messages in thread
From: Paul A. Patience @ 2024-02-20 19:33 UTC (permalink / raw)
To: 69126; +Cc: Paul A. Patience
* gnu/packages/cpp.scm (debug-assert): New variable.
Change-Id: I4cee49ea2f5b761ab72bb7b063c2ea8fd99b991c
---
gnu/packages/cpp.scm | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 62a1923571..2456de5002 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -38,7 +38,7 @@
;;; Copyright © 2023 Liliana Marie Prikler <liliana.prikler@gmail.com>
;;; Copyright © 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
;;; Copyright © 2023 Foundation Devices, Inc. <hello@foundationdevices.com>
-;;; Copyright © 2023 Paul A. Patience <paul@apatience.com>
+;;; Copyright © 2023-2024 Paul A. Patience <paul@apatience.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -3048,3 +3048,29 @@ (define-public tl-optional
the std::optional for C++11/14/17, with support for monadic operations added in
C++23.")
(license license:cc0)))
+
+(define-public debug-assert
+ ;; Newer version than last release, which was in 2018, is required for
+ ;; type_safe.
+ (let ((commit "d33781479baccf52a28e5c3c5a6da5ac59b09179")
+ (revision "0"))
+ (package
+ (name "debug-assert")
+ (version (git-version "1.3.3" revision commit))
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/foonathan/debug_assert")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "0njbzx767pndpl8hq5falr4c8m0xsr6njh0943xf8xkcqq6splpz"))))
+ (build-system cmake-build-system)
+ (arguments (list #:tests? #f)) ; no tests
+ (home-page "https://github.com/foonathan/debug_assert")
+ (synopsis "Assertion macro for C++")
+ (description "debug_assert is a C++11 header-only library which provides the
+@code{DEBUG_ASSERT()} macro, which among other features can be selectively
+enabled in different parts of your code.")
+ (license license:zlib))))
--
2.41.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [bug#69126] [PATCH v3 2/2] gnu: Add type-safe.
2024-02-20 19:33 ` [bug#69126] [PATCH v3 0/2] " Paul A. Patience
2024-02-20 19:33 ` [bug#69126] [PATCH v3 1/2] gnu: Add debug-assert Paul A. Patience
@ 2024-02-20 19:33 ` Paul A. Patience
1 sibling, 0 replies; 14+ messages in thread
From: Paul A. Patience @ 2024-02-20 19:33 UTC (permalink / raw)
To: 69126; +Cc: Paul A. Patience
* gnu/packages/cpp.scm (type-safe): New variable.
Change-Id: I96a690b41af78e331744daacba1cf5ee77f8257a
---
gnu/packages/cpp.scm | 60 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 60 insertions(+)
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 2456de5002..f7e502d1bf 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -3074,3 +3074,63 @@ (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*
+ (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)))
--
2.41.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* bug#69126: [PATCH 0/2] gnu: Add type-safe.
2024-02-14 15:33 [bug#69126] [PATCH 0/2] gnu: Add type-safe Paul A. Patience
` (4 preceding siblings ...)
2024-02-20 19:33 ` [bug#69126] [PATCH v3 0/2] " Paul A. Patience
@ 2024-11-03 23:37 ` Sharlatan Hellseher
5 siblings, 0 replies; 14+ messages in thread
From: Sharlatan Hellseher @ 2024-11-03 23:37 UTC (permalink / raw)
To: 69126-done
[-- Attachment #1: Type: text/plain, Size: 111 bytes --]
Hi,
I've refreshed versions, built, lint locally.
Pushed 84266a8f74..d33626fb07 to master.
--
Thanks,
Oleg
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2024-11-03 23:39 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-14 15:33 [bug#69126] [PATCH 0/2] gnu: Add type-safe Paul A. Patience
2024-02-14 15:36 ` [bug#69126] [PATCH 1/2] gnu: Add debug-assert Paul A. Patience
2024-02-14 21:29 ` Skyler Ferris via Guix-patches via
2024-02-15 14:02 ` Paul A. Patience
2024-02-14 15:36 ` [bug#69126] [PATCH 2/2] gnu: Add type-safe Paul A. Patience
2024-02-14 21:30 ` Skyler Ferris via Guix-patches via
2024-02-15 14:23 ` Paul A. Patience
2024-02-14 21:27 ` [bug#69126] [PATCH 0/2] " Skyler Ferris via Guix-patches via
2024-02-15 14:25 ` [bug#69126] [PATCH v2] " Paul A. Patience
2024-02-17 8:43 ` Liliana Marie Prikler
2024-02-20 19:33 ` [bug#69126] [PATCH v3 0/2] " Paul A. Patience
2024-02-20 19:33 ` [bug#69126] [PATCH v3 1/2] gnu: Add debug-assert Paul A. Patience
2024-02-20 19:33 ` [bug#69126] [PATCH v3 2/2] gnu: Add type-safe Paul A. Patience
2024-11-03 23:37 ` bug#69126: [PATCH 0/2] " Sharlatan Hellseher
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.