diff options
author | Samuli Suominen <ssuominen@gentoo.org> | 2012-10-30 19:08:39 +0000 |
---|---|---|
committer | Samuli Suominen <ssuominen@gentoo.org> | 2012-10-30 19:08:39 +0000 |
commit | 676acdfed0ca2fed81210995d396420f0508bd3e (patch) | |
tree | 7227d8052b618a47c1507cd1ef9a0705ed568643 /eclass | |
parent | Stable for x86, wrt bug #438704 (diff) | |
download | gentoo-2-676acdfed0ca2fed81210995d396420f0508bd3e.tar.gz gentoo-2-676acdfed0ca2fed81210995d396420f0508bd3e.tar.bz2 gentoo-2-676acdfed0ca2fed81210995d396420f0508bd3e.zip |
New eclass to determine udevdir from udev.pc pkg-config file as requested by many people, without ML review due to unproductive feedback
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/udev.eclass | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/eclass/udev.eclass b/eclass/udev.eclass new file mode 100644 index 000000000000..1211d2584f08 --- /dev/null +++ b/eclass/udev.eclass @@ -0,0 +1,56 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/udev.eclass,v 1.1 2012/10/30 19:08:39 ssuominen Exp $ + +# @ECLASS: udev.eclass +# @MAINTAINER: +# udev-bugs@gentoo.org +# @BLURB: Default eclass for determining udev directories. +# @DESCRIPTION: +# Default eclass for determining udev directories. +# @EXAMPLE: +# +# @CODE +# inherit udev +# +# RDEPEND=">=sys-fs/udev-171-r6" +# DEPEND="${RDEPEND}" +# +# src_configure() { +# econf --with-udevdir="$(udev_get_udevdir)" +# } +# @CODE + +inherit toolchain-funcs + +case ${EAPI:-0} in + 0|1|2|3|4) ;; + *) die "${ECLASS}.eclass API in EAPI ${EAPI} not yet established." +esac + +RDEPEND="" +DEPEND="virtual/pkgconfig" + +# @FUNCTION: _udev_get_udevdir +# @INTERNAL +# @DESCRIPTION: +# Get unprefixed udevdir. +_udev_get_udevdir() { + if $($(tc-getPKG_CONFIG) --exists udev); then + echo -n "$($(tc-getPKG_CONFIG) --variable=udevdir udev)" + else + echo -n /lib/udev + fi +} + +# @FUNCTION: udev_get_udevdir +# @DESCRIPTION: +# Output the path for the udev directory (not including ${D}). +# This function always succeeds, even if udev is not installed. +# The fallback value is set to /lib/udev +udev_get_udevdir() { + has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= + debug-print-function ${FUNCNAME} "${@}" + + echo -n "${EPREFIX}$(_udev_get_udevdir)" +} |