Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 88 lines 1.9 kB view raw
1{ 2 stdenv, 3 lib, 4 fetchFromGitHub, 5 gnat, 6 gprbuild, 7 gnatcoll-core, 8 component, 9 # component dependencies 10 gmp, 11 libiconv, 12 xz, 13 readline, 14 zlib, 15 python3, 16 ncurses, 17}: 18 19let 20 # omit python (2.7), no need to introduce a 21 # dependency on an EOL package for no reason 22 libsFor = { 23 iconv = [ libiconv ]; 24 gmp = [ gmp ]; 25 lzma = [ xz ]; 26 readline = [ readline ]; 27 python3 = [ 28 python3 29 ncurses 30 ]; 31 syslog = [ ]; 32 zlib = [ zlib ]; 33 cpp = [ ]; 34 }; 35in 36 37stdenv.mkDerivation rec { 38 pname = "gnatcoll-${component}"; 39 version = "25.0.0"; 40 41 src = fetchFromGitHub { 42 owner = "AdaCore"; 43 repo = "gnatcoll-bindings"; 44 rev = "v${version}"; 45 sha256 = "0ayc7zvv8w90v0xzhrjk2x88zrsk62xxcm27ya9crlp6affn5idk"; 46 }; 47 48 nativeBuildInputs = [ 49 gprbuild 50 gnat 51 python3 52 ]; 53 54 # propagate since gprbuild needs to find referenced .gpr files 55 # and all dependency C libraries when statically linking a 56 # downstream executable. 57 propagatedBuildInputs = [ 58 gnatcoll-core 59 ] 60 ++ libsFor."${component}" or [ ]; 61 62 # explicit flag for GPL acceptance because upstream 63 # allows a gcc runtime exception for all bindings 64 # except for readline (since it is GPL w/o exceptions) 65 buildFlags = lib.optionals (component == "readline") [ 66 "--accept-gpl" 67 ]; 68 69 buildPhase = '' 70 runHook preBuild 71 ${python3.interpreter} ${component}/setup.py build --prefix $out $buildFlags 72 runHook postBuild 73 ''; 74 75 installPhase = '' 76 runHook preInstall 77 ${python3.interpreter} ${component}/setup.py install --prefix $out 78 runHook postInstall 79 ''; 80 81 meta = with lib; { 82 description = "GNAT Components Collection - Bindings to C libraries"; 83 homepage = "https://github.com/AdaCore/gnatcoll-bindings"; 84 license = licenses.gpl3Plus; 85 platforms = platforms.all; 86 maintainers = [ maintainers.sternenseemann ]; 87 }; 88}