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

Contents of /eclass/udev.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.9 - (hide annotations) (download)
Tue Jan 29 15:33:37 2013 UTC (20 months, 3 weeks ago) by ssuominen
Branch: MAIN
Changes since 1.8: +14 -5 lines
Rename udev_get_udevdir to plain get_udevdir which looks completely safe. No clue why I didn't do this at the first place. Sorry about that.

1 ssuominen 1.1 # Copyright 1999-2012 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3 ssuominen 1.9 # $Header: /var/cvsroot/gentoo-x86/eclass/udev.eclass,v 1.8 2012/12/03 01:58:44 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 ssuominen 1.7 # # 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 ssuominen 1.1 # DEPEND="${RDEPEND}"
20     #
21     # src_configure() {
22 ssuominen 1.9 # econf --with-rulesdir="$(get_udevdir)"/rules.d
23 ssuominen 1.5 # }
24     #
25     # src_install() {
26 ssuominen 1.9 # default
27 ssuominen 1.6 # # udev_dorules contrib/99-foomatic
28 ssuominen 1.9 # # udev_newrules contrib/98-foomatic 99-foomatic
29 ssuominen 1.1 # }
30     # @CODE
31    
32     inherit toolchain-funcs
33    
34     case ${EAPI:-0} in
35 ssuominen 1.2 0|1|2|3|4|5) ;;
36 ssuominen 1.1 *) 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 ssuominen 1.3 echo "$($(tc-getPKG_CONFIG) --variable=udevdir udev)"
49 ssuominen 1.1 else
50 ssuominen 1.3 echo /lib/udev
51 ssuominen 1.1 fi
52     }
53    
54     # @FUNCTION: udev_get_udevdir
55     # @DESCRIPTION:
56 ssuominen 1.9 # Use the short version $(get_udevdir) instead!
57     udev_get_udevdir() {
58     debug-print-function ${FUNCNAME} "${@}"
59    
60     echo "$(_udev_get_udevdir)"
61     }
62    
63     # @FUNCTION: get_udevdir
64     # @DESCRIPTION:
65 ssuominen 1.1 # Output the path for the udev directory (not including ${D}).
66     # This function always succeeds, even if udev is not installed.
67     # The fallback value is set to /lib/udev
68 ssuominen 1.9 get_udevdir() {
69 ssuominen 1.1 debug-print-function ${FUNCNAME} "${@}"
70    
71 ssuominen 1.4 echo "$(_udev_get_udevdir)"
72     }
73    
74     # @FUNCTION: udev_dorules
75     # @USAGE: rules [...]
76     # @DESCRIPTION:
77     # Install udev rule(s). Uses doins, thus it is fatal in EAPI 4
78     # and non-fatal in earlier EAPIs.
79     udev_dorules() {
80     debug-print-function ${FUNCNAME} "${@}"
81    
82     (
83     insinto "$(_udev_get_udevdir)"/rules.d
84     doins "${@}"
85     )
86     }
87    
88     # @FUNCTION: udev_newrules
89     # @USAGE: oldname newname
90     # @DESCRIPTION:
91     # Install udev rule with a new name. Uses newins, thus it is fatal
92     # in EAPI 4 and non-fatal in earlier EAPIs.
93     udev_newrules() {
94     debug-print-function ${FUNCNAME} "${@}"
95    
96     (
97     insinto "$(_udev_get_udevdir)"/rules.d
98     newins "${@}"
99     )
100 ssuominen 1.1 }

  ViewVC Help
Powered by ViewVC 1.1.20