python311Packages.moto: 4.2.6 -> 4.2.10
[NixPkgs.git] / pkgs / build-support / setup-hooks / copy-pkgconfig-items.sh
blob8c04ec9b5f0ecd7798bad653d1f4a9c702de5365
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 {
11 # …
12 # nativeBuildInputs = [ copyPkgconfigItems ];
14 # pkgconfigItems = [ pkgconfigItem ];
15 # …
16 # }
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
28 return
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}"/*
38 else
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}"/*
43 done
45 done