/[gentoo-x86]/eclass/udev.eclass
Gentoo

Contents of /eclass/udev.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Tue Oct 30 19:08:39 2012 UTC (2 years, 1 month ago) by ssuominen
Branch: MAIN
New eclass to determine udevdir from udev.pc pkg-config file as requested by many people, without ML review due to unproductive feedback

1 ssuominen 1.1 # Copyright 1999-2012 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3     # $Header: $
4    
5     # @ECLASS: udev.eclass
6     # @MAINTAINER:
7     # udev-bugs@gentoo.org
8     # @BLURB: Default eclass for determining udev directories.
9     # @DESCRIPTION:
10     # Default eclass for determining udev directories.
11     # @EXAMPLE:
12     #
13     # @CODE
14     # inherit udev
15     #
16     # RDEPEND=">=sys-fs/udev-171-r6"
17     # DEPEND="${RDEPEND}"
18     #
19     # src_configure() {
20     # econf --with-udevdir="$(udev_get_udevdir)"
21     # }
22     # @CODE
23    
24     inherit toolchain-funcs
25    
26     case ${EAPI:-0} in
27     0|1|2|3|4) ;;
28     *) die "${ECLASS}.eclass API in EAPI ${EAPI} not yet established."
29     esac
30    
31     RDEPEND=""
32     DEPEND="virtual/pkgconfig"
33    
34     # @FUNCTION: _udev_get_udevdir
35     # @INTERNAL
36     # @DESCRIPTION:
37     # Get unprefixed udevdir.
38     _udev_get_udevdir() {
39     if $($(tc-getPKG_CONFIG) --exists udev); then
40     echo -n "$($(tc-getPKG_CONFIG) --variable=udevdir udev)"
41     else
42     echo -n /lib/udev
43     fi
44     }
45    
46     # @FUNCTION: udev_get_udevdir
47     # @DESCRIPTION:
48     # Output the path for the udev directory (not including ${D}).
49     # This function always succeeds, even if udev is not installed.
50     # The fallback value is set to /lib/udev
51     udev_get_udevdir() {
52     has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
53     debug-print-function ${FUNCNAME} "${@}"
54    
55     echo -n "${EPREFIX}$(_udev_get_udevdir)"
56     }

  ViewVC Help
Powered by ViewVC 1.1.20