From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id gP3tKtYEDGITUAAAgWs5BA (envelope-from ) for ; Tue, 15 Feb 2022 20:53:58 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id GF1iKNYEDGKa2QAA9RJhRA (envelope-from ) for ; Tue, 15 Feb 2022 20:53:58 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id DF505A365 for ; Tue, 15 Feb 2022 20:53:56 +0100 (CET) Received: from localhost ([::1]:58204 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nK3tb-0006GT-Hx for larch@yhetil.org; Tue, 15 Feb 2022 14:53:55 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1644954837; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=9BvoTmPxst7A+4J8GUVSOnKMWESn05C57NKZfNfocZs=; b=qSQg+4PRbXrt4REUW/ziM3w3lQzEF49UQhdIG6nNqeJjqcc3J5EgfA+rx+GxQXMtzSWhnH BKt5dVHHwM0SGduilhVRgIu+tLpPqGBc0LChaFGNOhH/UnkSboZX9ha98Z2NW7JbuLokML k0WSKsUEPBpc1KjCQiu1DTj3VNg/kZVJIkvYyjXd0OYjVgtCmguworm1q2riFZ1wlBD81j Zu0dBoaTGxJj6AuxsElwzxbs/RlXSsiqymMOYOqRh8p8WJVyKXlN/3xaZnuHoChd72xEUR yozNIEH+M3s+m3oOAyfez8j12to55E5Afo9NgYhho9o1kt+tB71oJCH47dcrvg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1644954837; a=rsa-sha256; cv=none; b=ugh3F3XcsI0q72qTdev7kmi4Jjusfazgg4aZt/H4wOwKK7+jQcz/UFLSt8zyNoiPwHoc9x /oXsZ1uiUQeF+7URKKfddHZDWCWBZI7yWFrDvXf1hbk2nPdsfsPK0JPqh2MAIKvhE33h/k +CwjgEd/Vmj5OL0yrRRxR++DwE16D1m4CRcnKaQWvYKSjo0YzWXqDYsHWAqUFJyvnflf/Q 7It16haLC2OyQMwFHNNx2aK4uMGQcXNKH+saRijKTNfacngJpvyeVSk/No5M+phMq/2KNj MKAF7sh7d06Nc+8zlYZgUQZKa7bptjpPRi916qQTwpkzwZVywMuPzpU0Zwvv0w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=YAD1uYFM; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -1.13 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=YAD1uYFM; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: DF505A365 X-Spam-Score: -1.13 X-Migadu-Scanner: scn1.migadu.com X-TUID: sTzhaJVkFDel 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+))) -- 2.34.0