# Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ # @ECLASS: udev.eclass # @MAINTAINER: # udev-bugs@gentoo.org # @BLURB: helper function to determine udevdir # @DESCRIPTION: # This eclass provides a function to get the default udev path. # @EXAMPLE: # # @CODE # inherit udev # # 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 while waiting for # >=sys-fs/udev-187-r1 to stabilize. udev_get_udevdir() { has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= debug-print-function ${FUNCNAME} "${@}" echo -n "${EPREFIX}$(_udev_get_udevdir)" }