Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, fetchurl, fetchpatch 2, autoreconfHook 3 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) 7, dejagnu 8, nix-update-script 9}: 10 11stdenv.mkDerivation rec { 12 pname = "libffi"; 13 version = "3.4.4"; 14 15 src = fetchurl { 16 url = "https://github.com/libffi/libffi/releases/download/v${version}/${pname}-${version}.tar.gz"; 17 sha256 = "sha256-1mxWrSWags8qnfxAizK/XaUjcVALhHRff7i2RXEt9nY="; 18 }; 19 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 23 # files. 24 patches = [ 25 ]; 26 27 strictDeps = true; 28 outputs = [ "out" "dev" "man" "info" ]; 29 30 enableParallelBuilding = true; 31 32 configurePlatforms = [ "build" "host" ]; 33 34 configureFlags = [ 35 "--with-gcc-arch=generic" # no detection of -march= or -mtune= 36 "--enable-pax_emutramp" 37 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" 43 ]; 44 45 preCheck = '' 46 # The tests use -O0 which is not compatible with -D_FORTIFY_SOURCE. 47 NIX_HARDENING_ENABLE=''${NIX_HARDENING_ENABLE/fortify3/} 48 NIX_HARDENING_ENABLE=''${NIX_HARDENING_ENABLE/fortify/} 49 ''; 50 51 dontStrip = stdenv.hostPlatform != stdenv.buildPlatform; # Don't run the native `strip' when cross-compiling. 52 53 inherit doCheck; 54 55 nativeCheckInputs = [ dejagnu ]; 56 57 passthru = { 58 updateScript = nix-update-script { }; 59 }; 60 61 meta = with lib; { 62 description = "A foreign function call interface library"; 63 longDescription = '' 64 The libffi library provides a portable, high level programming 65 interface to various calling conventions. This allows a 66 programmer to call any function specified by a call interface 67 description at run-time. 68 69 FFI stands for Foreign Function Interface. A foreign function 70 interface is the popular name for the interface that allows code 71 written in one language to call code written in another 72 language. The libffi library really only provides the lowest, 73 machine dependent layer of a fully featured foreign function 74 interface. A layer must exist above libffi that handles type 75 conversions for values passed between the two languages. 76 ''; 77 homepage = "http://sourceware.org/libffi/"; 78 license = licenses.mit; 79 maintainers = with maintainers; [ matthewbauer ]; 80 platforms = platforms.all; 81 }; 82}