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

Contents of /eclass/udev.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (show annotations) (download)
Mon Dec 3 01:58:44 2012 UTC (16 months, 2 weeks ago) by ssuominen
Branch: MAIN
Changes since 1.7: +2 -2 lines
whitespace

1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/udev.eclass,v 1.7 2012/12/02 22:37:01 ssuominen Exp $
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 # # In this example 196 is the first version with udev.bin hwdb database,
17 # # and we also link against libgudev
18 # RDEPEND=">=virtual/udev-196[hwdb,gudev]"
19 # DEPEND="${RDEPEND}"
20 #
21 # src_configure() {
22 # econf \
23 # --with-rulesdir="$(udev_get_udevdir)"/rules.d \
24 # }
25 #
26 # src_install() {
27 # # udev_dorules contrib/99-foomatic
28 # udev_newrules contrib/98-foomatic 99-foomatic
29 # }
30 # @CODE
31
32 inherit toolchain-funcs
33
34 case ${EAPI:-0} in
35 0|1|2|3|4|5) ;;
36 *) die "${ECLASS}.eclass API in EAPI ${EAPI} not yet established."
37 esac
38
39 RDEPEND=""
40 DEPEND="virtual/pkgconfig"
41
42 # @FUNCTION: _udev_get_udevdir
43 # @INTERNAL
44 # @DESCRIPTION:
45 # Get unprefixed udevdir.
46 _udev_get_udevdir() {
47 if $($(tc-getPKG_CONFIG) --exists udev); then
48 echo "$($(tc-getPKG_CONFIG) --variable=udevdir udev)"
49 else
50 echo /lib/udev
51 fi
52 }
53
54 # @FUNCTION: udev_get_udevdir
55 # @DESCRIPTION:
56 # Output the path for the udev directory (not including ${D}).
57 # This function always succeeds, even if udev is not installed.
58 # The fallback value is set to /lib/udev
59 udev_get_udevdir() {
60 debug-print-function ${FUNCNAME} "${@}"
61
62 echo "$(_udev_get_udevdir)"
63 }
64
65 # @FUNCTION: udev_dorules
66 # @USAGE: rules [...]
67 # @DESCRIPTION:
68 # Install udev rule(s). Uses doins, thus it is fatal in EAPI 4
69 # and non-fatal in earlier EAPIs.
70 udev_dorules() {
71 debug-print-function ${FUNCNAME} "${@}"
72
73 (
74 insinto "$(_udev_get_udevdir)"/rules.d
75 doins "${@}"
76 )
77 }
78
79 # @FUNCTION: udev_newrules
80 # @USAGE: oldname newname
81 # @DESCRIPTION:
82 # Install udev rule with a new name. Uses newins, thus it is fatal
83 # in EAPI 4 and non-fatal in earlier EAPIs.
84 udev_newrules() {
85 debug-print-function ${FUNCNAME} "${@}"
86
87 (
88 insinto "$(_udev_get_udevdir)"/rules.d
89 newins "${@}"
90 )
91 }

  ViewVC Help
Powered by ViewVC 1.1.20