GNU bug report logs - #50217
[PATCH] gnu: Add c2ffi-11.0.0.

Previous Next

Package: guix-patches;

Reported by: muradm <mail <at> muradm.net>

Date: Thu, 26 Aug 2021 21:08:02 UTC

Severity: normal

Tags: moreinfo, patch

Done: Guillaume Le Vaillant <glv <at> posteo.net>

Bug is archived. No further changes may be made.

Full log


Message #22 received at 50217 <at> debbugs.gnu.org (full text, mbox):

From: Attila Lendvai <attila <at> lendvai.name>
To: 50217 <at> debbugs.gnu.org
Cc: Attila Lendvai <attila <at> lendvai.name>
Subject: [PATCH v4] gnu: Add c2ffi.
Date: Mon, 14 Feb 2022 13:31:13 +0100
Orignial work by muradm <mail <at> muradm.net>, fixes by Attila Lendvai.

* gnu/packages/cpp.scm (c2ffi): New variable.
---

new in v4:
 - rebase to master
 - upstream introduced releases, so let's use git tags
 - use LLVM 12
 - add a trivial test that invokes c2ffi --help

 gnu/packages/cpp.scm | 47 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 86138531c0..b394c8e515 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -25,6 +25,8 @@
 ;;; Copyright © 2021 jgart <jgart <at> dismail.de>
 ;;; Copyright © 2021 Julien Lepiller <julien <at> lepiller.eu>
 ;;; Copyright © 2021 Disseminate Dissent <disseminatedissent <at> protonmail.com>
+;;; Copyright © 2021 muradm <mail <at> muradm.net>
+;;; Copyright © 2021 Attila Lendvai <attila <at> lendvai.name>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1717,3 +1719,48 @@ (define-public bloomberg-bde
 multi-threaded applications and network applications.")
       (home-page "https://github.com/bloomberg/bde")
       (license license:asl2.0))))
+
+(define-public c2ffi
+  (let ((git-tag "12.0.0.0"))
+    (package
+      (name "c2ffi")
+      (home-page "https://github.com/rpav/c2ffi")
+      (version (string-append "v" git-tag))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url home-page)
+               (commit 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 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
+       '(;; 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 _
+               (invoke "./bin/c2ffi" "--help"))))))
+      (native-inputs
+       (list clang-12 llvm-12))
+      (inputs
+       (list clang-12 llvm-12))
+      (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





This bug report was last modified 3 years and 79 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.