public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: William Hubbs <williamh@gentoo.org>
To: gentoo development <gentoo-dev@lists.gentoo.org>
Cc: systemd@gentoo.org, ssuominen@gentoo.org
Subject: [gentoo-dev] rfc: patch systemd.eclass to use pkg-config if available
Date: Mon, 11 Mar 2013 16:18:29 -0500	[thread overview]
Message-ID: <20130311211829.GA20220@linux1> (raw)


[-- 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 --]

             reply	other threads:[~2013-03-11 21:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-11 21:18 William Hubbs [this message]
2013-03-11 21:37 ` [gentoo-dev] rfc: patch systemd.eclass to use pkg-config if available Mike Gilbert
2013-03-11 22:28   ` William Hubbs
2013-03-11 22:47     ` Michał Górny
2013-03-11 23:05       ` William Hubbs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130311211829.GA20220@linux1 \
    --to=williamh@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    --cc=ssuominen@gentoo.org \
    --cc=systemd@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox