(address . guix-patches@gnu.org)
* gnu/packages/cpp.scm (c2ffi): New variable.
---
gnu/packages/cpp.scm | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
Toggle diff (58 lines)
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index ba921fac11..f2663b7e6e 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -18,6 +18,7 @@
;;; Copyright © 2020 Brett Gilio <brettg@gnu.org>
;;; Copyright © 2020 Milkey Mouse <milkeymouse@meme.institute>
;;; Copyright © 2021 Raghav Gururajan <rg@raghavgururajan.name>
+;;; Copyright © 2021 muradm <mail@muradm.net>
;;;
;;; This file is part of GNU Guix.
@@ -1250,3 +1251,43 @@ of reading and writing XML.")
(description "Jsonnet is a templating language extending JSON
syntax with variables, conditions, functions and more.")
(license license:asl2.0)))
+
+(define-public c2ffi
+ (package
+ (name "c2ffi")
+ (home-page "https://github.com/rpav/c2ffi")
+ (version "11.0.0")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url home-page)
+ (commit (string-append "llvm-" version))))
+ (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")
+ #:tests? #f))
+ (inputs
+ `(("clang" ,clang-11)
+ ("llvm" ,llvm-11)))
+ (synopsis "Clang-based FFI wrapper generator")
+ (description "tool for extracting definitions from C, C++, and
+Objective C headers for use with foreign function call interfaces.")
+ (license license:gpl2)))
--
2.33.0