From patchwork Mon Oct 25 15:14:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Attila Lendvai X-Patchwork-Id: 34034 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 BA59627BBE3; Mon, 25 Oct 2021 16:18:49 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 6D87F27BBE1 for ; Mon, 25 Oct 2021 16:18:48 +0100 (BST) Received: from localhost ([::1]:56704 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mf1kN-00019R-EQ for patchwork@mira.cbaines.net; Mon, 25 Oct 2021 11:18:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43666) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mf1je-00018s-Pt for guix-patches@gnu.org; Mon, 25 Oct 2021 11:18:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:60687) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mf1je-0003BD-Hl for guix-patches@gnu.org; Mon, 25 Oct 2021 11:18:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mf1je-0003sV-EZ for guix-patches@gnu.org; Mon, 25 Oct 2021 11:18:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50217] [PATCH v2] gnu: Add c2ffi. References: <20210826210712.31273-1-mail@muradm.net> In-Reply-To: <20210826210712.31273-1-mail@muradm.net> Resent-From: Attila Lendvai Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 25 Oct 2021 15:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50217 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch moreinfo To: 50217@debbugs.gnu.org Cc: Attila Lendvai Received: via spool by 50217-submit@debbugs.gnu.org id=B50217.163517507714881 (code B ref 50217); Mon, 25 Oct 2021 15:18:02 +0000 Received: (at 50217) by debbugs.gnu.org; 25 Oct 2021 15:17:57 +0000 Received: from localhost ([127.0.0.1]:43994 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mf1jU-0003ro-GE for submit@debbugs.gnu.org; Mon, 25 Oct 2021 11:17:57 -0400 Received: from mail-ed1-f41.google.com ([209.85.208.41]:44829) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mf1jS-0003ra-QF for 50217@debbugs.gnu.org; Mon, 25 Oct 2021 11:17:51 -0400 Received: by mail-ed1-f41.google.com with SMTP id a26so836027edy.11 for <50217@debbugs.gnu.org>; Mon, 25 Oct 2021 08:17:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=zt5No0ZVzTiU/0Jj+xXw1t9o6Jl6oDMiuj7gUC+LdYQ=; b=iA0VFadD5h3a/gRvtivhhnATkmoDueoW/St5LmPVf2aLUDCIq0ok3whjRbMabCWXN6 +AanuW7OGOPn5PYGb6vM+dx+Q3PD9Zmf/1HiU1I0WNaoGgU7xiHvOuGbnmEa+SXSMemJ UnHQCoOSfs2a0dNDdEYAETxgm0h5ENM+idSYrxgQ2gesyEeuwYn7AegcGWZRO6/ZwwZK jkte208gGeNc+zhH5LFFEn56elNiAhEPGsU1RU7mnswNTBmhenlFhiKWE+aeJUInE1nk 88rh0HRbO8QT0OGpIqrpQ4HNcFXRoZ2wds8d3kF7NymcQlPgMM7lP0NCmDhNaru5fRfH edNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=zt5No0ZVzTiU/0Jj+xXw1t9o6Jl6oDMiuj7gUC+LdYQ=; b=13tyaV7DeEn/EEBW4uMn97k+l1fOrjmjhnXCeFINj9qg7iHQbb96Y6juBV/XLc4EFu vWCJyvYWQqZa1rfmVvtSmbqERRw4GUx/doVJOXmx7Y2O9YHyj9MyhA0BEP5r317fBNE0 Jcmx+PS2cjH6zQo/Vih5Lya9YLC5uMFHNeU+w+yIe9WoJAWFrde+frTXn0onDJrWHB27 foM7Gk8D9TJadN9tAvwo/Bln11/FbhAw6UoXKDTx5C4M+b+wiEbtWwljDCY8tI3Q+Ns1 4UpqNx0l79IfNcnPw9C//fi9wwcQO8xyYqOY8HVBX+0005n6PQ7IetL9igkfGZFRKhHq c/9w== X-Gm-Message-State: AOAM5335/1LflVLs8wZtfQ2msokinADqDDEkH4H9KqZIOe90+EmU77Mo Rz/k4COmXIaalIdPUz5ySAFwKLCyLcA= X-Google-Smtp-Source: ABdhPJzf1vJ68XoG1X9pQQqONv1BcXe25XPRoryBK/gWlDOBfHolegKo61lQueyOr0jNf0MXJVDWAw== X-Received: by 2002:a17:906:7ce:: with SMTP id m14mr23536710ejc.513.1635175010683; Mon, 25 Oct 2021 08:16:50 -0700 (PDT) Received: from lelap.lan (catv-89-132-208-37.catv.broadband.hu. [89.132.208.37]) by smtp.gmail.com with ESMTPSA id r19sm1435819edo.77.2021.10.25.08.16.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Oct 2021 08:16:49 -0700 (PDT) From: Attila Lendvai Date: Mon, 25 Oct 2021 17:14:06 +0200 Message-Id: <20211025151405.12198-1-attila@lendvai.name> X-Mailer: git-send-email 2.33.0 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" X-getmail-retrieved-from-mailbox: Patches Orignial work by muradm , fixes by Attila Lendvai. * gnu/packages/cpp.scm (c2ffi): New variable. --- as muradm didn't respond, i took the liberty to addressed the concerns. i don't know how to credit the original author, so feel free to fix that part. let me know if there's anything else to fix. gnu/packages/cpp.scm | 48 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm index 643b85a8db..08df093f92 100644 --- a/gnu/packages/cpp.scm +++ b/gnu/packages/cpp.scm @@ -18,6 +18,8 @@ ;;; Copyright © 2020 Brett Gilio ;;; Copyright © 2020 Milkey Mouse ;;; Copyright © 2021 Raghav Gururajan +;;; Copyright © 2021 muradm +;;; Copyright © 2021 Attila Lendvai ;;; ;;; This file is part of GNU Guix. ;;; @@ -1398,3 +1400,49 @@ (define-public simdjson validation.") (home-page "https://github.com/simdjson/simdjson") (license license:asl2.0))) + +(define-public c2ffi + (let ((commit "f50243926a0afb589de1078a073ac08910599582") + (revision "1")) + (package + (name "c2ffi") + (home-page "https://github.com/rpav/c2ffi") + ;; Upstream has no releases, only one branch per LLVM release. Let's put + ;; the LLVM version into the version string, use a revision as a + ;; human-readable differentiation of the versions that gets imported + ;; into Guix, and also use the commit hash to be specific. + (version (git-version "11.0.0" revision commit)) + (source (origin + (method git-fetch) + (uri (git-reference (url home-page) (commit commit))) + (file-name (git-file-name name version)) + (sha256 (base32 "17j73yb6v3lfvwwicl2f3yg141iz2dk1rf874qzqs5bkq64ldjsj")) + (modules '((guix build utils))) + (snippet + '(substitute* "CMakeLists.txt" + ;; cmake-build-system default cmake version + (("VERSION 3.17") "VERSION 3.16.5") + ;; guix seems to be packaging LLVM libs separately + ;; thus -lLLVM is not working, every used library should + ;; be specified explicitly + (("c2ffi PUBLIC clang-cpp LLVM") + "c2ffi PUBLIC clang-cpp LLVMCore LLVMSupport LLVMMCParser \ +LLVMOption LLVMBitReader LLVMProfileData"))))) + (build-system cmake-build-system) + (arguments + '(;; llvm-11 at least seems to be built without RTTI + ;; llvm-12 on the other hand specifies -DLLVM_REQUIRES_RTTI=1 + ;; may fail with this flag when c2ffi for llvm-12 released + ;; https://stackoverflow.com/q/11904519 + #:configure-flags '("-DCMAKE_CXX_FLAGS=-fno-rtti") + ;; Upstream has no tests. + #:tests? #f)) + (inputs + `(("clang" ,clang-11) + ("llvm" ,llvm-11))) + (synopsis "Clang-based FFI wrapper generator") + (description "@code{c2ffi} is a tool for extracting definitions from C, C++, and +Objective C headers for use with foreign function call interfaces. It uses the +@code{Clang/LLVM} infrastructure to extract the data, and emits it in various formats, +including @code{json}.") + (license license:gpl2+))))