1 { lib, stdenv, fetchurl, fetchpatch
4 , doCheck ? true # test suite depends on dejagnu which cannot be used during bootstrapping
8 stdenv.mkDerivation rec {
13 url = "https://github.com/libffi/libffi/releases/download/v${version}/${pname}-${version}.tar.gz";
14 hash = "sha256-cvunkicD3fp6Ao1ROsFahcjVTI1n9V+lpIAohdxlIFY=";
19 outputs = [ "out" "dev" "man" "info" ];
22 "--with-gcc-arch=generic" # no detection of -march= or -mtune=
23 "--enable-pax_emutramp"
25 # Causes issues in downstream packages which misuse ffi_closure_alloc
26 # Reenable once these issues are fixed and merged:
27 # https://gitlab.haskell.org/ghc/ghc/-/merge_requests/6155
28 # https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/283
29 "--disable-exec-static-tramp"
33 # The tests use -O0 which is not compatible with -D_FORTIFY_SOURCE.
34 NIX_HARDENING_ENABLE=''${NIX_HARDENING_ENABLE/fortify/}
37 dontStrip = stdenv.hostPlatform != stdenv.buildPlatform; # Don't run the native `strip' when cross-compiling.
41 checkInputs = [ dejagnu ];
44 description = "A foreign function call interface library";
46 The libffi library provides a portable, high level programming
47 interface to various calling conventions. This allows a
48 programmer to call any function specified by a call interface
49 description at run-time.
51 FFI stands for Foreign Function Interface. A foreign function
52 interface is the popular name for the interface that allows code
53 written in one language to call code written in another
54 language. The libffi library really only provides the lowest,
55 machine dependent layer of a fully featured foreign function
56 interface. A layer must exist above libffi that handles type
57 conversions for values passed between the two languages.
59 homepage = "http://sourceware.org/libffi/";
60 license = licenses.mit;
61 maintainers = with maintainers; [ armeenm ];
62 platforms = platforms.all;