From patchwork Tue Mar 1 09:17:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Attila Lendvai X-Patchwork-Id: 37566 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 65D1927BBEA; Tue, 1 Mar 2022 10:04:53 +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=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, 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 DBD1F27BBE9 for ; Tue, 1 Mar 2022 10:04:52 +0000 (GMT) Received: from localhost ([::1]:50828 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nOzND-0001zc-VK for patchwork@mira.cbaines.net; Tue, 01 Mar 2022 05:04:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36822) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOyeu-0006pn-5z for guix-patches@gnu.org; Tue, 01 Mar 2022 04:19:05 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:41528) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOyes-00009p-Id for guix-patches@gnu.org; Tue, 01 Mar 2022 04:19:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nOyes-0001rE-EW for guix-patches@gnu.org; Tue, 01 Mar 2022 04:19:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#50217] [PATCH v7] 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, 01 Mar 2022 09:19: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.16461263147101 (code B ref 50217); Tue, 01 Mar 2022 09:19:02 +0000 Received: (at 50217) by debbugs.gnu.org; 1 Mar 2022 09:18:34 +0000 Received: from localhost ([127.0.0.1]:35425 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOyeJ-0001qN-TD for submit@debbugs.gnu.org; Tue, 01 Mar 2022 04:18:34 -0500 Received: from mail-ed1-f52.google.com ([209.85.208.52]:41640) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOyeI-0001q6-BO for 50217@debbugs.gnu.org; Tue, 01 Mar 2022 04:18:27 -0500 Received: by mail-ed1-f52.google.com with SMTP id w3so21084236edu.8 for <50217@debbugs.gnu.org>; Tue, 01 Mar 2022 01:18:26 -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=nU+d9Rke0Vm6vLulVm08vPHvxOmp2r1KkZ6ByeXurFA=; b=nEqVAOy691vV0rfGKF52xEgHvynWIpGPvXtH70vKYf9v5hiM+uJzoAsAPpCEFj86OL yCv/nf1vYfXz0TEwr+wn7NjlKAM8b+kXlQJZ5cwytwDD8KFTQRfQjm8wGlIoMn/bZiHj x1EgZYvp5bA+24ZUm0iWLuOVFh532Z0/rijW89LrXIclayRRk1By77dqpck4iUtgEdWs fzTu33FtMbJGF48abGzYXTLVN2ev1f1k2vcTKJKq9jsT+1Y+yzQtEaS4CFcXB9cFWcg4 9KveIIvYJFf91Nf5Qp4awKVFkKfesrrb82xULj8SeYAyNlQ/UXckgsroPVjmOqbmngFQ ihoQ== 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=nU+d9Rke0Vm6vLulVm08vPHvxOmp2r1KkZ6ByeXurFA=; b=aegdNF5YFy7ERsFc/ETfObY0g5jDnsOmXhvTkIvGjlnrSIkJbCWirc0iilGtIcpUw0 v9LVtox+71e1m5T/RTPjTLftPL22nkVyCjPs0IYRNQ8kROlCh2hsUZOcWieerrJ+NnDv gAqcnreet8QYIGMh/sgLmuKyHwAfYJLIc9USI9VXl68GTgtLvUriU6HmSg35Su2wpdFN emO5C+FdYs0/Yh0VfbNTegyNqoQ+2xCIuvCRDmrLoIn/QzCGxRIgcljZBucF/ai/EhnJ wjsvylPQBsldzXBEQ7ojdq9c/pXPP8Zj3q7LyX+fgapT5LkuCx1Ydbtjnk7Hl/1n0m+N o66w== X-Gm-Message-State: AOAM532Zj6Pb4J4f9mchOCwsKBrZ1/XoPqP9ZhxOVveDrs1aYXLAvK8v SlHgBXkBXLXBqBg9fW5IsFJig2llsUk= X-Google-Smtp-Source: ABdhPJzeVJ1D/DsjwStWoI/5KJERH6MgmqlZ++BQFq7jPfpQiJxcM/Y60V6FDFDyI3ulkj+CuhZr2w== X-Received: by 2002:a05:6402:270a:b0:410:a3a4:ba06 with SMTP id y10-20020a056402270a00b00410a3a4ba06mr23139288edd.293.1646126300484; Tue, 01 Mar 2022 01:18:20 -0800 (PST) Received: from lelap.local (catv-89-132-245-188.catv.fixed.vodafone.hu. [89.132.245.188]) by smtp.gmail.com with ESMTPSA id w11-20020a056402128b00b00412ec3f5f74sm6970714edv.62.2022.03.01.01.18.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Mar 2022 01:18:20 -0800 (PST) From: Attila Lendvai Date: Tue, 1 Mar 2022 10:17:26 +0100 Message-Id: <20220301091725.4972-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. --- v7: rebased on master once again. gnu/packages/cpp.scm | 48 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm index de6b529302..f00dc22eab 100644 --- a/gnu/packages/cpp.scm +++ b/gnu/packages/cpp.scm @@ -26,6 +26,8 @@ ;;; Copyright © 2021 Julien Lepiller ;;; Copyright © 2021 Disseminate Dissent ;;; Copyright © 2022 Efraim Flashner +;;; Copyright © 2022 muradm +;;; Copyright © 2022 Attila Lendvai ;;; ;;; This file is part of GNU Guix. ;;; @@ -1721,3 +1723,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+)))