On 08/06/2012 01:42 PM, Fabian Groffen wrote:
On 06-08-2012 13:37:55 +0300, Samuli Suominen wrote:
Also, I'm not so sure if this will work correctly for Prefix.

I'm sure that is easily checked and we will get feedback quickly.

I'm sure systemd/udev will never run in (a) Prefix, so perhaps it is
more sensical not to pseudo-provide support for it.


after thinking about this over:

rules files are often small and often get always installed, yet the package might be running just fine without udev, the installed rules files just don't get used

therefore adding sys-fs/udev dependency to the eclass is out of question and should be left for ebuilds

therefore pseudo-prefix support should be left in place too... right?

attaching latest based on mgorny's feedback...
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

# @ECLASS: udev.eclass
# @MAINTAINER:
# udev-b...@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)"
}

Reply via email to