From patchwork Wed Jan 12 17:13:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Attila Lendvai X-Patchwork-Id: 36281 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 4D7A627BBEA; Wed, 12 Jan 2022 17:22:03 +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,RCVD_IN_MSPIKE_H3,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 C718527BBE9 for ; Wed, 12 Jan 2022 17:22:02 +0000 (GMT) Received: from localhost ([::1]:34748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n7hJw-0004xN-Ro for patchwork@mira.cbaines.net; Wed, 12 Jan 2022 12:22:00 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48078) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n7hDC-0008Hn-Uv for guix-patches@gnu.org; Wed, 12 Jan 2022 12:15:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:37730) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n7hDC-0005dV-Dk for guix-patches@gnu.org; Wed, 12 Jan 2022 12:15:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n7hDC-0005dg-1O for guix-patches@gnu.org; Wed, 12 Jan 2022 12:15:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#50217] [PATCH v3] 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: Wed, 12 Jan 2022 17:15:01 +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.164200769021639 (code B ref 50217); Wed, 12 Jan 2022 17:15:01 +0000 Received: (at 50217) by debbugs.gnu.org; 12 Jan 2022 17:14:50 +0000 Received: from localhost ([127.0.0.1]:58866 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n7hCu-0005cr-G5 for submit@debbugs.gnu.org; Wed, 12 Jan 2022 12:14:49 -0500 Received: from mail-wr1-f44.google.com ([209.85.221.44]:46951) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n7hCp-0005cU-JV for 50217@debbugs.gnu.org; Wed, 12 Jan 2022 12:14:42 -0500 Received: by mail-wr1-f44.google.com with SMTP id l25so5411318wrb.13 for <50217@debbugs.gnu.org>; Wed, 12 Jan 2022 09:14:39 -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=9B6FIR0lUiN/MPATitoSI82bdL+aHVDbeEZuZCfgiUY=; b=MZfOyWukkChfprZmvzdC5ILO5moJsoCY48UkWLyb2ziD5NIORvQc6q1uLD11UGV+i3 hwk9ujl4a0Eolf6iioxMCDNggTYj9rlCaeUPVYBOzsebaYVqrfG2LF1QDUJSce4KtX0d bhI8p6nrAbkkk0/FmJiryiQGOwxvS6Qfq53CvQD0xJvhkpmzAcj8cd4t2t2izlBMHxRw 22XCAhRfGk1TVJNVvD33Ow6Zyvf2D4iDc4wstbpE/MpXTzi1VrdmxR+y3lG3ANK2j4um zqjgl3f8n3FkakzLGvS6YFCK4pJj9Cbxe0Wpe8sTM9mVsGA53tDG97mb6zzdsnpplSF5 1ARA== 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=9B6FIR0lUiN/MPATitoSI82bdL+aHVDbeEZuZCfgiUY=; b=xoMeRolkyWJJ0SqJrtspcdY6ApBO1F5MBHJYuiPL58syWkh7I+cCz+fAp9ZPf9t1jJ 9x19Y5+z1Ln2HfCxGRmZ4H9kI7kkXHTCp6fO7TpUsgs4RMMnigF20NqOnzarKLyJ2XpQ cj2Dz0A5Y3ROrDuP5nxcgeM/CYmifsiLzi6cHB91Txz8uCJ59L7n5SWs9cQ5wQlv5yvg Mc/ftfv1AO8bxTACYMbvhNaSxN5/8yspyMKrJjrEF7Dtz58uOslA18aUQgHvgfQIJZix dBmzcN2ffPqypQo/tr20KoMs8tnDM3c3d7ujahK36wBVAnrZXKi43NVLaW1rosuUWFa2 EQYQ== X-Gm-Message-State: AOAM5336H1xUab94PaDcu+Z5ERbJTz6Yb/nce3j283H8GgfZDjXvc9rQ +5wgG0FoH8hKasE9DY6ALRaXM86qiw/HQA== X-Google-Smtp-Source: ABdhPJwh1PDbk+MEmM7Jq1lf3r99ptUk+LnLw0/MVmk1WnNjmaC0XYfuuPQa0pRw9mBqNjqBwLL3sg== X-Received: by 2002:a05:6000:1d91:: with SMTP id bk17mr595950wrb.684.1642007673512; Wed, 12 Jan 2022 09:14:33 -0800 (PST) Received: from lelap.home ([2a02:120b:2c72:1dc0:2e07:56d9:2bb8:283d]) by smtp.gmail.com with ESMTPSA id r132sm777876wma.34.2022.01.12.09.14.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jan 2022 09:14:32 -0800 (PST) From: Attila Lendvai Date: Wed, 12 Jan 2022 18:13:31 +0100 Message-Id: <20220112171329.22695-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. --- v3 converts the input lists to the new format. gnu/packages/cpp.scm | 47 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm index 718fb20652..d7e2ff49e5 100644 --- a/gnu/packages/cpp.scm +++ b/gnu/packages/cpp.scm @@ -22,6 +22,8 @@ ;;; Copyright © 2021 Nicolò Balzarotti ;;; Copyright © 2021 Guillaume Le Vaillant ;;; Copyright © 2021 Nikolay Korotkiy +;;; Copyright © 2021 muradm +;;; Copyright © 2021 Attila Lendvai ;;; ;;; This file is part of GNU Guix. ;;; @@ -1452,3 +1454,48 @@ (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" + ;; 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)) + (native-inputs + (list clang-11 llvm-11)) + (inputs + (list clang-11 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+))))