1 # Since the same derivation can be depended on in multiple ways, we need to
2 # accumulate *each* role (i.e. host and target platforms relative the depending
3 # derivation) in which the derivation is used.
5 # The role is intended to be used as part of other variables names like
6 # - $NIX_SOMETHING${role_post}
11 role_post
='_FOR_BUILD'
17 role_post
='_FOR_TARGET'
20 echo "@name@: used as improper sort of dependency" >&2
26 # `hostOffset` describes how the host platform of the package is slid relative
27 # to the depending package. `targetOffset` likewise describes the target
28 # platform of the package. Both are brought into scope of the setup hook defined
29 # for dependency whose setup hook is being processed relative to the package
32 function getHostRole
() {
35 function getTargetRole
() {
36 getRole
"$targetOffset"
39 # `depHostOffset` describes how the host platform of the dependencies are slid
40 # relative to the depending package. `depTargetOffset` likewise describes the
41 # target platform of dependenices. Both are brought into scope of the
42 # environment hook defined for the dependency being applied relative to the
43 # package being built.
45 function getHostRoleEnvHook
() {
46 getRole
"$depHostOffset"
48 function getTargetRoleEnvHook
() {
49 getRole
"$depTargetOffset"
52 # This variant is intended specifically for code-producing tool wrapper scripts
53 # `NIX_@wrapperName@_TARGET_*_@suffixSalt@` tracks this (needs to be an exported
54 # env var so can't use fancier data structures).
55 function getTargetRoleWrapper
() {
58 export NIX_@wrapperName@_TARGET_BUILD_@suffixSalt@
=1
61 export NIX_@wrapperName@_TARGET_HOST_@suffixSalt@
=1
64 export NIX_@wrapperName@_TARGET_TARGET_@suffixSalt@
=1
67 echo "@name@: used as improper sort of dependency" >&2