From patchwork Thu Feb 15 14:25:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul A. Patience" X-Patchwork-Id: 60362 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 6CCA727BBE9; Thu, 15 Feb 2024 14:27:05 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 8AB7227BBE2 for ; Thu, 15 Feb 2024 14:27:00 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rachJ-0001tT-9t; Thu, 15 Feb 2024 09:26:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rachH-0001t1-R4 for guix-patches@gnu.org; Thu, 15 Feb 2024 09:26:43 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rachH-0001Of-J1 for guix-patches@gnu.org; Thu, 15 Feb 2024 09:26:43 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1racha-0007aL-7f for guix-patches@gnu.org; Thu, 15 Feb 2024 09:27:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69126] [PATCH v2] gnu: Add type-safe. References: In-Reply-To: Resent-From: "Paul A. Patience" Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 15 Feb 2024 14:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69126 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69126@debbugs.gnu.org Cc: "Paul A. Patience" Received: via spool by 69126-submit@debbugs.gnu.org id=B69126.170800719429121 (code B ref 69126); Thu, 15 Feb 2024 14:27:02 +0000 Received: (at 69126) by debbugs.gnu.org; 15 Feb 2024 14:26:34 +0000 Received: from localhost ([127.0.0.1]:54733 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rach8-0007Zd-71 for submit@debbugs.gnu.org; Thu, 15 Feb 2024 09:26:34 -0500 Received: from mail-40136.proton.ch ([185.70.40.136]:24711) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rach5-0007ZO-K2 for 69126@debbugs.gnu.org; Thu, 15 Feb 2024 09:26:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apatience.com; s=protonmail2; t=1708007166; x=1708266366; bh=qPvRBlGWo092HAhWGefM5IJS0uOBDi7ZR9rEiOuS/t4=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=a0Mjr/EjB7RRLoChquv68vGpmFSSFNQAXKD0QCza4qbjA8hUJuh1IOyEgOwIx2xNk oJJrJV223x2H4obK+M//FcCwBR+osfLwF4HLg+3Cfm8juhdDOEH5s8cy8Meyfx/Bx2 1SyugRQObB0qvYqLgaKs8Lzwwxq4/no8TQDhE4ndf+0Xfe6OEMF7uo5YU6TXUJr23l 4xQc4rBdOyAWSgvRyF5/pdxZxV694+85eVbP6EIkqkT1I0H2QgfZDZa8vCCuLhZQJ8 3gZFtv8TssWcbJE65EZUhzX2kFY2Hlp6w1s5gzHgY0PtpVR/SoVEwhEa0llYtNymab 4zpY/f2qYuyrQ== Date: Thu, 15 Feb 2024 14:25:55 +0000 From: "Paul A. Patience" Message-ID: <6c2fafee4c064a64bc918781c106d4e67732d45d.1708006480.git.paul@apatience.com> Feedback-ID: 19227857:user:proton MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * 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(+) base-commit: 0191a95edf076b5cd24326d49e54ce13f2bdb0d4 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 ") + (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)))