core/pkgs/by-name/li/libffi/default.nix

79 lines
2.6 KiB
Nix
Raw Normal View History

2024-05-13 21:24:10 +00:00
{ lib, stdenv, fetchurl, fetchpatch, autoreconfHook
# test suite depends on dejagnu which cannot be used during bootstrapping
# dejagnu also requires tcl which can't be built statically at the moment
, doCheck ? !(stdenv.hostPlatform.isStatic), dejagnu ? throw "dejagnu used"
, testers }:
2024-05-02 00:46:19 +00:00
stdenv.mkDerivation (finalAttrs: {
pname = "libffi";
version = "3.4.6";
src = fetchurl {
2024-05-13 21:24:10 +00:00
url = with finalAttrs;
"https://github.com/libffi/libffi/releases/download/v${version}/${pname}-${version}.tar.gz";
2024-05-02 00:46:19 +00:00
hash = "sha256-sN6p3yPIY6elDoJUQPPr/6vWXfFJcQjl1Dd0eEOJWk4=";
};
# Note: this package is used for bootstrapping fetchurl, and thus
# cannot use fetchpatch! All mutable patches (generated by GitHub or
# cgit) that are needed here should be included directly in Nixpkgs as
# files.
2024-05-13 21:24:10 +00:00
patches = [ ];
2024-05-02 00:46:19 +00:00
strictDeps = true;
outputs = [ "out" "dev" "man" "info" ];
enableParallelBuilding = true;
configurePlatforms = [ "build" "host" ];
configureFlags = [
"--with-gcc-arch=generic" # no detection of -march= or -mtune=
"--enable-pax_emutramp"
];
preCheck = ''
# The tests use -O0 which is not compatible with -D_FORTIFY_SOURCE.
NIX_HARDENING_ENABLE=''${NIX_HARDENING_ENABLE/fortify3/}
NIX_HARDENING_ENABLE=''${NIX_HARDENING_ENABLE/fortify/}
'';
2024-05-13 21:24:10 +00:00
dontStrip = stdenv.hostPlatform
!= stdenv.buildPlatform; # Don't run the native `strip' when cross-compiling.
2024-05-02 00:46:19 +00:00
inherit doCheck;
nativeCheckInputs = [ dejagnu ];
passthru = {
tests = {
2024-05-13 21:24:10 +00:00
pkg-config =
testers.hasPkgConfigModules { package = finalAttrs.finalPackage; };
2024-05-02 00:46:19 +00:00
};
};
meta = with lib; {
description = "A foreign function call interface library";
longDescription = ''
The libffi library provides a portable, high level programming
interface to various calling conventions. This allows a
programmer to call any function specified by a call interface
description at run-time.
FFI stands for Foreign Function Interface. A foreign function
interface is the popular name for the interface that allows code
written in one language to call code written in another
language. The libffi library really only provides the lowest,
machine dependent layer of a fully featured foreign function
interface. A layer must exist above libffi that handles type
conversions for values passed between the two languages.
'';
homepage = "http://sourceware.org/libffi/";
license = licenses.mit;
maintainers = with maintainers; [ matthewbauer ];
platforms = platforms.all;
pkgConfigModules = [ "libffi" ];
};
})