diff mbox series

[bug#50217,v2] gnu: Add c2ffi-11.0.0.

Message ID 20210827001207.4105-1-mail@muradm.net
State Accepted
Headers show
Series [bug#50217,v2] gnu: Add c2ffi-11.0.0. | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

muradm Aug. 27, 2021, 12:12 a.m. UTC
* gnu/packages/cpp.scm (c2ffi): New variable.
---
 gnu/packages/cpp.scm | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

Comments

Ludovic Courtès Sept. 7, 2021, 2:06 p.m. UTC | #1
Hello,

muradm <mail@muradm.net> skribis:

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

Overall LGTM, modulo the following minor issues:

[...]

> +(define-public c2ffi
> +  (let ((commit "f50243926a0afb589de1078a073ac08910599582")
> +        (revision "1")
> +        (c2ffi-sha256 "17j73yb6v3lfvwwicl2f3yg141iz2dk1rf874qzqs5bkq64ldjsj"))

Normally, we only provide upstream releases.  If you think we need this
specific commit, could you add a comment explaining why?

Please leave the base32 sha256 string where it’s used, within the
(base32 …) expression (it’s a macro that decodes base32 at
compile-time.)

> +         #:tests? #f))

It would be best to run tests.  Alternatively, if this is not feasible,
please add a comment explaining why we’re skipping them.

> +      (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.")

Please write full sentences, as per
<https://guix.gnu.org/manual/en/html_node/Synopses-and-Descriptions.html>.

> +      (license license:gpl2))))

Is it GPLv2-only?  Unless it’s explicitly stated, it’s probably
GPLv2-or-later (‘license:gpl2+’).

Could you send an updated patch?

Thanks!

Ludo’.
diff mbox series

Patch

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index ba921fac11..239e87bf84 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,42 @@  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
+  (let ((commit "f50243926a0afb589de1078a073ac08910599582")
+        (revision "1")
+        (c2ffi-sha256 "17j73yb6v3lfvwwicl2f3yg141iz2dk1rf874qzqs5bkq64ldjsj"))
+    (package
+      (name "c2ffi")
+      (home-page "https://github.com/rpav/c2ffi")
+      (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 c2ffi-sha256))
+                (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))))