1 # shellcheck shell=bash
3 # Setup hook that installs specified pkgconfig items.
5 # Example usage in a derivation:
7 # { …, makePkgconfigItem, copyPkgconfigItems, … }:
9 # let pkgconfigItem = makePkgconfigItem { … }; in
10 # stdenv.mkDerivation {
12 # nativeBuildInputs = [ copyPkgconfigItems ];
14 # pkgconfigItems = [ pkgconfigItem ];
18 # This hook will copy files which are either given by full path
19 # or all '*.pc' files placed inside the 'lib/pkgconfig'
20 # folder of each `pkgconfigItems` argument.
22 postInstallHooks
+=(copyPkgconfigItems
)
24 copyPkgconfigItems
() {
25 if [ "${dontCopyPkgconfigItems-}" = 1 ]; then return; fi
27 if [ -z "$pkgconfigItems" ]; then
31 pkgconfigdir
="${!outputDev}/lib/pkgconfig"
32 for pkgconfigItem
in $pkgconfigItems; do
33 if [[ -f "$pkgconfigItem" ]]; then
34 substituteAllInPlace
"$pkgconfigItem"
35 echo "Copying '$pkgconfigItem' into '${pkgconfigdir}'"
36 install -D -m 444 -t "${pkgconfigdir}" "$pkgconfigItem"
37 substituteAllInPlace
"${pkgconfigdir}"/*
39 for f
in "$pkgconfigItem"/lib
/pkgconfig
/*.pc
; do
40 echo "Copying '$f' into '${pkgconfigdir}'"
41 install -D -m 444 -t "${pkgconfigdir}" "$f"
42 substituteAllInPlace
"${pkgconfigdir}"/*