From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.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 iA02DDf4C2IKDwAAgWs5BA (envelope-from ) for ; Tue, 15 Feb 2022 20:00:07 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 0M6UCDf4C2J4QQAAauVa8A (envelope-from ) for ; Tue, 15 Feb 2022 20:00:07 +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 95C2390B8 for ; Tue, 15 Feb 2022 20:00:06 +0100 (CET) Received: from localhost ([::1]:54138 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nK33V-0003El-61 for larch@yhetil.org; Tue, 15 Feb 2022 14:00:05 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58586) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nK2pO-000287-Cq for guix-patches@gnu.org; Tue, 15 Feb 2022 13:45:30 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:52501) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nK2ox-00084I-1O for guix-patches@gnu.org; Tue, 15 Feb 2022 13:45:28 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nK2ow-0000tx-KT for guix-patches@gnu.org; Tue, 15 Feb 2022 13:45:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#50217] [PATCH v5] 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 18:45: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.16449506873425 (code B ref 50217); Tue, 15 Feb 2022 18:45:02 +0000 Received: (at 50217) by debbugs.gnu.org; 15 Feb 2022 18:44:47 +0000 Received: from localhost ([127.0.0.1]:46398 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nK2oa-0000t2-Bc for submit@debbugs.gnu.org; Tue, 15 Feb 2022 13:44:46 -0500 Received: from mail-ed1-f52.google.com ([209.85.208.52]:37670) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nK2oY-0000sn-CG for 50217@debbugs.gnu.org; Tue, 15 Feb 2022 13:44:39 -0500 Received: by mail-ed1-f52.google.com with SMTP id q17so963834edd.4 for <50217@debbugs.gnu.org>; Tue, 15 Feb 2022 10:44:38 -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=npDJlUgWEtEWZCm6IDLdwdJl3O/XrgRwd5htXwGfSRU=; b=ZP2y3VdJH3Dt3Tx/tog07nYfdkuzKqseMkrqCB/EU8bKGggOJmOWF8jBGOn55DEbLa wfhicxo3fAVaFBz3+58x5Ds/mjOINwVUzPJeQmyI2D5mMDQbUDVI03BNAa7NKUYL4ead bca4pqE7BAfVTivhWEQ5g19u/6xkbEDntWAqrEyAanctXZwYnAi3jUmFu4/oyQx5jSut x8xvO+PmlE9/tF51Mr6QjQrNGlw3zZpWtu5nt1D/A47Y2soh4zgLakbB+E7Vtn5L3AAe 6H+QIhcGoVpJA07vsG1HBIJ2DabFVh6PGENb9Eajrtc7yF8uA4cHM9QvqaztWsX9cgCF TwNg== 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=npDJlUgWEtEWZCm6IDLdwdJl3O/XrgRwd5htXwGfSRU=; b=5BL0cUvr1xumEsKt61ZNlnRKWe4+zm3FIdWscQz85laTBMeuFBXeSPQcpT/v7RtQWx I53oLB++OPKCKAljnXAMA/xMS3Cc8IVzZ7zONJ97hDXGGzvDGZD4ICmaOrt/r9iwGbHN UFOGjls1eBNcYxyuVA+RGHijCZA1bCMXIRXDzPy6v4/Qmu5oHUVfYrI87zNbBgZtPQzX UPGjbShLVQKEWb91tfc3138SdBIHORczzXICZeMzC9mhlGLwSXtFkGVqOhZRfOqH1PrH CfB7ZZQMRxdHgAvh6xeAYFfJ2rMgkXad2VrgyS8yGYBNcG/VYyzrWUuUkC67GJrXphj1 RAZg== X-Gm-Message-State: AOAM532ypAXBAnDjbIajxZIJOUFjNAwXTKyWFCyyTYTkk/LiQgxl06/q QXOLagS65CAuPFYNb3/x5xTnBn/qbLc= X-Google-Smtp-Source: ABdhPJw9NVayY4jO4laSnEzDNCe0HDVjEEhhPuGXhdWWKPeLdOncxJRGJdxAYz/lyYz2VuKgFf7e4Q== X-Received: by 2002:a05:6402:2058:: with SMTP id bc24mr327066edb.106.1644950672233; Tue, 15 Feb 2022 10:44:32 -0800 (PST) Received: from localhost.localdomain ([2a02:ab88:3710:7c80:9130:5abf:96b3:dc0c]) by smtp.gmail.com with ESMTPSA id m15sm305882edd.78.2022.02.15.10.44.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Feb 2022 10:44:31 -0800 (PST) From: Attila Lendvai Date: Tue, 15 Feb 2022 19:43:08 +0100 Message-Id: <20220215184307.5436-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=1644951606; 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=npDJlUgWEtEWZCm6IDLdwdJl3O/XrgRwd5htXwGfSRU=; b=t+XVl9iQQbBc+E8V4c+ql1y2bH5LDpOC+2SBuuUNw9qhjn95IfaauwYE7tX6R1TeZrBBXZ 9JFqQ3LaETDMV24W79lxu27WRe5lmzCIuAHjw31P64it9PEUIwGoYDph+Cg43MRSETlDHQ y10+29UDmv78bG1kMQYeQyDX9y5l1udVuLvJlIDhfl3W99eavc1SQtlFs2j6kcxsGihwAV STvvBt51FLzqIhfRcPBZopf+0X6AgzV6l6vUELUhr9t9myugRKKQc2tlBKbYG6dDueVs2b viKF2QfsO0xM6ZpBTEdUUTz1KnLqqeT3HiEyVf69LhrgXDHuw1yqSBVdJWlhgQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1644951606; a=rsa-sha256; cv=none; b=HnuIgxmrldmZteTti2nPokjcS9wh8+s7uThbU0GhBXC+6g8TEcTz83MneXslkkuq8Iyz90 YtKjeROLDQYsS8xB5hUKL9FjjtTSutLEeVTxmfPqy7kuGh3n3AVj4AVuU85H8Co5Uy3+Na iTU1S5jkWJ3fPEzpNUk3c5Ustn0Lv7h4/+XcnQrN8X26uj+ZDoU+4AdeoFbNLDi+Zps9YB 65/7xkNcZ/LMvgB5y/iA0bKXZY18ZTMLEofwIdlAQmuwojHnCCqCu/0xWPOEX4KJ521zTN mYs85JOcV3+Wm4P8QDMFGg1dGQ8KyPVgwMXM9lD9Fx7b+nOcfCawrKI2m92k0Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=ZP2y3VdJ; 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=ZP2y3VdJ; 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: 95C2390B8 X-Spam-Score: -1.13 X-Migadu-Scanner: scn1.migadu.com X-TUID: 5eZksmMYVU2B Orignial work by muradm , fixes by Attila Lendvai. * gnu/packages/cpp.scm (c2ffi): New variable. --- thank you for the excellent suggestions Maxime! and sorry for being sloppy with guix lint and others! v5 should address everything that you pointed out. gnu/packages/cpp.scm | 46 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm index 86138531c0..bc6d69e225 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,47 @@ (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") + (version "12.0.0.0") ; The first element is the Clang/LLVM version + (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