public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] rfc: patch systemd.eclass to use pkg-config if available
@ 2013-03-11 21:18 William Hubbs
  2013-03-11 21:37 ` Mike Gilbert
  0 siblings, 1 reply; 5+ messages in thread
From: William Hubbs @ 2013-03-11 21:18 UTC (permalink / raw
  To: gentoo development; +Cc: systemd, ssuominen


[-- Attachment #1.1: Type: text/plain, Size: 338 bytes --]

All,

systemd, like udev, stores directory paths in a way that they can be
queried from pkg-config. However, the systemd.eclass currently does not
use this ability.

The following patch models the systemd eclass after the udev eclass and
leaves the current defaults in place if there is an issue with
pkg-config.

Any thoughts?

William


[-- Attachment #1.2: systemd.eclass.patch --]
[-- Type: text/x-diff, Size: 2182 bytes --]

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

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-03-11 23:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-11 21:18 [gentoo-dev] rfc: patch systemd.eclass to use pkg-config if available William Hubbs
2013-03-11 21:37 ` Mike Gilbert
2013-03-11 22:28   ` William Hubbs
2013-03-11 22:47     ` Michał Górny
2013-03-11 23:05       ` William Hubbs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox