Index: eclass/systemd.eclass =================================================================== RCS file: /var/cvsroot/gentoo-x86/eclass/systemd.eclass,v retrieving revision 1.21 diff -u -b -B -r1.21 systemd.eclass --- eclass/systemd.eclass 31 Dec 2012 13:09:09 -0000 1.21 +++ eclass/systemd.eclass 11 Mar 2013 21:04:16 -0000 @@ -25,17 +25,25 @@ # } # @CODE +inherit toolchain-funcs + case ${EAPI:-0} in 0|1|2|3|4|5) ;; *) die "${ECLASS}.eclass API in EAPI ${EAPI} not yet established." esac +DEPEND="virtual/pkgconfig" + # @FUNCTION: _systemd_get_unitdir # @INTERNAL # @DESCRIPTION: # Get unprefixed unitdir. _systemd_get_unitdir() { + if $($(tc-getPKG_CONFIG) --exists systemd); then + echo "$($(tc-getPKG_CONFIG) --variable=systemdsystemunitdir systemd)" + else echo /usr/lib/systemd/system + fi } # @FUNCTION: systemd_get_unitdir @@ -49,6 +57,18 @@ echo "${EPREFIX}$(_systemd_get_unitdir)" } +# @FUNCTION: _systemd_get_userunitdir +# @INTERNAL +# @DESCRIPTION: +# Get unprefixed userunitdir. +_systemd_get_userunitdir() { + if $($(tc-getPKG_CONFIG) --exists systemd); then + echo "$($(tc-getPKG_CONFIG) --variable=systemduserunitdir systemd)" + else + echo /usr/lib/systemd/user + fi +} + # @FUNCTION: systemd_get_userunitdir # @DESCRIPTION: # Output the path for the systemd user unit directory (not including @@ -58,7 +78,19 @@ has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= debug-print-function ${FUNCNAME} "${@}" - echo "${EPREFIX}/usr/lib/systemd/user" + echo "${EPREFIX}$(_systemd_get_userunitdir)" +} + +# @FUNCTION: _systemd_get_utildir +# @INTERNAL +# @DESCRIPTION: +# Get unprefixed utildir. +_systemd_get_utildir() { + if $($(tc-getPKG_CONFIG) --exists systemd); then + echo "$($(tc-getPKG_CONFIG) --variable=systemdutildir systemd)" + else + echo /usr/lib/systemd + fi } # @FUNCTION: systemd_get_utildir @@ -70,7 +102,7 @@ has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= debug-print-function ${FUNCNAME} "${@}" - echo "${EPREFIX}/usr/lib/systemd" + echo "${EPREFIX}$(_systemd_get_utildir)" } # @FUNCTION: systemd_dounit