From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 4F406198005 for ; Mon, 11 Mar 2013 21:18:41 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1AAE2E07B9; Mon, 11 Mar 2013 21:18:38 +0000 (UTC) Received: from mail-oa0-f44.google.com (mail-oa0-f44.google.com [209.85.219.44]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 36DBAE0773 for ; Mon, 11 Mar 2013 21:18:36 +0000 (UTC) Received: by mail-oa0-f44.google.com with SMTP id h1so5081437oag.3 for ; Mon, 11 Mar 2013 14:18:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:date:from:to:cc:subject:message-id :mail-followup-to:mime-version:content-type:content-disposition :user-agent; bh=1yK/DZrYK0LD1efQ/biW8AMc63qlpuj4zjTp3N1EKh4=; b=d21PkET2i35ttKt8pGaf2LmDgKZiaWxyqVFUS6NbiMOmoQAvnilVCg6oYQjmRVP2aA QkWt+HmRd4auo3RmSTNbehPc6LXUNO7g3DH+3Bl4NJkDDFYviaeQ9mZ8OuPDAPvau5bo 3uVpO5afObCYbK5nvC5uUdwSFfPxwgmH9WGLe/j8Zsd6oGczx5txFGX4pxBq91o5wIcK i5IoAm7t4sXPv0XCXgNK/qZIPiheAlVveSVd6/dYvGPcd62LvnQiJ55YvdBzeWQiPqxt jwAxNYqiK69s84EHPUye/Geb2M9apcnfQwQ7nqEFkVHfQOeTdqaO3Beyq6Gp8MjRSRJ/ XzUQ== X-Received: by 10.182.59.20 with SMTP id v20mr10358135obq.80.1363036716382; Mon, 11 Mar 2013 14:18:36 -0700 (PDT) Received: from linux1 (cpe-76-187-91-26.tx.res.rr.com. [76.187.91.26]) by mx.google.com with ESMTPS id j10sm18682156obg.4.2013.03.11.14.18.30 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 11 Mar 2013 14:18:32 -0700 (PDT) Sender: William Hubbs Received: by linux1 (sSMTP sendmail emulation); Mon, 11 Mar 2013 16:18:29 -0500 Date: Mon, 11 Mar 2013 16:18:29 -0500 From: William Hubbs To: gentoo development Cc: systemd@gentoo.org, ssuominen@gentoo.org Subject: [gentoo-dev] rfc: patch systemd.eclass to use pkg-config if available Message-ID: <20130311211829.GA20220@linux1> Mail-Followup-To: gentoo development , systemd@gentoo.org, ssuominen@gentoo.org Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="wzJLGUyc3ArbnUjN" Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Archives-Salt: f509a96a-34af-4b8d-aa23-139e7c97c5f3 X-Archives-Hash: 9fabba33c663495605c5d34bc2d33f7a --wzJLGUyc3ArbnUjN Content-Type: multipart/mixed; boundary="6TrnltStXW4iwmi0" Content-Disposition: inline --6TrnltStXW4iwmi0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --6TrnltStXW4iwmi0 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="systemd.eclass.patch" Content-Transfer-Encoding: quoted-printable Index: eclass/systemd.eclass =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 =20 +inherit toolchain-funcs + case ${EAPI:-0} in 0|1|2|3|4|5) ;; *) die "${ECLASS}.eclass API in EAPI ${EAPI} not yet established." esac =20 +DEPEND=3D"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=3Dsystemdsystemunitdir systemd)" + else echo /usr/lib/systemd/system + fi } =20 # @FUNCTION: systemd_get_unitdir @@ -49,6 +57,18 @@ echo "${EPREFIX}$(_systemd_get_unitdir)" } =20 +# @FUNCTION: _systemd_get_userunitdir +# @INTERNAL +# @DESCRIPTION: +# Get unprefixed userunitdir. +_systemd_get_userunitdir() { + if $($(tc-getPKG_CONFIG) --exists systemd); then + echo "$($(tc-getPKG_CONFIG) --variable=3Dsystemduserunitdir 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=3D debug-print-function ${FUNCNAME} "${@}" =20 - 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=3Dsystemdutildir systemd)" + else + echo /usr/lib/systemd + fi } =20 # @FUNCTION: systemd_get_utildir @@ -70,7 +102,7 @@ has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=3D debug-print-function ${FUNCNAME} "${@}" =20 - echo "${EPREFIX}/usr/lib/systemd" + echo "${EPREFIX}$(_systemd_get_utildir)" } =20 # @FUNCTION: systemd_dounit --6TrnltStXW4iwmi0-- --wzJLGUyc3ArbnUjN Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iEYEARECAAYFAlE+SiUACgkQblQW9DDEZTgKlACgpR++S3ue8iEEuAzRX0qxHPct /74An3lCFS+M9HV5igf5XFrobyv8+c8W =2VcM -----END PGP SIGNATURE----- --wzJLGUyc3ArbnUjN--