biglybt: 3.5.0.0 -> 3.6.0.0
[NixPkgs.git] / pkgs / development / ada-modules / gprbuild / boot.nix
blob4207b3649594f6b398dd6239157cd6793300d7b7
1 { stdenv
2 , lib
3 , fetchFromGitHub
4 , gnat
5 , which
6 , xmlada # for src
7 }:
9 let
10   version = "24.0.0";
12   gprConfigKbSrc = fetchFromGitHub {
13     name = "gprconfig-kb-${version}-src";
14     owner = "AdaCore";
15     repo = "gprconfig_kb";
16     rev = "v${version}";
17     sha256 = "1vnjv2q63l8nq2w4wya75m40isvs78j5ss9b5ga3zx3cpdx3xh09";
18   };
21 stdenv.mkDerivation {
22   pname = "gprbuild-boot";
23   inherit version;
25   src = fetchFromGitHub {
26     name = "gprbuild-${version}";
27     owner = "AdaCore";
28     repo = "gprbuild";
29     rev = "v${version}";
30     sha256 = "096a43453z2xknn6x4hyk2ldp2wh0qhfdfmzsrks50zqcvmkq4v7";
31   };
33   nativeBuildInputs = [
34     gnat
35     which
36   ];
38   postPatch = ''
39     # The Makefile uses gprbuild to build gprbuild which
40     # we can't do at this point, delete it to prevent the
41     # default phases from failing.
42     rm Makefile
44     # make sure bootstrap script runs
45     patchShebangs --build bootstrap.sh
46   '';
48   # This setupHook populates GPR_PROJECT_PATH which is used by
49   # gprbuild to find dependencies. It works quite similar to
50   # the pkg-config setupHook in the sense that it also splits
51   # dependencies into GPR_PROJECT_PATH and GPR_PROJECT_PATH_FOR_BUILD,
52   # but gprbuild itself doesn't support this, so we'll need to
53   # introducing a wrapper for it in the future remains TODO.
54   # For the moment this doesn't matter since we have no situation
55   # were gprbuild is used to build something used at build time.
56   setupHooks = [
57     ./gpr-project-path-hook.sh
58   ] ++ lib.optionals stdenv.targetPlatform.isDarwin [
59     # This setupHook replaces the paths of shared libraries starting
60     # with @rpath with the absolute paths on Darwin, so that the
61     # binaries can be run without additional setup.
62     ./gpr-project-darwin-rpath-hook.sh
63   ];
65   installPhase = ''
66     runHook preInstall
68     ./bootstrap.sh \
69       --with-xmlada=${xmlada.src} \
70       --with-kb=${gprConfigKbSrc} \
71       --prefix=$out
73     # Install custom compiler description which can detect nixpkgs'
74     # GNAT wrapper as a proper Ada compiler. The default compiler
75     # description expects the runtime library to be installed in
76     # the same prefix which isn't the case for nixpkgs. As a
77     # result, it would detect the unwrapped GNAT as a proper
78     # compiler which is unable to produce working binaries.
79     #
80     # Our compiler description is very similar to the upstream
81     # GNAT description except that we use a symlink in $out/nix-support
82     # created by the cc-wrapper to find the associated runtime
83     # libraries and use gnatmake instead of gnatls to find GNAT's
84     # bin directory.
85     install -m644 ${./nixpkgs-gnat.xml} $out/share/gprconfig/nixpkgs-gnat.xml
87     runHook postInstall
88   '';
90   meta = with lib; {
91     description = "Multi-language extensible build tool";
92     homepage = "https://github.com/AdaCore/gprbuild";
93     license = licenses.gpl3Plus;
94     maintainers = [ maintainers.sternenseemann ];
95     platforms = platforms.all;
96   };