Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 88 lines 2.2 kB view raw
1{ 2 stdenv, 3 lib, 4 gnat, 5 gprbuild, 6 fetchFromGitHub, 7 fetchpatch2, 8 which, 9 python3, 10 rsync, 11 enableGnatcollCore ? true, 12 # TODO(@sternenseemann): figure out a way to split this up into three packages 13 enableGnatcollProjects ? true, 14 # for tests 15 gnatcoll-core, 16}: 17 18# gnatcoll-projects depends on gnatcoll-core 19assert enableGnatcollProjects -> enableGnatcollCore; 20 21stdenv.mkDerivation rec { 22 pname = "gnatcoll-core"; 23 version = "25.0.0"; 24 25 src = fetchFromGitHub { 26 owner = "AdaCore"; 27 repo = "gnatcoll-core"; 28 rev = "v${version}"; 29 sha256 = "1srnh7vhs46c2zy4hcy4pg0a0prghfzlpv7c82k0jan384yz1g6g"; 30 }; 31 32 patches = [ 33 # Fix compilation with GNAT 12 https://github.com/AdaCore/gnatcoll-core/issues/88 34 (fetchpatch2 { 35 name = "gnatcoll-core-gnat-12.patch"; 36 url = "https://github.com/AdaCore/gnatcoll-core/commit/515db1c9f1eea8095f2d9ff9570159a78c981ec6.patch"; 37 sha256 = "1ghnkhp5fncb7qcmf59kyqvy0sd0pzf1phnr2z7b4ljwlkbmcp36"; 38 }) 39 ]; 40 41 postPatch = '' 42 patchShebangs */*.gpr.py 43 ''; 44 45 nativeBuildInputs = [ 46 gprbuild 47 which 48 gnat 49 python3 50 rsync 51 ]; 52 53 # propagate since gprbuild needs to find 54 # referenced GPR project definitions 55 propagatedBuildInputs = lib.optionals enableGnatcollProjects [ 56 gprbuild # libgpr 57 ]; 58 59 strictDeps = true; 60 61 makeFlags = [ 62 "prefix=${placeholder "out"}" 63 "PROCESSORS=$(NIX_BUILD_CORES)" 64 # confusingly, for gprbuild --target is autoconf --host 65 "TARGET=${stdenv.hostPlatform.config}" 66 "GNATCOLL_MINIMAL_ONLY=${if !enableGnatcollCore then "yes" else "no"}" 67 "GNATCOLL_PROJECTS=${if enableGnatcollProjects then "yes" else "no"}" 68 ]; 69 70 passthru.tests = { 71 minimalOnly = gnatcoll-core.override { 72 enableGnatcollProjects = false; 73 enableGnatcollCore = false; 74 }; 75 noProjects = gnatcoll-core.override { 76 enableGnatcollProjects = false; 77 enableGnatcollCore = true; 78 }; 79 }; 80 81 meta = with lib; { 82 homepage = "https://github.com/AdaCore/gnatcoll-core"; 83 description = "GNAT Components Collection - Core packages"; 84 license = licenses.gpl3Plus; 85 maintainers = [ maintainers.sternenseemann ]; 86 platforms = platforms.all; 87 }; 88}