From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id ONgSAMPKdmFlNAAAgWs5BA (envelope-from ) for ; Mon, 25 Oct 2021 17:18:27 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id gNBoN8LKdmEYAwAA1q6Kng (envelope-from ) for ; Mon, 25 Oct 2021 15:18:26 +0000 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 7637A20D0B for ; Mon, 25 Oct 2021 17:18:26 +0200 (CEST) Received: from localhost ([::1]:56704 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mf1k1-00019R-Fw for larch@yhetil.org; Mon, 25 Oct 2021 11:18:25 -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 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1635175106; 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=zt5No0ZVzTiU/0Jj+xXw1t9o6Jl6oDMiuj7gUC+LdYQ=; b=ivwEEOw742GS0D9RLyyH0+8TWkRLRXFLdnU8+MpBwJVCH0hnSWf8hVrYkLjptjDm4lQkv8 amcKouEpQxr2qyRRvBsKo65Xm0bS/sV6S6cC2gUZcL6bDt8+uwQR10KaKPqJWtTjlZ56Cq uVkxfBM+DZQsVTbmw4XbpDlVCEaecaS96Q3dhcit7GdxdUe2xldE8MM3zWGyNtyOr1AImr 4o+Wh6JSJAOYLsSjYJgfZeEcqEt/VNGXhBIyDfwYeHVC6rCdrnEUM9PBIgNVGiMlSg7amS IheAkDMPoYgy6Th0s7UNpVP4nN0n8RtZoVmIMp8YWGCrwWIgb57z/ShKAkOObA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1635175106; a=rsa-sha256; cv=none; b=gAsnUikhhvxCITaXPWqmBW+AUS7w2HJGtbwDejHPuYrV0fcygbQcTHCLprtQr3X8lnuypL wVR1dOue4g31ZBiYj4swPIdxzDfixnY237LWQxBP+RyhTRiGAE8FciFzzYFLk7z9g/KkWk A/K95XTrYmqO+k8ZQukubhFRh0sL6TltFk1QHQc7cdnEWOHVkXR8/CmJL+VKqrUG1phaDP E31cPhAzyt7eKjQHYXb6vll7gLhgmYf59rwLFzemPsm/uibabJw8jwgNKy4s3rm6LSViNo ADoPVPNE6AQZkRp43rZedy9YvwxTnrpItJM4Ui5Zf3lwjFAzvhAOntxvl0CLVg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=iA0VFadD; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -0.43 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=iA0VFadD; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 7637A20D0B X-Spam-Score: -0.43 X-Migadu-Scanner: scn0.migadu.com X-TUID: /68yFW1NMhX/ 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+)))) -- 2.33.0