Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 6 doCheck ? true, # test suite depends on dejagnu which cannot be used during bootstrapping 7 dejagnu, 8}: 9 10stdenv.mkDerivation rec { 11 pname = "libffi"; 12 version = "3.3"; 13 14 src = fetchurl { 15 url = "https://github.com/libffi/libffi/releases/download/v${version}/${pname}-${version}.tar.gz"; 16 hash = "sha256-cvunkicD3fp6Ao1ROsFahcjVTI1n9V+lpIAohdxlIFY="; 17 }; 18 19 patches = [ ]; 20 21 outputs = [ 22 "out" 23 "dev" 24 "man" 25 "info" 26 ]; 27 28 configureFlags = [ 29 "--with-gcc-arch=generic" # no detection of -march= or -mtune= 30 "--enable-pax_emutramp" 31 32 # Causes issues in downstream packages which misuse ffi_closure_alloc 33 # Reenable once these issues are fixed and merged: 34 # https://gitlab.haskell.org/ghc/ghc/-/merge_requests/6155 35 # https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/283 36 "--disable-exec-static-tramp" 37 ]; 38 39 # with fortify3, tests fail for some reason 40 hardeningDisable = [ "fortify3" ]; 41 42 preCheck = '' 43 # The tests use -O0 which is not compatible with -D_FORTIFY_SOURCE. 44 NIX_HARDENING_ENABLE=''${NIX_HARDENING_ENABLE/fortify/} 45 ''; 46 47 dontStrip = stdenv.hostPlatform != stdenv.buildPlatform; # Don't run the native `strip' when cross-compiling. 48 49 inherit doCheck; 50 51 nativeCheckInputs = [ dejagnu ]; 52 53 meta = with lib; { 54 description = "Foreign function call interface library"; 55 longDescription = '' 56 The libffi library provides a portable, high level programming 57 interface to various calling conventions. This allows a 58 programmer to call any function specified by a call interface 59 description at run-time. 60 61 FFI stands for Foreign Function Interface. A foreign function 62 interface is the popular name for the interface that allows code 63 written in one language to call code written in another 64 language. The libffi library really only provides the lowest, 65 machine dependent layer of a fully featured foreign function 66 interface. A layer must exist above libffi that handles type 67 conversions for values passed between the two languages. 68 ''; 69 homepage = "http://sourceware.org/libffi/"; 70 license = licenses.mit; 71 maintainers = with maintainers; [ armeenm ]; 72 platforms = platforms.all; 73 # never built on aarch64-darwin since first introduction in nixpkgs 74 broken = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64; 75 }; 76}