Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at release-18.03 87 lines 3.8 kB view raw
1{ stdenv, fetchurl, fetchpatch, dejagnu, doCheck ? false 2, buildPlatform, hostPlatform, autoreconfHook 3}: 4 5stdenv.mkDerivation rec { 6 name = "libffi-3.2.1"; 7 8 src = fetchurl { 9 url = "ftp://sourceware.org/pub/libffi/${name}.tar.gz"; 10 sha256 = "0dya49bnhianl0r65m65xndz6ls2jn1xngyn72gd28ls3n7bnvnh"; 11 }; 12 13 patches = stdenv.lib.optional stdenv.isCygwin ./3.2.1-cygwin.patch 14 ++ stdenv.lib.optional stdenv.isAarch64 (fetchpatch { 15 url = https://src.fedoraproject.org/rpms/libffi/raw/ccffc1700abfadb0969495a6e51b964117fc03f6/f/libffi-aarch64-rhbz1174037.patch; 16 sha256 = "1vpirrgny43hp0885rswgv3xski8hg7791vskpbg3wdjdpb20wbc"; 17 }) 18 ++ stdenv.lib.optional hostPlatform.isMusl (fetchpatch { 19 name = "gnu-linux-define.patch"; 20 url = "https://git.alpinelinux.org/cgit/aports/plain/main/libffi/gnu-linux-define.patch?id=bb024fd8ec6f27a76d88396c9f7c5c4b5800d580"; 21 sha256 = "11pvy3xkhyvnjfyy293v51f1xjy3x0azrahv1nw9y9mw8bifa2j2"; 22 }) 23 ++ stdenv.lib.optional hostPlatform.isRiscV (fetchpatch { 24 name = "riscv-support.patch"; 25 url = https://github.com/sorear/libffi-riscv/commit/e46492e8bb1695a19bc1053ed869e6c2bab02ff2.patch; 26 sha256 = "1vl1vbvdkigs617kckxvj8j4m2cwg62kxm1clav1w5rnw9afxg0y"; 27 }) 28 ++ stdenv.lib.optionals stdenv.isMips [ 29 (fetchpatch { 30 name = "0001-mips-Use-compiler-internal-define-for-linux.patch"; 31 url = "http://cgit.openembedded.org/openembedded-core/plain/meta/recipes-support/libffi/libffi/0001-mips-Use-compiler-internal-define-for-linux.patch?id=318e33a708378652edcf61ce7d9d7f3a07743000"; 32 sha256 = "1gc53lw90p6hc0cmhj3csrwincfz7va5ss995ksw5gm0yrr9mrvb"; 33 }) 34 (fetchpatch { 35 name = "0001-mips-fix-MIPS-softfloat-build-issue.patch"; 36 url = "http://cgit.openembedded.org/openembedded-core/plain/meta/recipes-support/libffi/libffi/0001-mips-fix-MIPS-softfloat-build-issue.patch?id=318e33a708378652edcf61ce7d9d7f3a07743000"; 37 sha256 = "0l8xgdciqalg4z9rcwyk87h8fdxpfv4hfqxwsy2agpnpszl5jjdq"; 38 }) 39 ]; 40 41 outputs = [ "out" "dev" "man" "info" ]; 42 43 buildInputs = stdenv.lib.optional doCheck dejagnu; 44 45 nativeBuildInputs = stdenv.lib.optional hostPlatform.isRiscV autoreconfHook; 46 47 configureFlags = [ 48 "--with-gcc-arch=generic" # no detection of -march= or -mtune= 49 "--enable-pax_emutramp" 50 ]; 51 52 inherit doCheck; 53 54 dontStrip = hostPlatform != buildPlatform; # Don't run the native `strip' when cross-compiling. 55 56 # Install headers and libs in the right places. 57 postFixup = '' 58 mkdir -p "$dev/" 59 mv "$out/lib/${name}/include" "$dev/include" 60 rmdir "$out/lib/${name}" 61 substituteInPlace "$dev/lib/pkgconfig/libffi.pc" \ 62 --replace 'includedir=''${libdir}/libffi-3.2.1' "includedir=$dev" 63 ''; 64 65 meta = with stdenv.lib; { 66 description = "A foreign function call interface library"; 67 longDescription = '' 68 The libffi library provides a portable, high level programming 69 interface to various calling conventions. This allows a 70 programmer to call any function specified by a call interface 71 description at run-time. 72 73 FFI stands for Foreign Function Interface. A foreign function 74 interface is the popular name for the interface that allows code 75 written in one language to call code written in another 76 language. The libffi library really only provides the lowest, 77 machine dependent layer of a fully featured foreign function 78 interface. A layer must exist above libffi that handles type 79 conversions for values passed between the two languages. 80 ''; 81 homepage = http://sourceware.org/libffi/; 82 # See http://github.com/atgreen/libffi/blob/master/LICENSE . 83 license = licenses.free; 84 maintainers = [ ]; 85 platforms = platforms.all; 86 }; 87}