1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
9 inherit autotools eutils multilib linux-info multilib-minimal
11 if [[ ${PV} = 9999* ]]
13 EGIT_REPO_URI="git://github.com/gentoo/eudev.git"
16 SRC_URI="https://dev.gentoo.org/~blueness/${PN}/${P}.tar.gz"
20 DESCRIPTION="Linux dynamic and persistent device naming support (aka userspace devfs)"
21 HOMEPAGE="https://github.com/gentoo/eudev"
23 LICENSE="LGPL-2.1 MIT GPL-2"
25 IUSE="doc gudev hwdb kmod introspection keymap +modutils +openrc +rule-generator selinux static-libs test"
27 COMMON_DEPEND="gudev? ( dev-libs/glib:2 )
28 kmod? ( sys-apps/kmod )
29 introspection? ( >=dev-libs/gobject-introspection-1.31.1 )
30 selinux? ( sys-libs/libselinux )
31 >=sys-apps/util-linux-2.20
34 !<=app-emulation/emul-linux-x86-baselibs-20130224-r7
35 !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
38 DEPEND="${COMMON_DEPEND}
39 keymap? ( dev-util/gperf )
40 >=dev-util/intltool-0.40.0
43 !<sys-kernel/linux-headers-${KV_min}
44 doc? ( dev-util/gtk-doc )
45 app-text/docbook-xsl-stylesheets
47 test? ( app-text/tree dev-lang/perl )"
49 RDEPEND="${COMMON_DEPEND}
55 !<sys-fs/udev-init-scripts-18
56 gudev? ( !dev-libs/libgudev )"
58 PDEPEND="hwdb? ( >=sys-apps/hwids-20130717-r1[udev] )
59 keymap? ( >=sys-apps/hwids-20130717-r1[udev] )
60 openrc? ( >=sys-fs/udev-init-scripts-18 )"
62 REQUIRED_USE="keymap? ( hwdb )"
66 if ! use rule-generator; then
68 ewarn "As of 2013-01-29, ${P} provides the new interface renaming functionality,"
69 ewarn "as described in the URL below:"
70 ewarn "http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames"
72 ewarn "This functionality is enabled BY DEFAULT because eudev has no means of synchronizing"
73 ewarn "between the default or user-modified choice of sys-fs/udev. If you wish to disable"
74 ewarn "this new iface naming, please be sure that /etc/udev/rules.d/80-net-name-slot.rules"
76 ewarn "\ttouch /etc/udev/rules.d/80-net-name-slot.rules"
78 ewarn "We are working on a better solution for the next beta release."
88 # These are required kernel options, but we don't error out on them
89 # because you can build under one kernel and run under another.
90 CONFIG_CHECK="~BLK_DEV_BSG ~DEVTMPFS ~!IDE ~INOTIFY_USER ~SIGNALFD ~!SYSFS_DEPRECATED ~!SYSFS_DEPRECATED_V2"
92 if kernel_is lt ${KV_min//./ }; then
94 ewarn "Your current running kernel version ${KV_FULL} is too old to run ${P}."
95 ewarn "Make sure to run udev under kernel version ${KV_min} or above."
102 # change rules back to group uucp instead of dialout for now
103 sed -e 's/GROUP="dialout"/GROUP="uucp"/' -i rules/*.rules \
104 || die "failed to change group dialout to uucp"
106 epatch "${FILESDIR}"/${PN}-selinux-timespan.patch
110 if [[ ! -e configure ]]
114 gtkdocize --docdir docs || die "gtkdocize failed"
116 echo 'EXTRA_DIST =' > docs/gtk-doc.make
124 multilib_src_configure()
129 ac_cv_search_cap_init=
130 ac_cv_header_sys_capability_h=yes
134 --docdir=/usr/share/doc/${PF}
135 --libdir=/usr/$(get_libdir)
136 --with-firmware-path="${EPREFIX}usr/lib/firmware/updates:${EPREFIX}usr/lib/firmware:${EPREFIX}lib/firmware/updates:${EPREFIX}lib/firmware"
137 --with-html-dir="/usr/share/doc/${PF}/html"
142 # Only build libudev for non-native_abi, and only install it to libdir,
143 # that means all options only apply to native_abi
144 if multilib_is_native_abi; then econf_args+=(
145 --with-rootlibdir=/$(get_libdir)
146 $(use_enable doc gtk-doc)
148 $(use_enable introspection)
150 $(use_enable kmod libkmod)
151 $(usex kmod --enable-modules $(use_enable modutils modules))
152 $(use_enable static-libs static)
153 $(use_enable selinux)
154 $(use_enable rule-generator)
157 $(echo --disable-{gtk-doc,gudev,introspection,keymap,libkmod,modules,static,selinux,rule-generator})
160 ECONF_SOURCE="${S}" econf "${econf_args[@]}"
163 multilib_src_compile()
165 if ! multilib_is_native_abi; then
166 cd src/libudev || die "Could not change directory"
171 multilib_src_install()
173 if ! multilib_is_native_abi; then
174 cd src/libudev || die "Could not change directory"
176 emake DESTDIR="${D}" install
181 # make sandbox get out of the way
182 # these are safe because there is a fake root filesystem put in place,
183 # but sandbox seems to evaluate the paths of the test i/o instead of the
184 # paths of the actual i/o that results.
185 # also only test for native abi
186 if multilib_is_native_abi; then
194 # disable header checks because we only install libudev headers for non-native abi
195 multilib_check_headers()
200 multilib_src_install_all()
202 prune_libtool_files --all
203 rm -rf "${ED}"/usr/share/doc/${PF}/LICENSE.*
205 use rule-generator && use openrc && doinitd "${FILESDIR}"/udev-postmount
207 # drop distributed hwdb files, they override sys-apps/hwids
208 rm -f "${ED}"/etc/udev/hwdb.d/*.hwdb
214 for htmldir in gudev libudev; do
215 if [[ -d ${EROOT}usr/share/gtk-doc/html/${htmldir} ]]
217 rm -rf "${EROOT}"usr/share/gtk-doc/html/${htmldir}
219 if [[ -d ${ED}/usr/share/doc/${PF}/html/${htmldir} ]]
221 dosym ../../doc/${PF}/html/${htmldir} \
222 /usr/share/gtk-doc/html/${htmldir}
229 mkdir -p "${EROOT}"run
231 # "losetup -f" is confused if there is an empty /dev/loop/, Bug #338766
232 # So try to remove it here (will only work if empty).
233 rmdir "${EROOT}"dev/loop 2>/dev/null
234 if [[ -d ${EROOT}dev/loop ]]
236 ewarn "Please make sure you remove /dev/loop, else losetup"
237 ewarn "may be confused when looking for unused devices."
240 # 64-device-mapper.rules now gets installed by sys-fs/device-mapper
241 # remove it if user don't has sys-fs/device-mapper installed, 27 Jun 2007
242 if [[ -f ${EROOT}etc/udev/rules.d/64-device-mapper.rules ]] &&
243 ! has_version sys-fs/device-mapper
245 rm -f "${EROOT}"etc/udev/rules.d/64-device-mapper.rules
246 einfo "Removed unneeded file 64-device-mapper.rules"
249 if use hwdb && has_version 'sys-apps/hwids[udev]'; then
250 udevadm hwdb --update --root="${ROOT%/}"
252 # http://cgit.freedesktop.org/systemd/systemd/commit/?id=1fab57c209035f7e66198343074e9cee06718bda
253 # reload database after it has be rebuilt, but only if we are not upgrading
254 # also pass if we are -9999 since who knows what hwdb related changes there might be
255 if [[ ${REPLACING_VERSIONS%-r*} == ${PV} || -z ${REPLACING_VERSIONS} ]] && \
256 [[ ${ROOT%/} == "" ]] && [[ ${PV} != "9999" ]]; then
257 udevadm control --reload
262 ewarn "You need to restart eudev as soon as possible to make the"
263 ewarn "upgrade go into effect:"
264 ewarn "\t/etc/init.d/udev --nodeps restart"
266 if use rule-generator && use openrc; then
268 ewarn "Please add the udev-postmount init script to your default runlevel"
269 ewarn "to ensure the legacy rule-generator functionality works as reliably"
271 ewarn "\trc-update add udev-postmount default"
275 elog "For more information on eudev on Gentoo, writing udev rules, and"
276 elog "fixing known issues visit:"
277 elog " https://www.gentoo.org/doc/en/udev-guide.xml"