summaryrefslogtreecommitdiff
path: root/gnu/packages/libffi.scm
diff options
context:
space:
mode:
authorThomas Danckaert <thomas.danckaert@gmail.com>2017-10-16 19:52:30 +0200
committerThomas Danckaert <thomas.danckaert@gmail.com>2017-10-16 19:52:30 +0200
commit8cff2e7aed888b3d0e4dcfcda151bc8af68fa1bb (patch)
tree7177d90f3a8f0ba34630e78b5516dbda68ff0570 /gnu/packages/libffi.scm
parent404e3d8b1bcd92ad934711fe759feb220f4d1c60 (diff)
parent484a72a036e6a8af43f517d6547446f3de344a07 (diff)
Merge 'master' into core-updates
Diffstat (limited to 'gnu/packages/libffi.scm')
-rw-r--r--gnu/packages/libffi.scm113
1 files changed, 111 insertions, 2 deletions
diff --git a/gnu/packages/libffi.scm b/gnu/packages/libffi.scm
index 16475affe6..2db57ffb85 100644
--- a/gnu/packages/libffi.scm
+++ b/gnu/packages/libffi.scm
@@ -1,6 +1,10 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
-;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2014 Federico Beffa <beffa@fbengineering.ch>
+;;; Copyright © 2015 Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
+;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2016, 2017 Ben Woodcroft <donttrustben@gmail.com>
+;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -22,7 +26,12 @@
#:use-module (guix licenses)
#:use-module (guix packages)
#:use-module (guix download)
- #:use-module (guix build-system gnu))
+ #:use-module (gnu packages pkg-config)
+ #:use-module (gnu packages python)
+ #:use-module (gnu packages ruby)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix build-system python)
+ #:use-module (guix build-system ruby))
(define-public libffi
(let ((post-install-phase
@@ -66,3 +75,103 @@ conversions for values passed between the two languages.")
;; See <https://github.com/atgreen/libffi/blob/master/LICENSE>.
(license expat))))
+(define-public python-cffi
+ (package
+ (name "python-cffi")
+ (version "1.11.2")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "cffi" version))
+ (sha256
+ (base32 "19h0wwz9cww74gw8cyq0izj8zkhjyzjw2d3ks1c3f1y4q28xv1xb"))))
+ (build-system python-build-system)
+ (outputs '("out" "doc"))
+ (inputs
+ `(("libffi" ,libffi)))
+ (propagated-inputs ; required at run-time
+ `(("python-pycparser" ,python-pycparser)))
+ (native-inputs
+ `(("pkg-config" ,pkg-config)
+ ("python-sphinx" ,python-sphinx)
+ ("python-pytest" ,python-pytest)))
+ (arguments
+ `(#:modules ((ice-9 ftw)
+ (srfi srfi-26)
+ (guix build utils)
+ (guix build python-build-system))
+ #:phases
+ (modify-phases %standard-phases
+ (replace 'check
+ (lambda _
+ (setenv "PYTHONPATH"
+ (string-append
+ (getenv "PYTHONPATH")
+ ":" (getcwd) "/build/"
+ (car (scandir "build" (cut string-prefix? "lib." <>)))))
+
+ ;; XXX The "normal" approach of setting CC and friends does
+ ;; not work here. Is this the correct way of doing things?
+ (substitute* "testing/embedding/test_basic.py"
+ (("c = distutils\\.ccompiler\\.new_compiler\\(\\)")
+ (string-append "c = distutils.ccompiler.new_compiler();"
+ "c.set_executables(compiler='gcc',"
+ "compiler_so='gcc',linker_exe='gcc',"
+ "linker_so='gcc -shared')")))
+ (substitute* "testing/cffi0/test_ownlib.py"
+ (("'cc testownlib") "'gcc testownlib"))
+ (zero? (system* "py.test" "-v" "c/" "testing/"))))
+ (add-before 'check 'disable-failing-test
+ ;; This is assumed to be a libffi issue:
+ ;; https://bitbucket.org/cffi/cffi/issues/312/tests-failed-with-armv8
+ (lambda _
+ (substitute* "testing/cffi0/test_ownlib.py"
+ (("ret.left") "ownlib.left"))
+ #t))
+ (add-after 'install 'install-doc
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((data (string-append (assoc-ref outputs "doc") "/share"))
+ (doc (string-append data "/doc/" ,name "-" ,version))
+ (html (string-append doc "/html")))
+ (with-directory-excursion "doc"
+ (system* "make" "html")
+ (mkdir-p html)
+ (copy-recursively "build/html" html))
+ (copy-file "LICENSE" (string-append doc "/LICENSE"))
+ #t))))))
+ (home-page "https://cffi.readthedocs.org")
+ (synopsis "Foreign function interface for Python")
+ (description
+ "Foreign Function Interface for Python calling C code.")
+ (license expat)))
+
+(define-public python2-cffi
+ (package-with-python2 python-cffi))
+
+(define-public ruby-ffi
+ (package
+ (name "ruby-ffi")
+ (version "1.9.18")
+ (source (origin
+ (method url-fetch)
+ (uri (rubygems-uri "ffi" version))
+ (sha256
+ (base32
+ "034f52xf7zcqgbvwbl20jwdyjwznvqnwpbaps9nk18v9lgb1dpx0"))))
+ (build-system ruby-build-system)
+ ;; FIXME: Before running tests the build system attempts to build libffi
+ ;; from sources.
+ (arguments `(#:tests? #f))
+ (native-inputs
+ `(("ruby-rake-compiler" ,ruby-rake-compiler)
+ ("ruby-rspec" ,ruby-rspec)
+ ("ruby-rubygems-tasks" ,ruby-rubygems-tasks)))
+ (inputs
+ `(("libffi" ,libffi)))
+ (synopsis "Ruby foreign function interface library")
+ (description "Ruby-FFI is a Ruby extension for programmatically loading
+dynamic libraries, binding functions within them, and calling those functions
+from Ruby code. Moreover, a Ruby-FFI extension works without changes on Ruby
+and JRuby.")
+ (home-page "http://wiki.github.com/ffi/ffi")
+ (license bsd-3)))