From patchwork Tue Feb 20 19:33:33 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: 60805 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 1AC9527BBEA; Tue, 20 Feb 2024 19:34:57 +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=ham 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 78B4127BBE2 for ; Tue, 20 Feb 2024 19:34:56 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rcVtA-0007cW-82; Tue, 20 Feb 2024 14:34:48 -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 1rcVt5-0007Rr-5o for guix-patches@gnu.org; Tue, 20 Feb 2024 14:34:44 -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 1rcVt3-0007z4-LN for guix-patches@gnu.org; Tue, 20 Feb 2024 14:34:42 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rcVtP-0002KW-Ez for guix-patches@gnu.org; Tue, 20 Feb 2024 14:35:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69126] [PATCH v3 2/2] gnu: Add type-safe. Resent-From: "Paul A. Patience" Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 20 Feb 2024 19:35:03 +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.17084576688891 (code B ref 69126); Tue, 20 Feb 2024 19:35:03 +0000 Received: (at 69126) by debbugs.gnu.org; 20 Feb 2024 19:34:28 +0000 Received: from localhost ([127.0.0.1]:46600 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rcVsp-0002JK-Nk for submit@debbugs.gnu.org; Tue, 20 Feb 2024 14:34:28 -0500 Received: from mail-4323.proton.ch ([185.70.43.23]:61727) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rcVsn-0002J4-2L for 69126@debbugs.gnu.org; Tue, 20 Feb 2024 14:34:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apatience.com; s=protonmail2; t=1708457637; x=1708716837; bh=mjdr2Qiz5+akJ2ZE3A4FraIo/dnAxo1XBtHaVxF6VQ0=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=cLx9uVR0B8lV45GTifQ2VZBpJfkoCtMwcU25GLVfc5Jww2/Xq4FLmJ7O5Gf1uPuCx xIbcZLg69EUZ+HVtmKFVYI7tJoSuET/oneNWSua/GrFNUZ6CrfTu4N3fWS1QDbGnJ/ cwrTrODQ+t3Fl66p6FN0TPYBBvJmOTwh64OSdiKcsKU0kZrPcwCdHnhv8q5d2Y7CeE XWVzRIVjkQklKrqtIZYAnx/J+FJ2dRDEB1fYKWcFAjrVpceqtBXRDttjDNX+Cf2reK XYFQjXFTrdtIPi+CX5W41NtCwkTqPUiJIyWfN5eaOc4zfDb+oxATDlxySrREYtzleR TjYW6VDyZLgjg== Date: Tue, 20 Feb 2024 19:33:33 +0000 From: "Paul A. Patience" Message-ID: <6c2fafee4c064a64bc918781c106d4e67732d45d.1708457406.git.paul@apatience.com> In-Reply-To: References: 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 --- 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 ") + (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)))