1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
10 inherit autotools eutils linux-info multilib multilib-minimal user
12 if [[ ${PV} = 9999* ]]; then
13 EGIT_REPO_URI="git://github.com/gentoo/eudev.git"
16 SRC_URI="https://dev.gentoo.org/~blueness/${PN}/${P}.tar.gz"
17 KEYWORDS="~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~sparc ~x86"
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 selinux static-libs test"
27 COMMON_DEPEND=">=sys-apps/util-linux-2.20
28 gudev? ( >=dev-libs/glib-2.34.3:2[${MULTILIB_USEDEP}] )
29 introspection? ( >=dev-libs/gobject-introspection-1.38 )
30 kmod? ( >=sys-apps/kmod-16 )
31 selinux? ( >=sys-libs/libselinux-2.1.9 )
33 !sys-apps/gentoo-systemd-integration
36 !<=app-emulation/emul-linux-x86-baselibs-20130224-r7
37 !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
39 DEPEND="${COMMON_DEPEND}
43 >=sys-devel/make-3.82-r4
44 >=sys-kernel/linux-headers-${KV_min}
45 doc? ( >=dev-util/gtk-doc-1.18
46 app-text/docbook-xml-dtd:4.2
47 app-text/docbook-xml-dtd:4.5
48 app-text/docbook-xsl-stylesheets
51 >=dev-util/intltool-0.50
52 test? ( app-text/tree dev-lang/perl )"
54 RDEPEND="${COMMON_DEPEND}
55 !<sys-fs/lvm2-2.02.103
56 !<sec-policy/selinux-base-2.20120725-r10
59 gudev? ( !dev-libs/libgudev )"
61 PDEPEND=">=sys-fs/udev-init-scripts-26
62 hwdb? ( >=sys-apps/hwids-20140304[udev] )"
64 # The multilib-build.eclass doesn't handle situation where the installed headers
65 # are different in ABIs. In this case, we install libgudev headers in native
66 # ABI but not for non-native ABI.
67 multilib_check_headers() { :; }
71 ewarn "As of 2013-01-29, ${P} provides the new interface renaming functionality,"
72 ewarn "as described in the URL below:"
73 ewarn "http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames"
75 ewarn "This functionality is enabled BY DEFAULT because eudev has no means of synchronizing"
76 ewarn "between the default or user-modified choice of sys-fs/udev. If you wish to disable"
77 ewarn "this new iface naming, please be sure that /etc/udev/rules.d/80-net-name-slot.rules"
78 ewarn "exists: touch /etc/udev/rules.d/80-net-name-slot.rules"
83 CONFIG_CHECK="~BLK_DEV_BSG ~DEVTMPFS ~!IDE ~INOTIFY_USER ~!SYSFS_DEPRECATED ~!SYSFS_DEPRECATED_V2 ~SIGNALFD ~EPOLL ~FHANDLE ~NET"
87 # These are required kernel options, but we don't error out on them
88 # because you can build under one kernel and run under another.
89 if kernel_is lt ${KV_min//./ }; then
91 ewarn "Your current running kernel version ${KV_FULL} is too old to run ${P}."
92 ewarn "Make sure to run udev under kernel version ${KV_min} or above."
98 # change rules back to group uucp instead of dialout for now
99 sed -e 's/GROUP="dialout"/GROUP="uucp"/' -i rules/*.rules \
100 || die "failed to change group dialout to uucp"
105 gtkdocize --docdir docs || die "gtkdocize failed"
107 echo 'EXTRA_DIST =' > docs/gtk-doc.make
112 multilib_src_configure() {
114 export cc_cv_CFLAGS__flto=no #502950
116 # Keep sorted by ./configure --help and only pass --disable flags
117 # when *required* to avoid external deps or unnecessary compile
120 ac_cv_search_cap_init=
121 ac_cv_header_sys_capability_h=yes
125 --docdir=/usr/share/doc/${PF}
126 --libdir=/usr/$(get_libdir)
127 --with-rootlibexecdir=/lib/udev
128 --with-html-dir="/usr/share/doc/${PF}/html"
135 # Only build libudev for non-native_abi, and only install it to libdir,
136 # that means all options only apply to native_abi
137 if multilib_is_native_abi; then
139 --with-rootlibdir=/$(get_libdir)
140 $(use_enable doc gtk-doc)
141 $(use_enable introspection)
143 $(use_enable static-libs static)
144 $(use_enable selinux)
150 --disable-introspection
155 ECONF_SOURCE="${S}" econf "${econf_args[@]}"
158 multilib_src_compile() {
159 if multilib_is_native_abi; then
164 use gudev && emake -C src/gudev
168 multilib_src_install() {
169 if multilib_is_native_abi; then
170 emake DESTDIR="${D}" install
172 emake -C src/libudev DESTDIR="${D}" install
173 use gudev && emake -C src/gudev DESTDIR="${D}" install
177 multilib_src_test() {
178 # make sandbox get out of the way
179 # these are safe because there is a fake root filesystem put in place,
180 # but sandbox seems to evaluate the paths of the test i/o instead of the
181 # paths of the actual i/o that results.
182 # also only test for native abi
183 if multilib_is_native_abi; then
191 multilib_src_install_all() {
192 prune_libtool_files --all
193 rm -rf "${ED}"/usr/share/doc/${PF}/LICENSE.*
195 # drop distributed hwdb files, they override sys-apps/hwids
196 rm -f "${ED}"/etc/udev/hwdb.d/*.hwdb
198 insinto /lib/udev/rules.d
199 doins "${FILESDIR}"/40-gentoo.rules
201 if ! [[ ${PV} = 9999* ]]; then
202 insinto /usr/share/doc/${PF}/html/gudev
203 doins "${S}"/docs/gudev/html/*
205 insinto /usr/share/doc/${PF}/html/libudev
206 doins "${S}"/docs/libudev/html/*
212 for htmldir in gudev libudev; do
213 if [[ -d ${EROOT}usr/share/gtk-doc/html/${htmldir} ]]; then
214 rm -rf "${EROOT}"usr/share/gtk-doc/html/${htmldir}
216 if [[ -d ${ED}/usr/share/doc/${PF}/html/${htmldir} ]]; then
217 dosym ../../doc/${PF}/html/${htmldir} \
218 /usr/share/gtk-doc/html/${htmldir}
224 mkdir -p "${EROOT}"run
226 # "losetup -f" is confused if there is an empty /dev/loop/, Bug #338766
227 # So try to remove it here (will only work if empty).
228 rmdir "${EROOT}"dev/loop 2>/dev/null
229 if [[ -d ${EROOT}dev/loop ]]; then
230 ewarn "Please make sure your remove /dev/loop,"
231 ewarn "else losetup may be confused when looking for unused devices."
234 if use hwdb && has_version 'sys-apps/hwids[udev]'; then
235 udevadm hwdb --update --root="${ROOT%/}"
237 # http://cgit.freedesktop.org/systemd/systemd/commit/?id=1fab57c209035f7e66198343074e9cee06718bda
238 # reload database after it has be rebuilt, but only if we are not upgrading
239 # also pass if we are -9999 since who knows what hwdb related changes there might be
240 if [[ ${REPLACING_VERSIONS%-r*} == ${PV} || -z ${REPLACING_VERSIONS} ]] && \
241 [[ ${ROOT%/} == "" ]] && [[ ${PV} != "9999" ]]; then
242 udevadm control --reload
247 ewarn "You need to restart eudev as soon as possible to make the"
248 ewarn "upgrade go into effect:"
249 ewarn "\t/etc/init.d/udev --nodeps restart"
252 elog "For more information on eudev on Gentoo, writing udev rules, and"
253 elog "fixing known issues visit:"
254 elog " https://www.gentoo.org/doc/en/udev-guide.xml"
257 # http://cgit.freedesktop.org/systemd/systemd/commit/rules/50-udev-default.rules?id=3dff3e00e044e2d53c76fa842b9a4759d4a50e69
258 # http://bugs.gentoo.org/246847
259 # http://bugs.gentoo.org/514174
262 # Update hwdb database in case the format is changed by udev version.
263 if has_version 'sys-apps/hwids[udev]'; then
264 udevadm hwdb --update --root="${ROOT%/}"
265 # Only reload when we are not upgrading to avoid potential race w/ incompatible hwdb.bin and the running udevd
266 if [[ -z ${REPLACING_VERSIONS} ]]; then
267 # http://cgit.freedesktop.org/systemd/systemd/commit/?id=1fab57c209035f7e66198343074e9cee06718bda
268 if [[ ${ROOT} != "" ]] && [[ ${ROOT} != "/" ]]; then
271 udevadm control --reload