/[gentoo-x86]/sys-fs/udev/udev-215-r1.ebuild
Gentoo

Contents of /sys-fs/udev/udev-215-r1.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations) (download)
Thu Jul 31 18:49:28 2014 UTC (6 years, 4 months ago) by blueness
Branch: MAIN
Changes since 1.4: +2 -2 lines
Stable on ppc/ppc64, bug #517106

(Portage version: 2.2.8-r1/cvs/Linux x86_64, signed Manifest commit with key 0xF52D4BBA)

1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/sys-fs/udev/udev-215-r1.ebuild,v 1.4 2014/07/31 07:46:59 jer Exp $
4
5 EAPI=5
6
7 inherit autotools bash-completion-r1 eutils linux-info multilib multilib-minimal toolchain-funcs user versionator
8
9 if [[ ${PV} = 9999* ]]; then
10 EGIT_REPO_URI="git://anongit.freedesktop.org/systemd/systemd"
11 inherit git-2
12 patchset=
13 else
14 patchset=3
15 SRC_URI="http://www.freedesktop.org/software/systemd/systemd-${PV}.tar.xz"
16 if [[ -n "${patchset}" ]]; then
17 SRC_URI="${SRC_URI}
18 http://dev.gentoo.org/~ssuominen/${P}-patches-${patchset}.tar.xz
19 http://dev.gentoo.org/~williamh/dist/${P}-patches-${patchset}.tar.xz"
20 fi
21 KEYWORDS="~alpha amd64 arm ~arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh ~sparc x86"
22 fi
23
24 DESCRIPTION="Linux dynamic and persistent device naming support (aka userspace devfs)"
25 HOMEPAGE="http://www.freedesktop.org/wiki/Software/systemd"
26
27 LICENSE="LGPL-2.1 MIT GPL-2"
28 SLOT="0"
29 IUSE="acl doc +firmware-loader gudev introspection +kmod selinux static-libs"
30
31 RESTRICT="test"
32
33 COMMON_DEPEND=">=sys-apps/util-linux-2.20
34 acl? ( sys-apps/acl )
35 gudev? ( >=dev-libs/glib-2.34.3[${MULTILIB_USEDEP}] )
36 introspection? ( >=dev-libs/gobject-introspection-1.38 )
37 kmod? ( >=sys-apps/kmod-16 )
38 selinux? ( >=sys-libs/libselinux-2.1.9 )
39 !<sys-libs/glibc-2.11
40 !sys-apps/gentoo-systemd-integration
41 !sys-apps/systemd
42 abi_x86_32? (
43 !<=app-emulation/emul-linux-x86-baselibs-20130224-r7
44 !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
45 )"
46 # Force new make >= -r4 to skip some parallel build issues
47 DEPEND="${COMMON_DEPEND}
48 dev-util/gperf
49 >=sys-apps/coreutils-8.16
50 sys-libs/libcap
51 virtual/os-headers
52 virtual/pkgconfig
53 >=sys-devel/make-3.82-r4
54 >=sys-kernel/linux-headers-2.6.39
55 doc? ( >=dev-util/gtk-doc-1.18 )"
56 # Try with `emerge -C docbook-xml-dtd` to see the build failure without DTDs
57 if [[ ${PV} = 9999* ]]; then
58 DEPEND="${DEPEND}
59 app-text/docbook-xml-dtd:4.2
60 app-text/docbook-xml-dtd:4.5
61 app-text/docbook-xsl-stylesheets
62 dev-libs/libxslt"
63 fi
64 RDEPEND="${COMMON_DEPEND}
65 !<sys-fs/lvm2-2.02.103
66 !<sec-policy/selinux-base-2.20120725-r10"
67 PDEPEND=">=sys-apps/hwids-20140304[udev]
68 >=sys-fs/udev-init-scripts-26"
69
70 S=${WORKDIR}/systemd-${PV}
71
72 # The multilib-build.eclass doesn't handle situation where the installed headers
73 # are different in ABIs. In this case, we install libgudev headers in native
74 # ABI but not for non-native ABI.
75 multilib_check_headers() { :; }
76
77 check_default_rules() {
78 # Make sure there are no sudden changes to upstream rules file
79 # (more for my own needs than anything else ...)
80 local udev_rules_md5=c18b74c4f8bf4a397ee667ee419f3a8e
81 MD5=$(md5sum < "${S}"/rules/50-udev-default.rules)
82 MD5=${MD5/ -/}
83 if [[ ${MD5} != ${udev_rules_md5} ]]; then
84 eerror "50-udev-default.rules has been updated, please validate!"
85 eerror "md5sum: ${MD5}"
86 die "50-udev-default.rules has been updated, please validate!"
87 fi
88 }
89
90 pkg_setup() {
91 CONFIG_CHECK="~BLK_DEV_BSG ~DEVTMPFS ~!IDE ~INOTIFY_USER ~!SYSFS_DEPRECATED ~!SYSFS_DEPRECATED_V2 ~SIGNALFD ~EPOLL ~FHANDLE ~NET"
92 linux-info_pkg_setup
93
94 # CONFIG_FHANDLE was introduced by 2.6.39
95 local MINKV=2.6.39
96
97 if kernel_is -lt ${MINKV//./ }; then
98 eerror "Your running kernel is too old to run this version of ${P}"
99 eerror "You need to upgrade kernel at least to ${MINKV}"
100 fi
101 }
102
103 src_prepare() {
104 if ! [[ ${PV} = 9999* ]]; then
105 # secure_getenv() disable for non-glibc systems wrt bug #443030
106 if ! [[ $(grep -r secure_getenv * | wc -l) -eq 28 ]]; then
107 eerror "The line count for secure_getenv() failed, see bug #443030"
108 die
109 fi
110 fi
111
112 # backport some patches
113 if [[ -n "${patchset}" ]]; then
114 EPATCH_SUFFIX=patch EPATCH_FORCE=yes epatch
115 fi
116
117 cat <<-EOF > "${T}"/40-gentoo.rules
118 # Gentoo specific floppy and usb groups
119 SUBSYSTEM=="block", KERNEL=="fd[0-9]", GROUP="floppy"
120 SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="usb"
121 EOF
122
123 # change rules back to group uucp instead of dialout for now wrt #454556
124 sed -i -e 's/GROUP="dialout"/GROUP="uucp"/' rules/*.rules || die
125
126 # apply user patches
127 epatch_user
128
129 if [[ ! -e configure ]]; then
130 if use doc; then
131 gtkdocize --docdir docs || die "gtkdocize failed"
132 else
133 echo 'EXTRA_DIST =' > docs/gtk-doc.make
134 fi
135 eautoreconf
136 else
137 check_default_rules
138 elibtoolize
139 fi
140
141 # Restore possibility of running --enable-static wrt #472608
142 sed -i \
143 -e '/--enable-static is not supported by systemd/s:as_fn_error:echo:' \
144 configure || die
145
146 if ! use elibc_glibc; then #443030
147 echo '#define secure_getenv(x) NULL' >> config.h.in
148 sed -i -e '/error.*secure_getenv/s:.*:#define secure_getenv(x) NULL:' src/shared/missing.h || die
149 fi
150 }
151
152 multilib_src_configure() {
153 tc-export CC #463846
154 export cc_cv_CFLAGS__flto=no #502950
155
156 # Keep sorted by ./configure --help and only pass --disable flags
157 # when *required* to avoid external deps or unnecessary compile
158 local econf_args
159 econf_args=(
160 ac_cv_search_cap_init=
161 --libdir=/usr/$(get_libdir)
162 --docdir=/usr/share/doc/${PF}
163 --disable-nls
164 --disable-python-devel
165 --disable-dbus
166 --disable-seccomp
167 --disable-xz
168 --disable-pam
169 --disable-gcrypt
170 --disable-audit
171 --disable-libcryptsetup
172 --disable-qrencode
173 --disable-microhttpd
174 --disable-gnutls
175 --disable-readahead
176 --disable-quotacheck
177 --disable-logind
178 --disable-polkit
179 --disable-nls
180 --disable-myhostname
181 $(use_enable gudev)
182 --enable-split-usr
183 --with-html-dir=/usr/share/doc/${PF}/html
184 --without-python
185 --with-bashcompletiondir="$(get_bashcompdir)"
186 --with-rootprefix=
187 )
188 # Use pregenerated copies when possible wrt #480924
189 if ! [[ ${PV} = 9999* ]]; then
190 econf_args+=(
191 --disable-manpages
192 )
193 fi
194 if multilib_is_native_abi; then
195 econf_args+=(
196 $(use_enable static-libs static)
197 $(use_enable doc gtk-doc)
198 $(use_enable introspection)
199 $(use_enable acl)
200 $(use_enable kmod)
201 $(use_enable selinux)
202 --with-rootlibdir=/$(get_libdir)
203 )
204 else
205 econf_args+=(
206 --disable-static
207 --disable-gtk-doc
208 --disable-introspection
209 --disable-acl
210 --disable-kmod
211 --disable-selinux
212 --disable-manpages
213 --with-rootlibdir=/usr/$(get_libdir)
214 )
215 fi
216 use firmware-loader && econf_args+=( --with-firmware-path="/lib/firmware/updates:/lib/firmware" )
217
218 ECONF_SOURCE=${S} econf "${econf_args[@]}"
219 }
220
221 multilib_src_compile() {
222 echo 'BUILT_SOURCES: $(BUILT_SOURCES)' > "${T}"/Makefile.extra
223 emake -f Makefile -f "${T}"/Makefile.extra BUILT_SOURCES
224
225 # Most of the parallel build problems were solved by >=sys-devel/make-3.82-r4,
226 # but not everything -- separate building of the binaries as a workaround,
227 # which will force internal libraries required for the helpers to be built
228 # early enough, like eg. libsystemd-shared.la
229 if multilib_is_native_abi; then
230 local lib_targets=( libudev.la )
231 use gudev && lib_targets+=( libgudev-1.0.la )
232 emake "${lib_targets[@]}"
233
234 local exec_targets=(
235 systemd-udevd
236 udevadm
237 )
238 emake "${exec_targets[@]}"
239
240 local helper_targets=(
241 ata_id
242 cdrom_id
243 collect
244 scsi_id
245 v4l_id
246 accelerometer
247 mtd_probe
248 )
249 emake "${helper_targets[@]}"
250
251 if [[ ${PV} = 9999* ]]; then
252 local man_targets=(
253 man/systemd.link.5
254 man/udev.7
255 man/udevadm.8
256 man/systemd-udevd.service.8
257 )
258 emake "${man_targets[@]}"
259 fi
260
261 if use doc; then
262 emake -C docs/libudev
263 use gudev && emake -C docs/gudev
264 fi
265 else
266 local lib_targets=( libudev.la )
267 use gudev && lib_targets+=( libgudev-1.0.la )
268 emake "${lib_targets[@]}"
269 fi
270 }
271
272 multilib_src_install() {
273 if multilib_is_native_abi; then
274 local lib_LTLIBRARIES="libudev.la" \
275 pkgconfiglib_DATA="src/libudev/libudev.pc"
276
277 local targets=(
278 install-libLTLIBRARIES
279 install-includeHEADERS
280 install-libgudev_includeHEADERS
281 install-rootbinPROGRAMS
282 install-rootlibexecPROGRAMS
283 install-udevlibexecPROGRAMS
284 install-dist_udevconfDATA
285 install-dist_udevrulesDATA
286 install-girDATA
287 install-pkgconfiglibDATA
288 install-sharepkgconfigDATA
289 install-typelibsDATA
290 install-dist_docDATA
291 libudev-install-hook
292 install-directories-hook
293 install-dist_bashcompletionDATA
294 install-dist_networkDATA
295 )
296
297 if use gudev; then
298 lib_LTLIBRARIES+=" libgudev-1.0.la"
299 pkgconfiglib_DATA+=" src/gudev/gudev-1.0.pc"
300 fi
301
302 # add final values of variables:
303 targets+=(
304 rootlibexec_PROGRAMS=systemd-udevd
305 rootbin_PROGRAMS=udevadm
306 lib_LTLIBRARIES="${lib_LTLIBRARIES}"
307 pkgconfiglib_DATA="${pkgconfiglib_DATA}"
308 INSTALL_DIRS='$(sysconfdir)/udev/rules.d \
309 $(sysconfdir)/udev/hwdb.d \
310 $(sysconfdir)/systemd/network'
311 dist_bashcompletion_DATA="shell-completion/bash/udevadm"
312 dist_network_DATA="network/99-default.link"
313 )
314 emake -j1 DESTDIR="${D}" "${targets[@]}"
315
316 if use doc; then
317 emake -C docs/libudev DESTDIR="${D}" install
318 use gudev && emake -C docs/gudev DESTDIR="${D}" install
319 fi
320
321 if [[ ${PV} = 9999* ]]; then
322 doman man/{systemd.link.5,udev.7,udevadm.8,systemd-udevd.service.8}
323 else
324 doman "${S}"/man/{systemd.link.5,udev.7,udevadm.8,systemd-udevd.service.8}
325 fi
326 else
327 local lib_LTLIBRARIES="libudev.la" \
328 pkgconfiglib_DATA="src/libudev/libudev.pc" \
329 include_HEADERS="src/libudev/libudev.h"
330
331 local targets=(
332 install-libLTLIBRARIES
333 install-includeHEADERS
334 install-pkgconfiglibDATA
335 )
336
337 if use gudev; then
338 lib_LTLIBRARIES+=" libgudev-1.0.la"
339 pkgconfiglib_DATA+=" src/gudev/gudev-1.0.pc"
340 fi
341
342 targets+=(
343 lib_LTLIBRARIES="${lib_LTLIBRARIES}"
344 pkgconfiglib_DATA="${pkgconfiglib_DATA}"
345 include_HEADERS="${include_HEADERS}"
346 )
347 emake -j1 DESTDIR="${D}" "${targets[@]}"
348 fi
349 }
350
351 multilib_src_install_all() {
352 dodoc TODO
353
354 prune_libtool_files --all
355 rm -f \
356 "${D}"/lib/udev/rules.d/99-systemd.rules \
357 "${D}"/usr/share/doc/${PF}/{LICENSE.*,GVARIANT-SERIALIZATION,DIFFERENCES,PORTING-DBUS1,sd-shutdown.h}
358
359 # see src_prepare() for content of 40-gentoo.rules
360 insinto /lib/udev/rules.d
361 doins "${T}"/40-gentoo.rules
362
363 # maintainer note: by not letting the upstream build-sys create the .so
364 # link, you also avoid a parallel make problem
365 mv "${D}"/usr/share/man/man8/systemd-udevd{.service,}.8
366
367 if ! [[ ${PV} = 9999* ]]; then
368 insinto /usr/share/doc/${PF}/html/gudev
369 doins "${S}"/docs/gudev/html/*
370
371 insinto /usr/share/doc/${PF}/html/libudev
372 doins "${S}"/docs/libudev/html/*
373 fi
374 }
375
376 pkg_preinst() {
377 local htmldir
378 for htmldir in gudev libudev; do
379 if [[ -d ${ROOT%/}/usr/share/gtk-doc/html/${htmldir} ]]; then
380 rm -rf "${ROOT%/}"/usr/share/gtk-doc/html/${htmldir}
381 fi
382 if [[ -d ${D}/usr/share/doc/${PF}/html/${htmldir} ]]; then
383 dosym ../../doc/${PF}/html/${htmldir} \
384 /usr/share/gtk-doc/html/${htmldir}
385 fi
386 done
387 }
388
389 pkg_postinst() {
390 mkdir -p "${ROOT%/}"/run
391
392 # "losetup -f" is confused if there is an empty /dev/loop/, Bug #338766
393 # So try to remove it here (will only work if empty).
394 rmdir "${ROOT%/}"/dev/loop 2>/dev/null
395 if [[ -d ${ROOT%/}/dev/loop ]]; then
396 ewarn "Please make sure your remove /dev/loop,"
397 ewarn "else losetup may be confused when looking for unused devices."
398 fi
399
400 local fstab="${ROOT%/}"/etc/fstab dev path fstype rest
401 while read -r dev path fstype rest; do
402 if [[ ${path} == /dev && ${fstype} != devtmpfs ]]; then
403 ewarn "You need to edit your /dev line in ${fstab} to have devtmpfs"
404 ewarn "filesystem. Otherwise udev won't be able to boot."
405 ewarn "See, http://bugs.gentoo.org/453186"
406 fi
407 done < "${fstab}"
408
409 if [[ -d ${ROOT%/}/usr/lib/udev ]]; then
410 ewarn
411 ewarn "Please re-emerge all packages on your system which install"
412 ewarn "rules and helpers in /usr/lib/udev. They should now be in"
413 ewarn "/lib/udev."
414 ewarn
415 ewarn "One way to do this is to run the following command:"
416 ewarn "emerge -av1 \$(qfile -q -S -C /usr/lib/udev)"
417 ewarn "Note that qfile can be found in app-portage/portage-utils"
418 fi
419
420 local old_cd_rules="${ROOT%/}"/etc/udev/rules.d/70-persistent-cd.rules
421 local old_net_rules="${ROOT%/}"/etc/udev/rules.d/70-persistent-net.rules
422 for old_rules in "${old_cd_rules}" "${old_net_rules}"; do
423 if [[ -f ${old_rules} ]]; then
424 ewarn
425 ewarn "File ${old_rules} is from old udev installation but if you still use it,"
426 ewarn "rename it to something else starting with 70- to silence this deprecation"
427 ewarn "warning."
428 fi
429 done
430
431 elog
432 elog "Starting from version >= 197 the new predictable network interface names are"
433 elog "used by default, see:"
434 elog "http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames"
435 elog "http://cgit.freedesktop.org/systemd/systemd/tree/src/udev/udev-builtin-net_id.c"
436 elog
437 elog "Example command to get the information for the new interface name before booting"
438 elog "(replace <ifname> with, for example, eth0):"
439 elog "# udevadm test-builtin net_id /sys/class/net/<ifname> 2> /dev/null"
440 elog
441 elog "You can use either kernel parameter \"net.ifnames=0\", create empty"
442 elog "file /etc/systemd/network/99-default.link, or symlink it to /dev/null"
443 elog "to disable the feature."
444
445 if has_version 'sys-apps/biosdevname'; then
446 ewarn
447 ewarn "You can replace the functionality of sys-apps/biosdevname which has been"
448 ewarn "detected to be installed with the new predictable network interface names."
449 fi
450
451 ewarn
452 ewarn "You need to restart udev as soon as possible to make the upgrade go"
453 ewarn "into effect."
454 ewarn "The method you use to do this depends on your init system."
455 if has_version 'sys-apps/openrc'; then
456 ewarn "For sys-apps/openrc users it is:"
457 ewarn "# /etc/init.d/udev --nodeps restart"
458 fi
459
460 elog
461 elog "For more information on udev on Gentoo, upgrading, writing udev rules, and"
462 elog "fixing known issues visit:"
463 elog "http://wiki.gentoo.org/wiki/Udev"
464 elog "http://wiki.gentoo.org/wiki/Udev/upgrade"
465
466 # If user has disabled 80-net-name-slot.rules using a empty file or a symlink to /dev/null,
467 # do the same for 80-net-setup-link.rules to keep the old behavior
468 local net_move=no
469 local net_name_slot_sym=no
470 local net_rules_path="${ROOT%/}"/etc/udev/rules.d
471 local net_name_slot="${net_rules_path}"/80-net-name-slot.rules
472 local net_setup_link="${net_rules_path}"/80-net-setup-link.rules
473 if [[ ! -e ${net_setup_link} ]]; then
474 [[ -f ${net_name_slot} && $(sed -e "/^#/d" -e "/^\W*$/d" ${net_name_slot} | wc -l) == 0 ]] && net_move=yes
475 if [[ -L ${net_name_slot} && $(readlink ${net_name_slot}) == /dev/null ]]; then
476 net_move=yes
477 net_name_slot_sym=yes
478 fi
479 fi
480 if [[ ${net_move} == yes ]]; then
481 ebegin "Copying ${net_name_slot} to ${net_setup_link}"
482
483 if [[ ${net_name_slot_sym} == yes ]]; then
484 ln -nfs /dev/null "${net_setup_link}"
485 else
486 cp "${net_name_slot}" "${net_setup_link}"
487 fi
488 eend $?
489 fi
490
491 # http://cgit.freedesktop.org/systemd/systemd/commit/rules/50-udev-default.rules?id=3dff3e00e044e2d53c76fa842b9a4759d4a50e69
492 # http://bugs.gentoo.org/246847
493 # http://bugs.gentoo.org/514174
494 enewgroup input
495
496 # Update hwdb database in case the format is changed by udev version.
497 if has_version 'sys-apps/hwids[udev]'; then
498 udevadm hwdb --update --root="${ROOT%/}"
499 # Only reload when we are not upgrading to avoid potential race w/ incompatible hwdb.bin and the running udevd
500 if [[ -z ${REPLACING_VERSIONS} ]]; then
501 # http://cgit.freedesktop.org/systemd/systemd/commit/?id=1fab57c209035f7e66198343074e9cee06718bda
502 if [[ ${ROOT} != "" ]] && [[ ${ROOT} != "/" ]]; then
503 return 0
504 fi
505 udevadm control --reload
506 fi
507 fi
508 }

  ViewVC Help
Powered by ViewVC 1.1.20