unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Liliana Marie Prikler <liliana.prikler@gmail.com>
To: "Paul A. Patience" <paul@apatience.com>, 69126@debbugs.gnu.org
Subject: [bug#69126] [PATCH v2] gnu: Add type-safe.
Date: Sat, 17 Feb 2024 09:43:53 +0100	[thread overview]
Message-ID: <543f0537937e104e9e030503ab880d19b070eb29.camel@gmail.com> (raw)
In-Reply-To: <6c2fafee4c064a64bc918781c106d4e67732d45d.1708006480.git.paul@apatience.com>

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

  reply	other threads:[~2024-02-17  8:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=543f0537937e104e9e030503ab880d19b070eb29.camel@gmail.com \
    --to=liliana.prikler@gmail.com \
    --cc=69126@debbugs.gnu.org \
    --cc=paul@apatience.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).