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

Contents of /eclass/udev.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations) (download)
Wed Oct 31 16:08:49 2012 UTC (23 months, 3 weeks ago) by ssuominen
Branch: MAIN
Changes since 1.3: +30 -3 lines
New functions for installing udev rules. Drop prefix code as requested by grobian.

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.3 2012/10/30 20:26:54 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 --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|5) ;;
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 "$($(tc-getPKG_CONFIG) --variable=udevdir udev)"
41 else
42 echo /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 debug-print-function ${FUNCNAME} "${@}"
53
54 echo "$(_udev_get_udevdir)"
55 }
56
57 # @FUNCTION: udev_dorules
58 # @USAGE: rules [...]
59 # @DESCRIPTION:
60 # Install udev rule(s). Uses doins, thus it is fatal in EAPI 4
61 # and non-fatal in earlier EAPIs.
62 udev_dorules() {
63 debug-print-function ${FUNCNAME} "${@}"
64
65 (
66 insinto "$(_udev_get_udevdir)"/rules.d
67 doins "${@}"
68 )
69 }
70
71 # @FUNCTION: udev_newrules
72 # @USAGE: oldname newname
73 # @DESCRIPTION:
74 # Install udev rule with a new name. Uses newins, thus it is fatal
75 # in EAPI 4 and non-fatal in earlier EAPIs.
76 udev_newrules() {
77 debug-print-function ${FUNCNAME} "${@}"
78
79 (
80 insinto "$(_udev_get_udevdir)"/rules.d
81 newins "${@}"
82 )
83 }

  ViewVC Help
Powered by ViewVC 1.1.20