From patchwork Tue Feb 15 19:51:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Attila Lendvai X-Patchwork-Id: 37250 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 361EE27BBE9; Tue, 15 Feb 2022 19:54:02 +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,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 7586527BBEA for ; Tue, 15 Feb 2022 19:54:01 +0000 (GMT) Received: from localhost ([::1]:58204 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nK3tg-0006GT-Kz for patchwork@mira.cbaines.net; Tue, 15 Feb 2022 14:54:00 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44580) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nK3sk-0005mO-TV for guix-patches@gnu.org; Tue, 15 Feb 2022 14:53:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:52629) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nK3sk-0001tB-Iq for guix-patches@gnu.org; Tue, 15 Feb 2022 14:53:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nK3sk-00055i-GI for guix-patches@gnu.org; Tue, 15 Feb 2022 14:53:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#50217] [PATCH v6] 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: Tue, 15 Feb 2022 19:53: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.164495476119538 (code B ref 50217); Tue, 15 Feb 2022 19:53:02 +0000 Received: (at 50217) by debbugs.gnu.org; 15 Feb 2022 19:52:41 +0000 Received: from localhost ([127.0.0.1]:46526 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nK3sJ-00054q-1n for submit@debbugs.gnu.org; Tue, 15 Feb 2022 14:52:41 -0500 Received: from mail-ed1-f48.google.com ([209.85.208.48]:46641) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nK3sH-00054a-Bo for 50217@debbugs.gnu.org; Tue, 15 Feb 2022 14:52:34 -0500 Received: by mail-ed1-f48.google.com with SMTP id m17so48800edc.13 for <50217@debbugs.gnu.org>; Tue, 15 Feb 2022 11:52:33 -0800 (PST) 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=9BvoTmPxst7A+4J8GUVSOnKMWESn05C57NKZfNfocZs=; b=YAD1uYFMv2GXpM7A6A+8OZ1xNn2YI4njGfsMCw4xIo2KSBvr7oQ7Mrk0Wt1VtjgxPA bVETD2NpZwC+FusWKdTIteqN9JRXD+1s7HLXFSnTf7SRpyWYDVqW/q1oX0t0hIi3vzJ+ kjCmzqR7cDDV+jFI46QQ2XindHFLWhPH8WniD8UwKS3Wm8XanVA3P31I9nrWITRdHjbi CJ3K7Hn6m3BFo3CgyYgqvQM4adcaOw836bWB4TTDiEnhiOlR3GQjqrCwUepbEa1+2A5A wpd8AndGnFiJkpLC9jzlHtN24syzrkMmxqm6I8xONz6yJJY/Au7WTJ+fkG55a2Hd2RDO pwFw== 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=9BvoTmPxst7A+4J8GUVSOnKMWESn05C57NKZfNfocZs=; b=w1aGrfnbreC6/whXVPY5UMK9oOaAyiAuFQE+1iGYcQe7v/W6kdx3qp4LU35TcO6NYm J6fH8xlKDXY273onbD4lJbNdhaUUn1z/rVZBrUTvs7FF0lm2gOKSdyLsOAKtNuQMb5FW bcZqZUUpLsU2gn8d4zv+xAQIcmjTXtAgnIQfrevSDfWiPTSCWGlJeGW4fTxYRwknWvGh /3YAAtfSpPcGNqXtgMlIdAcHHMFQRdJ4fMPjbFIQ7m/8w1uuO1qjfr/Ci9xqGYt/fw8o 50LCOyN8U72j9FOv86DEihfNDx+pJZlJ4nBisrgRSlojLBHfpfubRS5s1cwDCd2ehVpL XiCQ== X-Gm-Message-State: AOAM533Q7SzN6WaqrghN7p9sfWPt48fiVeJyavZ0tF59ma9J9lUTt9ro AJmFCNNK0cx7dnC4MemiTVJ1/OImmTU= X-Google-Smtp-Source: ABdhPJzZhEsRQWWujdFCun3FifHdbGrJRqTc4jK8OVjkfip9lY1xLBbrqpSkRL/cz91bjgvCysVQGw== X-Received: by 2002:a05:6402:d0d:: with SMTP id eb13mr581350edb.186.1644954747316; Tue, 15 Feb 2022 11:52:27 -0800 (PST) Received: from localhost.localdomain ([2a02:ab88:3710:7c80:9130:5abf:96b3:dc0c]) by smtp.gmail.com with ESMTPSA id m12sm452597edd.9.2022.02.15.11.52.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Feb 2022 11:52:26 -0800 (PST) From: Attila Lendvai Date: Tue, 15 Feb 2022 20:51:47 +0100 Message-Id: <20220215195146.25660-1-attila@lendvai.name> X-Mailer: git-send-email 2.34.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. --- v6: add a comment to clarify the versioning scheme. gnu/packages/cpp.scm | 48 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm index 86138531c0..6e690b593d 100644 --- a/gnu/packages/cpp.scm +++ b/gnu/packages/cpp.scm @@ -25,6 +25,8 @@ ;;; Copyright © 2021 jgart ;;; Copyright © 2021 Julien Lepiller ;;; Copyright © 2021 Disseminate Dissent +;;; Copyright © 2021 muradm +;;; Copyright © 2021 Attila Lendvai ;;; ;;; This file is part of GNU Guix. ;;; @@ -1717,3 +1719,49 @@ (define-public bloomberg-bde multi-threaded applications and network applications.") (home-page "https://github.com/bloomberg/bde") (license license:asl2.0)))) + +(define-public c2ffi + (package + (name "c2ffi") + ;; As per the c2ffi README: the first three elements are encoding the + ;; required Clang/LLVM version, and the last one is the c2ffi revision. + (version "12.0.0.0") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/rpav/c2ffi") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "1qq8dfismd20d9kfxpfvwz07v9mfvd0y7p5r3c92mk2pm4xnmzfy")) + (modules '((guix build utils))) + (snippet + '(substitute* "CMakeLists.txt" + ;; Guix seems to be packaging LLVM libs separately thus -lLLVM + ;; won't work, every used library must be specified explicitly. + (("c2ffi PUBLIC clang-cpp LLVM") + "c2ffi PUBLIC clang-cpp LLVMCore LLVMSupport LLVMMCParser \ +LLVMOption LLVMBitReader LLVMProfileData"))))) + (build-system cmake-build-system) + (arguments + '(;; If LLVM was built without RTTI, we need to also be built without + ;; it. See: https://stackoverflow.com/q/11904519 + #:configure-flags '("-DCMAKE_CXX_FLAGS=-fno-rtti") + #:phases + (modify-phases %standard-phases + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (invoke "./bin/c2ffi" "--help"))))))) + (native-inputs + (list clang-12)) ; CMakeLists.txt invokes `clang -print-resource-dir` + (inputs + (list clang-12)) ; Compiled with gcc, but links against libclang-cpp.so + (home-page "https://github.com/rpav/c2ffi") + (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+)))