AdaCore / gprbuild

GPRbuild is an advanced build system designed to help automate the construction of multi-language systems.
Other
65 stars 21 forks source link

$HOME in exec_dir ? #50

Closed MarioBlunk closed 5 years ago

MarioBlunk commented 5 years ago

Is there a way to tell gprbuild to use the environment variable $HOME in the exec_dir ? I want the binary to be written to $HOME/bin for example. This would make the install process a lot more flexible. See the example below. Thanks !

project tagged_types_3 is

    for exec_dir use ".";
    --for exec_dir use "/home/user/bin"; -- does work
    --for exec_dir use "$HOME/bin"; -- does not work
    for object_dir use "obj";
    for source_dirs use ("." , "../lib");
    for main use ("tagged_types_3");

 end tagged_types_3;
t-14 commented 5 years ago

Yes, this is doable:

for Exec_Dir use External ("HOME") & "/bin";

pmderodat commented 5 years ago

Hello,

Here is more information that could help: hand-written project files are generally used just for the build step of your software. It’s generally a better practice to keep output directories local to your project. For instance, it allows one to work on the same project simultaneously from different directories.

For the installation step, you can use GPRinstall. With your project file above, that would give:

$ gprbuild -Ptagged_types_3
$ gprinstall -Ptagged_types_3 --prefix=$HOME

See the corresponding documentation for more details.