1 { lib, stdenv, fetchurl, fetchpatch
4 # test suite depends on dejagnu which cannot be used during bootstrapping
5 # dejagnu also requires tcl which can't be built statically at the moment
6 , doCheck ? !(stdenv.hostPlatform.isStatic)
11 stdenv.mkDerivation rec {
16 url = "https://github.com/libffi/libffi/releases/download/v${version}/${pname}-${version}.tar.gz";
17 sha256 = "sha256-1mxWrSWags8qnfxAizK/XaUjcVALhHRff7i2RXEt9nY=";
20 # Note: this package is used for bootstrapping fetchurl, and thus
21 # cannot use fetchpatch! All mutable patches (generated by GitHub or
22 # cgit) that are needed here should be included directly in Nixpkgs as
28 outputs = [ "out" "dev" "man" "info" ];
30 enableParallelBuilding = true;
32 configurePlatforms = [ "build" "host" ];
35 "--with-gcc-arch=generic" # no detection of -march= or -mtune=
36 "--enable-pax_emutramp"
38 # Causes issues in downstream packages which misuse ffi_closure_alloc
39 # Reenable once these issues are fixed and merged:
40 # https://gitlab.haskell.org/ghc/ghc/-/merge_requests/6155
41 # https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/283
42 "--disable-exec-static-tramp"
46 # The tests use -O0 which is not compatible with -D_FORTIFY_SOURCE.
47 NIX_HARDENING_ENABLE=''${NIX_HARDENING_ENABLE/fortify/}
50 dontStrip = stdenv.hostPlatform != stdenv.buildPlatform; # Don't run the native `strip' when cross-compiling.
54 checkInputs = [ dejagnu ];
57 updateScript = nix-update-script {
63 description = "A foreign function call interface library";
65 The libffi library provides a portable, high level programming
66 interface to various calling conventions. This allows a
67 programmer to call any function specified by a call interface
68 description at run-time.
70 FFI stands for Foreign Function Interface. A foreign function
71 interface is the popular name for the interface that allows code
72 written in one language to call code written in another
73 language. The libffi library really only provides the lowest,
74 machine dependent layer of a fully featured foreign function
75 interface. A layer must exist above libffi that handles type
76 conversions for values passed between the two languages.
78 homepage = "http://sourceware.org/libffi/";
79 license = licenses.mit;
80 maintainers = with maintainers; [ matthewbauer ];
81 platforms = platforms.all;