[PATCH] gnu: Add ghc-c2hs.

  • Done
  • quality assurance status badge
Details
2 participants
  • Gabriel Hondet
  • Ludovic Courtès
Owner
unassigned
Submitted by
Gabriel Hondet
Severity
normal

Debbugs page

Gabriel Hondet wrote 6 years ago
(address . guix-patches@gnu.org)
875zujv07j.fsf@gmail.com
* gnu/packages/haskell.scm (ghc-c2hs): New variable.
---
gnu/packages/haskell.scm | 56 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)

Toggle diff (67 lines)
diff --git a/gnu/packages/haskell.scm b/gnu/packages/haskell.scm
index a3ce2a3e4..c7587af7c 100644
--- a/gnu/packages/haskell.scm
+++ b/gnu/packages/haskell.scm
@@ -11405,4 +11405,60 @@ from a shell. The @code{tldr} pages are a community effort to simplify the
man pages with practical examples.")
(license license:bsd-3)))
+(define-public ghc-c2hs
+ (package
+ (name "ghc-c2hs")
+ (version "0.28.6")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append
+ "https://hackage.haskell.org/package/c2hs/c2hs-"
+ version
+ ".tar.gz"))
+ (sha256
+ (base32
+ "1nplgxfin139x12sb656f5870rpdclrhzi8mq8pry035qld15pci"))))
+ (build-system haskell-build-system)
+ (inputs
+ `(("ghc-language-c" ,ghc-language-c)
+ ("ghc-dlist" ,ghc-dlist)))
+ (native-inputs
+ `(("ghc-test-framework" ,ghc-test-framework)
+ ("ghc-test-framework-hunit" ,ghc-test-framework-hunit)
+ ("ghc-hunit" ,ghc-hunit)
+ ("ghc-shelly" ,ghc-shelly)
+ ("ghc-text" ,ghc-text)
+ ("gcc" ,gcc)))
+ (arguments
+ `(#:tests? #f ;some tests fail because of syntax errors
+ #:phases
+ (modify-phases %standard-phases
+ (add-before 'check 'set-cc
+ ;; add a cc executable in the path, needed for some tests to pass
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((gcc (assoc-ref inputs "gcc"))
+ (tmpbin (tmpnam))
+ (curpath (getenv "PATH")))
+ (mkdir-p tmpbin)
+ (symlink (which "gcc") (string-append tmpbin "/cc"))
+ (setenv "PATH" (string-append tmpbin ":" curpath)))
+ #t))
+ (add-after 'check 'remove-cc
+ ;; clean the tmp dir made in 'set-cc
+ (lambda _
+ (let* ((cc-path (which "cc"))
+ (cc-dir (dirname cc-path)))
+ (delete-file-recursively cc-dir)
+ #t))))))
+ (home-page "https://github.com/haskell/c2hs")
+ (synopsis
+ "C->Haskell FFI tool that gives some cross-language type safety")
+ (description "C->Haskell assists in the development of Haskell bindings to
+C libraries. It extracts interface information from C header files and
+generates Haskell code with foreign imports and marshaling. Unlike writing
+foreign imports by hand (or using hsc2hs), this ensures that C functions are
+imported with the correct Haskell types.")
+ (license license:gpl2)))
+
;;; haskell.scm ends here
--
2.20.1
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEE5ercJXBcjd3P1FcAMbyBBfZZ1CUFAlxEjjAACgkQMbyBBfZZ
1CWRdxAAjBuz6WPp6ZXH4PbTcvW/AlX7PY05U0e1x3Yiv8gU+SLeekWVEdkRE8XZ
HNCBqk/AS+GfBnTyGbH+DXElCWKc9SQmjzj6Ld/3lmE2WPNLsfW5O+C49wUj2jb3
2NOOQCPIjZCC7zN7jEL+wBBwoQJDAcaxQW0eIqAmaiI1VVDlaKT7x0jQ09fEkIo/
ZGuoauLq1LRuGWSvCUwW4sVJn3qCywxk6MRoj9ElyNAxcoY5eWaQ0eCC0rWsZIvp
CHbORUL/WBbphjKOUd/2WDWFyn07VQeeVpLKhOaTkm+ZZ8KncqgXnEBapC8w7xmr
C6Mb2rCsKg4P83l4ZUR9xgvZKCuVHjtUH6GfvAuD5YRVfgac3h1b4+Lco5812odE
0kuKotVbTJDhbYzlUSBMWpWMt386IrMVlIqOR7f6LsofTayieahW7mpRaNhbsJLU
lrfpvs+FhdvfZLgNH3CX0zJ6eRQghyeULpUYl4K/kfH9kldi1m6e1PEVXE8ugjuF
0UI7tbeo6gfXUvD0hvvMtU7N5+TD9DI+lzWpAdfxoyYwiDQ2kCGsBMkbLR2JElrL
PAC09oHZ6Nmq5uz/87mi2t7QCb4GEKD0OPKFy0oIKJ8jPwphiyVDiJQ5oWAKwCAY
JIAf5ND4dsDWdNa92XJ15DDxlwiEFHixpal/+lPyG27xEQG6yds=
=JB2H
-----END PGP SIGNATURE-----

Ludovic Courtès wrote 6 years ago
(name . Gabriel Hondet)(address . gabrielhondet@gmail.com)(address . 34146-done@debbugs.gnu.org)
877eevdmvd.fsf@gnu.org
Gabriel Hondet <gabrielhondet@gmail.com> skribis:

Toggle quote (2 lines)
> * gnu/packages/haskell.scm (ghc-c2hs): New variable.

Applied with the changes below.

It’d be nice to report the test failures upstream since it could be
fairly problematic for such a tool to fail to parse C headers.

Thanks,
Ludo’.
Toggle diff (26 lines)
diff --git a/gnu/packages/haskell.scm b/gnu/packages/haskell.scm
index 02af900354..b8ea36852b 100644
--- a/gnu/packages/haskell.scm
+++ b/gnu/packages/haskell.scm
@@ -11429,7 +11429,10 @@ man pages with practical examples.")
("ghc-text" ,ghc-text)
("gcc" ,gcc)))
(arguments
- `(#:tests? #f ;some tests fail because of syntax errors
+ `(;; XXX: Test failures are induced by a parse error in <bits/floatn.h>
+ ;; of glibc 2.28.
+ #:tests? #f
+
#:phases
(modify-phases %standard-phases
(add-before 'check 'set-cc
@@ -11450,8 +11453,7 @@ man pages with practical examples.")
(delete-file-recursively cc-dir)
#t))))))
(home-page "https://github.com/haskell/c2hs")
- (synopsis
- "C->Haskell FFI tool that gives some cross-language type safety")
+ (synopsis "Create Haskell bindings to C libraries")
(description "C->Haskell assists in the development of Haskell bindings to
C libraries. It extracts interface information from C header files and
generates Haskell code with foreign imports and marshaling. Unlike writing
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 34146@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 34146
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
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help