Signed-off-by: Mike Gilbert <[email protected]>
---
eclass/systemd.eclass | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/eclass/systemd.eclass b/eclass/systemd.eclass
index f6d1fa2d92d6..9f439238fe6c 100644
--- a/eclass/systemd.eclass
+++ b/eclass/systemd.eclass
@@ -46,12 +46,23 @@ fi
# instead.
_systemd_get_dir() {
[[ ${#} -eq 2 ]] || die "Usage: ${FUNCNAME} <variable-name>
<fallback-directory>"
- local variable=${1} fallback=${2} d
+ local variable=${1} fallback=${2} d eprefix
+
+ if [[ ${EAPI:-0} == [0123456] ]]; then
+ eprefix=${EPREFIX}
+ else
+ # Derive from ESYSROOT due to weird PMS logic.
+ eprefix=${ESYSROOT#${SYSROOT}}
+ fi
if $(tc-getPKG_CONFIG) --exists systemd; then
d=$($(tc-getPKG_CONFIG) --variable="${variable}" systemd) || die
+
+ # Remove SYSROOT in case PKG_CONFIG_SYSROOT_DIR is set by
cross-pkg-config.
d=${d#${SYSROOT}}
- d=${d#${EPREFIX}}
+
+ # Remove any offset prefix.
+ d=${d#${eprefix}}
else
d=${fallback}
fi
--
2.30.0