Suggestion: add features that control installation prefixes
- Lingua principale
- C++
- Stelle
- 251
- Fork
- 63
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Currently, in order to allow installation prefix to be substitutable one uses options. For example:
```jam
import package ;
package.install install myproject : : myapp : mylib ;
```
on *nix installs `{bindir}/myapp` and `{libdir}/libmylib.so`.
But when one builds several configurations simultaneously this will lead to a conflict.
I propose several additions to b2:
* A set of features that control installation prefix: ``, `` etc.
* Add support to these features to `install` rule. The prefix should be enclosed in parentheses and put at the beginning of either `` value or the target name.
```jam
alias install
: [ install (bindir) : myapp ]
: [ install _ : mylib : (libdir) ]
;
```
As a result, given this `project-config.jam`
```
using gcc ;
using gcc : musl : ... ;
project
: requirements
gcc:build/stage/gnu
gcc:lib/x86_64-linux-gnu
gcc-musl:build/stage/musl
gcc-musl:lib/x86_64-linux-musl
;
```
invoking `b2 install toolset=gcc,gcc-musl` installs
* `build/stage/gnu/bin/myapp`
* `build/stage/gnu/lib/x86_64-linux-gnu/libmylib.so`
* `build/stage/gnu/musl/myapp`
* `build/stage/gnu/musl/x86_64-linux-musl/libmylib.so`
In addition, I suggest adding `` feature that replaces `` for actual installation paths when provided. This is needed when targets have to know their installed location (or some related location), but actually putting them there is either impossible or not desirable. In order to compose the full installation path of a target a rule will be added to `stage` module. Example:
```jam
exe foo : foo.cpp : @get-confdir ;
install install foo : (bindir) ;
rule get-confdir ( properties * ) {
local confdir = [ stage.get-dir : sysconfdir ] ;
return CONFDIR=$(confdir) ;
}
```
Invoking `b2 install install-prefix=/usr install-sysconfdir=/etc stage-prefix=build/stage` installs `build/stage/bin/foo`, but the installed executable will search for its configuration files in `/etc`.
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.