nixpkgs/pkgs/development/libraries/libffi/default.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

99 lines
2.8 KiB
Nix

{
lib,
stdenv,
fetchurl,
# 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,
nix-update-script,
testers,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "libffi";
version = "3.4.6";
src = fetchurl {
url =
with finalAttrs;
"https://github.com/libffi/libffi/releases/download/v${version}/${pname}-${version}.tar.gz";
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.
patches = [
# https://github.com/libffi/libffi/pull/857
# function label needs to come before .cfi_startproc
./label-before-cfi_startproc.patch
];
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/}
'';
dontStrip = stdenv.hostPlatform != stdenv.buildPlatform; # Don't run the native `strip' when cross-compiling.
inherit doCheck;
nativeCheckInputs = [ dejagnu ];
passthru = {
updateScript = nix-update-script { };
tests = {
pkg-config = testers.hasPkgConfigModules {
package = finalAttrs.finalPackage;
};
};
};
meta = with lib; {
description = "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" ];
};
})