[PATCH] gnu: Add c2ffi-11.0.0.

  • Done
  • quality assurance status badge
Details
5 participants
  • Attila Lendvai
  • Guillaume Le Vaillant
  • Ludovic Courtès
  • muradm
  • Maxime Devos
Owner
unassigned
Submitted by
muradm
Severity
normal

Debbugs page

M
M
muradm wrote on 26 Aug 2021 14:07
(address . guix-patches@gnu.org)
20210826210712.31273-1-mail@muradm.net
* 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
M
M
muradm wrote on 26 Aug 2021 17:12
[PATCH v2] gnu: Add c2ffi-11.0.0.
(address . 50217@debbugs.gnu.org)
20210827001207.4105-1-mail@muradm.net
* gnu/packages/cpp.scm (c2ffi): New variable.
---
gnu/packages/cpp.scm | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)

Toggle diff (57 lines)
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))))
--
2.33.0
L
L
Ludovic Courtès wrote on 7 Sep 2021 07:06
Re: bug#50217: [PATCH] gnu: Add c2ffi-11.0.0.
(name . muradm)(address . mail@muradm.net)(address . 50217@debbugs.gnu.org)
87r1e04h0l.fsf_-_@gnu.org
Hello,

muradm <mail@muradm.net> skribis:

Toggle quote (2 lines)
> * gnu/packages/cpp.scm (c2ffi): New variable.

Overall LGTM, modulo the following minor issues:

[...]

Toggle quote (5 lines)
> +(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.)

Toggle quote (2 lines)
> + #: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.

