Commit | Line | Data |
---|---|---|
233e7676 | 1 | ;;; GNU Guix --- Functional package management for GNU |
d43547f1 | 2 | ;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org> |
0751fddd | 3 | ;;; Copyright © 2014 Federico Beffa <beffa@fbengineering.ch> |
d47e99e0 | 4 | ;;; Copyright © 2015, 2019 Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> |
0751fddd | 5 | ;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il> |
838b232e | 6 | ;;; Copyright © 2016, 2017 Ben Woodcroft <donttrustben@gmail.com> |
95dc93da | 7 | ;;; Copyright © 2017, 2019 Marius Bakke <mbakke@fastmail.com> |
667e6f1e | 8 | ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr> |
c44899a2 | 9 | ;;; |
233e7676 | 10 | ;;; This file is part of GNU Guix. |
c44899a2 | 11 | ;;; |
233e7676 | 12 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
c44899a2 LC |
13 | ;;; under the terms of the GNU General Public License as published by |
14 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
15 | ;;; your option) any later version. | |
16 | ;;; | |
233e7676 | 17 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
c44899a2 LC |
18 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
19 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | ;;; GNU General Public License for more details. | |
21 | ;;; | |
22 | ;;; You should have received a copy of the GNU General Public License | |
233e7676 | 23 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
c44899a2 | 24 | |
1ffa7090 | 25 | (define-module (gnu packages libffi) |
1602fcea | 26 | #:use-module (gnu packages) |
4a44e743 | 27 | #:use-module (guix licenses) |
c44899a2 | 28 | #:use-module (guix packages) |
87f5d366 | 29 | #:use-module (guix download) |
ac257f12 | 30 | #:use-module (gnu packages check) |
0751fddd EF |
31 | #:use-module (gnu packages pkg-config) |
32 | #:use-module (gnu packages python) | |
44d10b1f | 33 | #:use-module (gnu packages python-xyz) |
838b232e | 34 | #:use-module (gnu packages ruby) |
9d0c291e | 35 | #:use-module (gnu packages sphinx) |
0751fddd | 36 | #:use-module (guix build-system gnu) |
838b232e EF |
37 | #:use-module (guix build-system python) |
38 | #:use-module (guix build-system ruby)) | |
c44899a2 LC |
39 | |
40 | (define-public libffi | |
667e6f1e | 41 | (package |
c44899a2 | 42 | (name "libffi") |
bfcb7bcb | 43 | (version "3.2.1") |
c44899a2 | 44 | (source (origin |
667e6f1e TGR |
45 | (method url-fetch) |
46 | (uri | |
47 | (string-append "ftp://sourceware.org/pub/libffi/" | |
48 | name "-" version ".tar.gz")) | |
49 | (sha256 | |
50 | (base32 | |
51 | "0dya49bnhianl0r65m65xndz6ls2jn1xngyn72gd28ls3n7bnvnh")) | |
52 | (patches (search-patches "libffi-3.2.1-complex-alpha.patch")))) | |
c44899a2 | 53 | (build-system gnu-build-system) |
667e6f1e | 54 | (arguments |
1935b8d5 MB |
55 | `(;; Prevent the build system from passing -march and -mtune to the |
56 | ;; compiler. See "ax_cc_maxopt.m4" and "ax_gcc_archflag.m4". | |
57 | #:configure-flags '("--enable-portable-binary" "--without-gcc-arch") | |
58 | #:phases | |
667e6f1e TGR |
59 | (modify-phases %standard-phases |
60 | (add-after 'install 'post-install | |
61 | (lambda* (#:key outputs #:allow-other-keys) | |
62 | (define out (assoc-ref outputs "out")) | |
63 | (symlink (string-append out "/lib/libffi-3.2.1/include") | |
64 | (string-append out "/include")) | |
65 | #t))))) | |
9bf62d9b | 66 | (outputs '("out" "debug")) |
089b0634 | 67 | (synopsis "Foreign function call interface library") |
c44899a2 LC |
68 | (description |
69 | "The libffi library provides a portable, high level programming interface | |
70 | to various calling conventions. This allows a programmer to call any | |
71 | function specified by a call interface description at run-time. | |
72 | ||
73 | FFI stands for Foreign Function Interface. A foreign function interface is | |
74 | the popular name for the interface that allows code written in one language | |
75 | to call code written in another language. The libffi library really only | |
76 | provides the lowest, machine dependent layer of a fully featured foreign | |
77 | function interface. A layer must exist above libffi that handles type | |
78 | conversions for values passed between the two languages.") | |
79 | (home-page "http://sources.redhat.com/libffi/") | |
80 | ||
7bf837fd | 81 | ;; See <https://github.com/atgreen/libffi/blob/master/LICENSE>. |
667e6f1e | 82 | (license expat))) |
c44899a2 | 83 | |
0751fddd EF |
84 | (define-public python-cffi |
85 | (package | |
86 | (name "python-cffi") | |
22cf2f4a | 87 | (version "1.11.5") |
0751fddd EF |
88 | (source |
89 | (origin | |
90 | (method url-fetch) | |
91 | (uri (pypi-uri "cffi" version)) | |
92 | (sha256 | |
8c5749f1 MB |
93 | (base32 "1x3lrj928dcxx1k8k9gf3s4s3jwvzv8mc3kkyg1g7c3a1sc1f3z9")) |
94 | (patches (search-patches "python-cffi-x87-stack-clean.patch")))) | |
0751fddd | 95 | (build-system python-build-system) |
0751fddd EF |
96 | (inputs |
97 | `(("libffi" ,libffi))) | |
98 | (propagated-inputs ; required at run-time | |
99 | `(("python-pycparser" ,python-pycparser))) | |
100 | (native-inputs | |
101 | `(("pkg-config" ,pkg-config) | |
0751fddd EF |
102 | ("python-pytest" ,python-pytest))) |
103 | (arguments | |
104 | `(#:modules ((ice-9 ftw) | |
105 | (srfi srfi-26) | |
106 | (guix build utils) | |
107 | (guix build python-build-system)) | |
108 | #:phases | |
109 | (modify-phases %standard-phases | |
110 | (replace 'check | |
111 | (lambda _ | |
112 | (setenv "PYTHONPATH" | |
113 | (string-append | |
114 | (getenv "PYTHONPATH") | |
115 | ":" (getcwd) "/build/" | |
116 | (car (scandir "build" (cut string-prefix? "lib." <>))))) | |
117 | ||
118 | ;; XXX The "normal" approach of setting CC and friends does | |
119 | ;; not work here. Is this the correct way of doing things? | |
120 | (substitute* "testing/embedding/test_basic.py" | |
121 | (("c = distutils\\.ccompiler\\.new_compiler\\(\\)") | |
122 | (string-append "c = distutils.ccompiler.new_compiler();" | |
123 | "c.set_executables(compiler='gcc'," | |
124 | "compiler_so='gcc',linker_exe='gcc'," | |
125 | "linker_so='gcc -shared')"))) | |
126 | (substitute* "testing/cffi0/test_ownlib.py" | |
127 | (("'cc testownlib") "'gcc testownlib")) | |
fc38e317 TGR |
128 | (invoke "py.test" "-v" "c/" "testing/") |
129 | #t)) | |
0751fddd EF |
130 | (add-before 'check 'disable-failing-test |
131 | ;; This is assumed to be a libffi issue: | |
132 | ;; https://bitbucket.org/cffi/cffi/issues/312/tests-failed-with-armv8 | |
133 | (lambda _ | |
134 | (substitute* "testing/cffi0/test_ownlib.py" | |
135 | (("ret.left") "ownlib.left")) | |
95dc93da | 136 | #t))))) |
0751fddd EF |
137 | (home-page "https://cffi.readthedocs.org") |
138 | (synopsis "Foreign function interface for Python") | |
139 | (description | |
140 | "Foreign Function Interface for Python calling C code.") | |
141 | (license expat))) | |
142 | ||
143 | (define-public python2-cffi | |
144 | (package-with-python2 python-cffi)) | |
838b232e | 145 | |
95dc93da MB |
146 | (define-public python-cffi-documentation |
147 | (package | |
148 | (name "python-cffi-documentation") | |
149 | (version (package-version python-cffi)) | |
150 | (source (package-source python-cffi)) | |
151 | (build-system gnu-build-system) | |
152 | (arguments | |
153 | `(#:tests? #f | |
154 | #:phases (modify-phases %standard-phases | |
155 | (add-after 'unpack 'chdir | |
156 | (lambda _ (chdir "doc") #t)) | |
157 | (delete 'configure) | |
158 | (replace 'build | |
159 | (lambda* (#:key (make-flags '()) #:allow-other-keys) | |
160 | (apply invoke "make" "html" make-flags))) | |
161 | (replace 'install | |
162 | (lambda* (#:key outputs #:allow-other-keys) | |
163 | (let ((out (assoc-ref outputs "out"))) | |
164 | (copy-recursively "build/html" (string-append out "/html")) | |
165 | #t)))))) | |
166 | (native-inputs | |
167 | `(("sphinx-build" ,python-sphinx))) | |
168 | (home-page (package-home-page python-cffi)) | |
169 | (synopsis "Documentation for the Python CFFI interface") | |
170 | (description | |
171 | "This package contains HTML documentation for the @code{python-cffi} | |
172 | project.") | |
173 | (license (package-license python-cffi)))) | |
174 | ||
838b232e EF |
175 | (define-public ruby-ffi |
176 | (package | |
177 | (name "ruby-ffi") | |
d47e99e0 | 178 | (version "1.10.0") |
838b232e EF |
179 | (source (origin |
180 | (method url-fetch) | |
181 | (uri (rubygems-uri "ffi" version)) | |
182 | (sha256 | |
183 | (base32 | |
d47e99e0 | 184 | "0j8pzj8raxbir5w5k6s7a042sb5k02pg0f8s4na1r5lan901j00p")))) |
838b232e EF |
185 | (build-system ruby-build-system) |
186 | ;; FIXME: Before running tests the build system attempts to build libffi | |
187 | ;; from sources. | |
188 | (arguments `(#:tests? #f)) | |
189 | (native-inputs | |
190 | `(("ruby-rake-compiler" ,ruby-rake-compiler) | |
191 | ("ruby-rspec" ,ruby-rspec) | |
192 | ("ruby-rubygems-tasks" ,ruby-rubygems-tasks))) | |
193 | (inputs | |
194 | `(("libffi" ,libffi))) | |
195 | (synopsis "Ruby foreign function interface library") | |
196 | (description "Ruby-FFI is a Ruby extension for programmatically loading | |
197 | dynamic libraries, binding functions within them, and calling those functions | |
198 | from Ruby code. Moreover, a Ruby-FFI extension works without changes on Ruby | |
199 | and JRuby.") | |
200 | (home-page "http://wiki.github.com/ffi/ffi") | |
201 | (license bsd-3))) |