21ddd4634097788449ecd056ab34542f48318a55
[jackhill/guix/guix.git] / gnu / packages / libffi.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
3 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
10 ;;;
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19 (define-module (gnu packages libffi)
20 #:use-module (guix licenses)
21 #:use-module (guix packages)
22 #:use-module (guix download)
23 #:use-module (guix build-system gnu))
24
25 (define-public libffi
26 (let ((post-install-phase
27 ;; Install headers in the right place.
28 '(lambda* (#:key outputs #:allow-other-keys)
29 (define out (assoc-ref outputs "out"))
30 (mkdir (string-append out "/include"))
31 (with-directory-excursion
32 (string-append out "/lib/libffi-3.0.9/include")
33 (for-each (lambda (h)
34 (format #t "moving `~a' to includedir~%" h)
35 (rename-file h (string-append out "/include/" h)))
36 (scandir "."
37 (lambda (x)
38 (not (member x '("." ".."))))))))))
39 (package
40 (name "libffi")
41 (version "3.0.9")
42 (source (origin
43 (method url-fetch)
44 (uri
45 (string-append "ftp://sourceware.org/pub/libffi/"
46 name "-" version ".tar.gz"))
47 (sha256
48 (base32
49 "0ln4jbpb6clcsdpb9niqk0frgx4k0xki96wiv067ig0q4cajb7aq"))))
50 (build-system gnu-build-system)
51 (arguments `(#:modules ((guix build utils) (guix build gnu-build-system)
52 (ice-9 ftw) (srfi srfi-26))
53 #:phases (alist-cons-after 'install 'post-install
54 ,post-install-phase
55 %standard-phases)))
56 (synopsis "libffi, a foreign function call interface library")
57 (description
58 "The libffi library provides a portable, high level programming interface
59 to various calling conventions. This allows a programmer to call any
60 function specified by a call interface description at run-time.
61
62 FFI stands for Foreign Function Interface. A foreign function interface is
63 the popular name for the interface that allows code written in one language
64 to call code written in another language. The libffi library really only
65 provides the lowest, machine dependent layer of a fully featured foreign
66 function interface. A layer must exist above libffi that handles type
67 conversions for values passed between the two languages.")
68 (home-page "http://sources.redhat.com/libffi/")
69
70 ;; See <http://github.com/atgreen/libffi/blob/master/LICENSE>.
71 (license expat))))
72