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

Contents of /eclass/udev.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations) (download)
Wed Oct 31 17:45:30 2012 UTC (21 months, 3 weeks ago) by ssuominen
Branch: MAIN
Changes since 1.4: +8 -2 lines
Better example of usage of this eclass

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.4 2012/10/31 16:08:49 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 # RDEPEND=">=sys-fs/udev-171-r6"
17 # DEPEND="${RDEPEND}"
18 #
19 # src_configure() {
20 # econf \
21 # --with-udevrulesdir="$(udev_get_udevdir)"/rules.d
22 # }
23 #
24 # src_install() {
25 # # udev_dorules contrib/99foomatic
26 # udev_newrules contrib/98-foomatic 99foomatic
27 # }
28 # @CODE
29
30 inherit toolchain-funcs
31
32 case ${EAPI:-0} in
33 0|1|2|3|4|5) ;;
34 *) 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 echo "$($(tc-getPKG_CONFIG) --variable=udevdir udev)"
47 else
48 echo /lib/udev
49 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 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 }

  ViewVC Help
Powered by ViewVC 1.1.20