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

Diff of /eclass/udev.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.2 Revision 1.8
1# Copyright 1999-2012 Gentoo Foundation 1# Copyright 1999-2012 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/udev.eclass,v 1.2 2012/10/30 20:03:12 ssuominen Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/udev.eclass,v 1.8 2012/12/03 01:58:44 ssuominen Exp $
4 4
5# @ECLASS: udev.eclass 5# @ECLASS: udev.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# udev-bugs@gentoo.org 7# udev-bugs@gentoo.org
8# @BLURB: Default eclass for determining udev directories. 8# @BLURB: Default eclass for determining udev directories.
11# @EXAMPLE: 11# @EXAMPLE:
12# 12#
13# @CODE 13# @CODE
14# inherit udev 14# inherit udev
15# 15#
16# RDEPEND=">=sys-fs/udev-171-r6" 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]"
17# DEPEND="${RDEPEND}" 19# DEPEND="${RDEPEND}"
18# 20#
19# src_configure() { 21# src_configure() {
22# econf \
20# econf --with-udevdir="$(udev_get_udevdir)" 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
21# } 29# }
22# @CODE 30# @CODE
23 31
24inherit toolchain-funcs 32inherit toolchain-funcs
25 33
35# @INTERNAL 43# @INTERNAL
36# @DESCRIPTION: 44# @DESCRIPTION:
37# Get unprefixed udevdir. 45# Get unprefixed udevdir.
38_udev_get_udevdir() { 46_udev_get_udevdir() {
39 if $($(tc-getPKG_CONFIG) --exists udev); then 47 if $($(tc-getPKG_CONFIG) --exists udev); then
40 echo -n "$($(tc-getPKG_CONFIG) --variable=udevdir udev)" 48 echo "$($(tc-getPKG_CONFIG) --variable=udevdir udev)"
41 else 49 else
42 echo -n /lib/udev 50 echo /lib/udev
43 fi 51 fi
44} 52}
45 53
46# @FUNCTION: udev_get_udevdir 54# @FUNCTION: udev_get_udevdir
47# @DESCRIPTION: 55# @DESCRIPTION:
48# Output the path for the udev directory (not including ${D}). 56# Output the path for the udev directory (not including ${D}).
49# This function always succeeds, even if udev is not installed. 57# This function always succeeds, even if udev is not installed.
50# The fallback value is set to /lib/udev 58# The fallback value is set to /lib/udev
51udev_get_udevdir() { 59udev_get_udevdir() {
52 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
53 debug-print-function ${FUNCNAME} "${@}" 60 debug-print-function ${FUNCNAME} "${@}"
54 61
55 echo -n "${EPREFIX}$(_udev_get_udevdir)" 62 echo "$(_udev_get_udevdir)"
56} 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.
70udev_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.
84udev_newrules() {
85 debug-print-function ${FUNCNAME} "${@}"
86
87 (
88 insinto "$(_udev_get_udevdir)"/rules.d
89 newins "${@}"
90 )
91}

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.20