about summary refs log tree commit diff
path: root/nixpkgs/pkgs/build-support/pkg-config-wrapper/setup-hook.sh
blob: 34f1a999a82ee636e5865f323e965c8a4357a0bf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# pkg-config Wrapper hygiene
#
# See comments in cc-wrapper's setup hook. This works exactly the same way.

# Skip setup hook if we're neither a build-time dep, nor, temporarily, doing a
# native compile.
#
# TODO(@Ericson2314): No native exception
[[ -z ${strictDeps-} ]] || (( "$hostOffset" < 0 )) || return 0

pkgConfigWrapper_addPkgConfigPath () {
    # See ../setup-hooks/role.bash
    local role_post
    getHostRoleEnvHook

    addToSearchPath "PKG_CONFIG_PATH${role_post}" "$1/lib/pkgconfig"
    addToSearchPath "PKG_CONFIG_PATH${role_post}" "$1/share/pkgconfig"
}

# See ../setup-hooks/role.bash
getTargetRole
getTargetRoleWrapper

addEnvHooks "$targetOffset" pkgConfigWrapper_addPkgConfigPath

export PKG_CONFIG${role_post}=@targetPrefix@@baseBinName@

# No local scope in sourced file
unset -v role_post