When using a sysroot, we should use pkg-config data from the sysroot.
While we could set PKG_CONFIG_LIBDIR, the lib directory can vary.
Distributions typically set up pkg-config wrappers for this purpose and
it is customary to respect the PKG_CONFIG variable in build systems.
Users can still set simply PKG_CONFIG_LIBDIR instead if they prefer that
approach.
Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
DRACUT_LDD=${DRACUT_LDD:-ldd}
DRACUT_TESTBIN=${DRACUT_TESTBIN:-/bin/sh}
DRACUT_LDCONFIG=${DRACUT_LDCONFIG:-ldconfig}
+PKG_CONFIG=${PKG_CONFIG:-pkg-config}
# shellcheck source=./dracut-functions.sh
. "$dracutbasedir"/dracut-functions.sh
local _pkgvar="${2%:*}"
local _var="${2#*:}"
[[ -z ${!_var} || ! -d ${dracutsysrootdir}${!_var} ]] \
- && export "$_var"="$(pkg-config "$_pkgconfig" --variable="$_pkgvar" 2> /dev/null)"
+ && export "$_var"="$($PKG_CONFIG "$_pkgconfig" --variable="$_pkgvar" 2> /dev/null)"
if [[ -z ${!_var} || ! -d ${dracutsysrootdir}${!_var} ]]; then
shift 2
if (($# == 1)); then
Default:
_ldd_
+_PKG_CONFIG_::
+ sets the _pkg-config_ program path and options. Optional.
+ Most useful together with **--sysroot**.
++
+Default:
+ _pkg-config_
+
_DRACUT_TESTBIN_::
sets the initially tested binary for detecting library paths.
Optional. Used for **--sysroot**. In the cross-compiled sysroot,