nixpkgs/pkgs/development/ada-modules/gnatcoll/bindings.nix
Thomas Heijligen f2a142727c gnatPackages: Add scope for all ada packages
Ada depencencies musst be build with the same gnat version as the
project. Use a namespace as preperation to build with different gnat
versions.

gprbuild and gnatprove are still globaly visable.
2024-02-25 18:19:50 +01:00

90 lines
1.9 KiB
Nix

{ stdenv
, lib
, fetchFromGitHub
, gnat
, gprbuild
, gnatcoll-core
, component
# component dependencies
, gmp
, libiconv
, xz
, gcc-unwrapped
, readline
, zlib
, python3
, ncurses
, darwin
}:
let
# omit python (2.7), no need to introduce a
# dependency on an EOL package for no reason
libsFor = {
iconv = [ libiconv ];
gmp = [ gmp ];
lzma = [ xz ];
readline = [ readline ];
python3 = [ python3 ncurses ];
syslog = [ ];
zlib = [ zlib ];
};
in
stdenv.mkDerivation rec {
pname = "gnatcoll-${component}";
version = "24.0.0";
src = fetchFromGitHub {
owner = "AdaCore";
repo = "gnatcoll-bindings";
rev = "v${version}";
sha256 = "00aakpmr67r72l1h3jpkaw83p1a2mjjvfk635yy5c1nss3ji1qjm";
};
nativeBuildInputs = [
gprbuild
gnat
python3
];
buildInputs = lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.CoreFoundation
];
# propagate since gprbuild needs to find referenced .gpr files
# and all dependency C libraries when statically linking a
# downstream executable.
propagatedBuildInputs = [
gnatcoll-core
] ++ libsFor."${component}" or [];
# explicit flag for GPL acceptance because upstreams
# allows a gcc runtime exception for all bindings
# except for readline (since it is GPL w/o exceptions)
buildFlags = lib.optionals (component == "readline") [
"--accept-gpl"
];
buildPhase = ''
runHook preBuild
${python3.interpreter} ${component}/setup.py build --prefix $out $buildFlags
runHook postBuild
'';
installPhase = ''
runHook preInstall
${python3.interpreter} ${component}/setup.py install --prefix $out
runHook postInstall
'';
meta = with lib; {
description = "GNAT Components Collection - Bindings to C libraries";
homepage = "https://github.com/AdaCore/gnatcoll-bindings";
license = licenses.gpl3Plus;
platforms = platforms.all;
maintainers = [ maintainers.sternenseemann ];
};
}