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

Contents of /eclass/udev.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (hide annotations) (download)
Wed Oct 31 18:28:10 2012 UTC (20 months, 4 weeks ago) by ssuominen
Branch: MAIN
Changes since 1.5: +3 -3 lines
Minor change in the example to include -

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

  ViewVC Help
Powered by ViewVC 1.1.20