1{ fetchurl, stdenv }:
2
3stdenv.mkDerivation rec {
4 name = "libffi-3.2.1";
5
6 src = fetchurl {
7 url = "ftp://sourceware.org/pub/libffi/${name}.tar.gz";
8 sha256 = "0dya49bnhianl0r65m65xndz6ls2jn1xngyn72gd28ls3n7bnvnh";
9 };
10
11 patches = if stdenv.isCygwin then [ ./3.2.1-cygwin.patch ] else null;
12
13 configureFlags = [
14 "--with-gcc-arch=generic" # no detection of -march= or -mtune=
15 "--enable-pax_emutramp"
16 ];
17
18 dontStrip = stdenv ? cross; # Don't run the native `strip' when cross-compiling.
19
20 # Install headers in the right place.
21 postInstall = ''
22 ln -s${if (stdenv.isFreeBSD || stdenv.isOpenBSD || stdenv.isDarwin) then "" else "r"}v "$out/lib/"libffi*/include "$out/include"
23 '';
24
25 meta = {
26 description = "A foreign function call interface library";
27 longDescription = ''
28 The libffi library provides a portable, high level programming
29 interface to various calling conventions. This allows a
30 programmer to call any function specified by a call interface
31 description at run-time.
32
33 FFI stands for Foreign Function Interface. A foreign function
34 interface is the popular name for the interface that allows code
35 written in one language to call code written in another
36 language. The libffi library really only provides the lowest,
37 machine dependent layer of a fully featured foreign function
38 interface. A layer must exist above libffi that handles type
39 conversions for values passed between the two languages.
40 '';
41 homepage = http://sourceware.org/libffi/;
42 # See http://github.com/atgreen/libffi/blob/master/LICENSE .
43 license = stdenv.lib.licenses.free;
44 maintainers = [ ];
45 platforms = stdenv.lib.platforms.all;
46 };
47}