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