Toggle quote (4 lines)
> + (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.")

Toggle quote (2 lines)
> + (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’.
L
L
Ludovic Courtès wrote on 24 Sep 2021 04:54
control message for bug #50217
(address . control@debbugs.gnu.org)
877df6p4sw.fsf@gnu.org
tags 50217 + moreinfo
quit
A
A
Attila Lendvai wrote on 25 Oct 2021 08:14
[PATCH v2] gnu: Add c2ffi.
(address . 50217@debbugs.gnu.org)(name . Attila Lendvai)(address . attila@lendvai.name)
20211025151405.12198-1-attila@lendvai.name
Orignial work by muradm <mail@muradm.net>, fixes by Attila Lendvai.

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

as muradm didn't respond, i took the liberty to addressed the concerns.

i don't know how to credit the original author, so feel free to
fix that part.

let me know if there's anything else to fix.

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

Toggle diff (65 lines)
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 643b85a8db..08df093f92 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -18,6 +18,8 @@
;;; 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>
+;;; Copyright © 2021 Attila Lendvai <attila@lendvai.name>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -1398,3 +1400,49 @@ (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"
+ ;; 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")
+ ;; Upstream has no tests.
+ #:tests? #f))
+ (inputs
+ `(("clang" ,clang-11)
+ ("llvm" ,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+))))
--
2.33.0
A
A
Attila Lendvai wrote on 12 Jan 2022 09:13
[PATCH v3] gnu: Add c2ffi.
(address . 50217@debbugs.gnu.org)(name . Attila Lendvai)(address . attila@lendvai.name)
20220112171329.22695-1-attila@lendvai.name
Orignial work by muradm <mail@muradm.net>, 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(+)

Toggle diff (64 lines)
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 <nicolo@nixo.xyz>
;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
;;; Copyright © 2021 Nikolay Korotkiy <sikmir@disroot.org>
+;;; Copyright © 2021 muradm <mail@muradm.net>
+;;; Copyright © 2021 Attila Lendvai <attila@lendvai.name>
;;;
;;; 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+))))
--
2.34.0
A
A
Attila Lendvai wrote on 14 Feb 2022 04:31
[PATCH v4] gnu: Add c2ffi.
(address . 50217@debbugs.gnu.org)(name . Attila Lendvai)(address . attila@lendvai.name)
20220214123112.20135-1-attila@lendvai.name
Orignial work by muradm <mail@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(+)

Toggle diff (64 lines)
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@dismail.de>
;;; Copyright © 2021 Julien Lepiller <julien@lepiller.eu>
;;; Copyright © 2021 Disseminate Dissent <disseminatedissent@protonmail.com>
+;;; Copyright © 2021 muradm <mail@muradm.net>
+;;; Copyright © 2021 Attila Lendvai <attila@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
M
M
Maxime Devos wrote on 14 Feb 2022 07:30
be79a01793c15e40f3de234635f6a31ddfcf999b.camel@telenet.be
Attila Lendvai schreef op ma 14-02-2022 om 13:31 [+0100]:
Toggle quote (4 lines)
> +           (replace 'check
> +             (lambda _
> +               (invoke "./bin/c2ffi" "--help"))))))

For cross-compiling c2ffi, this needs to respect #:tests?, because
tests cannot be run when cross-compiling. This would be detected by
"./pre-inst-env guix lint".

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYgp1hhccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7nVBAP4yiV5mW4cEZVsbGqPjm8DvFEr2
o3gE58+B5TlrGXnqwwEA93KvIU/6pdEkV2eGA81qlvigCk1CeF1xb7VoJMqe7gA=
=iRdS
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 14 Feb 2022 07:34
e5e6361ba4ee0c936c243541886af75b17912b56.camel@telenet.be
Attila Lendvai schreef op ma 14-02-2022 om 13:31 [+0100]:
Toggle quote (12 lines)
> +  (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)))

Isn't it the other way around? Looking at the git repo, the git tag is
v12.0.0.0, not 12.0.0.0, and Guix strips version prefixes like "v", "V"
and "version-". Also, IIUC, the current consensus is that home pages
and source git repos are separate things, even if sometimes their URL
coincides, so the URL may need to be copied into the 'url' field.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYgp2dhccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7jEkAPwMsBZzvJT3LJmlxaNtlndrmbHh
dxS+bGQE8IxGb5NlOwD/XUHkQRChejnjylvQYbzrxoFAcu5JdE/uXIKg0NspWgU=
=IO93
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 14 Feb 2022 07:41
3831b49aabb202978ca3f33cdcb2a0db868a50d9.camel@telenet.be
Attila Lendvai schreef op ma 14-02-2022 om 13:31 [+0100]:
Toggle quote (3 lines)
> +      (native-inputs
> +       (list clang-12 llvm-12))

Is clang (the C compiler) required to compile c2fii, or would the usual
gcc suffice? If the former, I would add a comment

;; only supports compilation with clang, gcc does not work here

or the like. Is the version of clang and LLVM used for compiling c2ffi
important? If not, I would write (native-inputs (list clang llvm))
such that the default clang and LLVM version in Guix is used.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYgp4NRccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7qIYAQDQkNGw0CrDkroWSqy4KxTHKALa
GPAAuGEtotqpjtMfAgD9EF4xPPRfme0I3Z0VQOBJWPBvxYLY7YkR/KGQab4n3QI=
=6jya
-----END PGP SIGNATURE-----


A
A
Attila Lendvai wrote on 15 Feb 2022 10:43
[PATCH v5] gnu: Add c2ffi.
(address . 50217@debbugs.gnu.org)(name . Attila Lendvai)(address . attila@lendvai.name)
20220215184307.5436-1-attila@lendvai.name
Orignial work by muradm <mail@muradm.net>, fixes by Attila Lendvai.

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

thank you for the excellent suggestions Maxime! and sorry for being
sloppy with guix lint and others!

v5 should address everything that you pointed out.

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

Toggle diff (63 lines)
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 86138531c0..bc6d69e225 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -25,6 +25,8 @@
;;; Copyright © 2021 jgart <jgart@dismail.de>
;;; Copyright © 2021 Julien Lepiller <julien@lepiller.eu>
;;; Copyright © 2021 Disseminate Dissent <disseminatedissent@protonmail.com>
+;;; Copyright © 2021 muradm <mail@muradm.net>
+;;; Copyright © 2021 Attila Lendvai <attila@lendvai.name>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -1717,3 +1719,47 @@ (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")
+ (version "12.0.0.0") ; The first element is the Clang/LLVM version
+ (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+)))
--
2.34.0
A
A
Attila Lendvai wrote on 15 Feb 2022 11:51
[PATCH v6] gnu: Add c2ffi.
(address . 50217@debbugs.gnu.org)(name . Attila Lendvai)(address . attila@lendvai.name)
20220215195146.25660-1-attila@lendvai.name
Orignial work by muradm <mail@muradm.net>, fixes by Attila Lendvai.

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

v6: add a comment to clarify the versioning scheme.

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

Toggle diff (65 lines)
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 86138531c0..6e690b593d 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -25,6 +25,8 @@
;;; Copyright © 2021 jgart <jgart@dismail.de>
;;; Copyright © 2021 Julien Lepiller <julien@lepiller.eu>
;;; Copyright © 2021 Disseminate Dissent <disseminatedissent@protonmail.com>
+;;; Copyright © 2021 muradm <mail@muradm.net>
+;;; Copyright © 2021 Attila Lendvai <attila@lendvai.name>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -1717,3 +1719,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+)))
--
2.34.0
A
A
Attila Lendvai wrote on 1 Mar 2022 01:17
[PATCH v7] gnu: Add c2ffi.
(address . 50217@debbugs.gnu.org)(name . Attila Lendvai)(address . attila@lendvai.name)
20220301091725.4972-1-attila@lendvai.name
Orignial work by muradm <mail@muradm.net>, 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(+)

Toggle diff (65 lines)
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 <julien@lepiller.eu>
;;; Copyright © 2021 Disseminate Dissent <disseminatedissent@protonmail.com>
;;; Copyright © 2022 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2022 muradm <mail@muradm.net>
+;;; Copyright © 2022 Attila Lendvai <attila@lendvai.name>
;;;
;;; 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+)))
--
2.34.0
A
A
Attila Lendvai wrote on 1 Mar 2022 01:21
[PATCH v8] gnu: Add c2ffi.
(address . 50217@debbugs.gnu.org)(name . Attila Lendvai)(address . attila@lendvai.name)
20220301092110.6199-1-attila@lendvai.name
Orignial work by muradm <mail@muradm.net>, fixes by Attila Lendvai.

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

v8: fix formatting.

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

Toggle diff (65 lines)
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index de6b529302..82b17e916a 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -26,6 +26,8 @@
;;; Copyright © 2021 Julien Lepiller <julien@lepiller.eu>
;;; Copyright © 2021 Disseminate Dissent <disseminatedissent@protonmail.com>
;;; Copyright © 2022 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2022 muradm <mail@muradm.net>
+;;; Copyright © 2022 Attila Lendvai <attila@lendvai.name>
;;;
;;; 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+)))
--
2.34.0
A
A
Attila Lendvai wrote on 3 Mar 2022 10:36
[PATCH v9] gnu: Add c2ffi.
(address . 50217@debbugs.gnu.org)(name . Attila Lendvai)(address . attila@lendvai.name)
20220303183627.29296-1-attila@lendvai.name
Orignial work by muradm <mail@muradm.net>, fixes by Attila Lendvai.

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

v9 is a rebase once again. this time moving the package definition to
an alphabetical point to avoid frequent conflicts with other additions.


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

Toggle diff (68 lines)
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 06d22088f6..c37df93bda 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -26,6 +26,8 @@
;;; Copyright © 2021 Julien Lepiller <julien@lepiller.eu>
;;; Copyright © 2021 Disseminate Dissent <disseminatedissent@protonmail.com>
;;; Copyright © 2022 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2022 muradm <mail@muradm.net>
+;;; Copyright © 2022 Attila Lendvai <attila@lendvai.name>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -227,6 +229,52 @@ (define-public c++-gsl
(home-page "https://github.com/microsoft/GSL/")
(license license:expat)))
+(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+)))
+
(define-public libzen
(package
(name "libzen")
--
2.34.0
G
G
Guillaume Le Vaillant wrote on 3 Mar 2022 12:34
(name . Attila Lendvai)(address . attila@lendvai.name)(address . 50217-done@debbugs.gnu.org)
87zgm6zsdj.fsf@kitej
Patch pushed as 8c303758590e368fc6a67bfff8dd1721e70afd93.
I just slightly modified the commit message.
Thanks.
-----BEGIN PGP SIGNATURE-----

iIUEAREKAC0WIQTLxZxm7Ce5cXlAaz5r6CCK3yH+PwUCYiEmmA8cZ2x2QHBvc3Rl
by5uZXQACgkQa+ggit8h/j+kaQD+PeFQim1GZFgxHuhI6ufCjShCfnzVvR4w0cES
Qbskji8A/A1CYq8zCP7M0FcciyjE1do0Y4IHnFhzf1wCDnRzPWXR
=aH1/
-----END PGP SIGNATURE-----

Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 50217@patchwise.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 50217
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch