eudev-4.9999.ebuild 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="5"
  4. KV_min=2.6.39
  5. inherit autotools eutils linux-info multilib multilib-minimal user
  6. if [[ ${PV} = 4.9999* ]]; then
  7. EGIT_REPO_URI="git://github.com/gentoo/eudev.git"
  8. EGIT_BRANCH="eudev-4"
  9. inherit git-r3
  10. else
  11. SRC_URI="https://dev.gentoo.org/~blueness/${PN}/${P}.tar.gz"
  12. #KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
  13. KEYWORDS=""
  14. fi
  15. DESCRIPTION="Linux dynamic and persistent device naming support (aka userspace devfs)"
  16. HOMEPAGE="https://github.com/gentoo/eudev"
  17. LICENSE="LGPL-2.1 GPL-2"
  18. SLOT="0"
  19. IUSE="+blkid efi +hwdb +kmod selinux smack test"
  20. COMMON_DEPEND=">=sys-apps/util-linux-2.20
  21. kmod? ( >=sys-apps/kmod-16 )
  22. selinux? ( >=sys-libs/libselinux-2.1.9 )
  23. !<sys-libs/glibc-2.11
  24. !sys-apps/gentoo-systemd-integration
  25. !sys-apps/systemd
  26. abi_x86_32? (
  27. !<=app-emulation/emul-linux-x86-baselibs-20130224-r7
  28. !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
  29. )"
  30. DEPEND="${COMMON_DEPEND}
  31. dev-util/gperf
  32. virtual/os-headers
  33. virtual/pkgconfig
  34. >=sys-devel/make-3.82-r4
  35. >=sys-kernel/linux-headers-${KV_min}
  36. >=dev-util/intltool-0.50
  37. test? ( app-text/tree dev-lang/perl )"
  38. RDEPEND="${COMMON_DEPEND}
  39. !<sys-fs/lvm2-2.02.103
  40. !<sec-policy/selinux-base-2.20120725-r10
  41. !sys-fs/udev
  42. !sys-apps/systemd"
  43. PDEPEND=">=sys-fs/udev-init-scripts-26
  44. hwdb? ( >=sys-apps/hwids-20140304[udev] )"
  45. # The multilib-build.eclass doesn't handle situation where the installed headers
  46. # are different in ABIs. In this case, we install libgudev headers in native
  47. # ABI but not for non-native ABI.
  48. multilib_check_headers() { :; }
  49. pkg_pretend() {
  50. ewarn
  51. ewarn "As of 2013-01-29, ${P} provides the new interface renaming functionality,"
  52. ewarn "as described in the URL below:"
  53. ewarn "https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames"
  54. ewarn
  55. ewarn "This functionality is enabled BY DEFAULT because eudev has no means of synchronizing"
  56. ewarn "between the default or user-modified choice of sys-fs/udev. If you wish to disable"
  57. ewarn "this new iface naming, please be sure that /etc/udev/rules.d/80-net-name-slot.rules"
  58. ewarn "exists: touch /etc/udev/rules.d/80-net-name-slot.rules"
  59. ewarn
  60. }
  61. pkg_setup() {
  62. CONFIG_CHECK="~BLK_DEV_BSG ~DEVTMPFS ~!IDE ~INOTIFY_USER ~!SYSFS_DEPRECATED ~!SYSFS_DEPRECATED_V2 ~SIGNALFD ~EPOLL ~FHANDLE ~NET ~UNIX"
  63. linux-info_pkg_setup
  64. get_running_version
  65. # These are required kernel options, but we don't error out on them
  66. # because you can build under one kernel and run under another.
  67. if kernel_is lt ${KV_min//./ }; then
  68. ewarn
  69. ewarn "Your current running kernel version ${KV_FULL} is too old to run ${P}."
  70. ewarn "Make sure to run udev under kernel version ${KV_min} or above."
  71. ewarn
  72. fi
  73. }
  74. src_prepare() {
  75. # change rules back to group uucp instead of dialout for now
  76. sed -e 's/GROUP="dialout"/GROUP="uucp"/' -i rules/*.rules \
  77. || die "failed to change group dialout to uucp"
  78. epatch_user
  79. eautoreconf
  80. }
  81. multilib_src_configure() {
  82. tc-export CC #463846
  83. export cc_cv_CFLAGS__flto=no #502950
  84. # Keep sorted by ./configure --help and only pass --disable flags
  85. # when *required* to avoid external deps or unnecessary compile
  86. local econf_args
  87. econf_args=(
  88. ac_cv_search_cap_init=
  89. ac_cv_header_sys_capability_h=yes
  90. DBUS_CFLAGS=' '
  91. DBUS_LIBS=' '
  92. --prefix=/
  93. --libdir=/usr/$(get_libdir)
  94. --includedir=/usr/include
  95. --enable-manpages
  96. --disable-hwdb
  97. )
  98. # Only build libudev for non-native_abi, and only install it to libdir,
  99. # that means all options only apply to native_abi
  100. if multilib_is_native_abi; then
  101. econf_args+=(
  102. $(use_enable blkid)
  103. $(use_enable efi)
  104. $(use_enable kmod)
  105. $(use_enable selinux)
  106. $(use_enable smack)
  107. )
  108. else
  109. econf_args+=(
  110. --disable-blkid
  111. --disable-efi
  112. --disable-kmod
  113. --disable-selinux
  114. --disable-smack
  115. )
  116. fi
  117. ECONF_SOURCE="${S}" econf "${econf_args[@]}"
  118. }
  119. #multilib_src_compile() {
  120. # if multilib_is_native_abi; then
  121. # emake
  122. # else
  123. # emake -C src/libudev
  124. # fi
  125. #}
  126. #multilib_src_install() {
  127. # if multilib_is_native_abi; then
  128. # emake DESTDIR="${D}" install
  129. # else
  130. # emake -C src/libudev DESTDIR="${D}" install
  131. # fi
  132. #}
  133. multilib_src_test() {
  134. # make sandbox get out of the way
  135. # these are safe because there is a fake root filesystem put in place,
  136. # but sandbox seems to evaluate the paths of the test i/o instead of the
  137. # paths of the actual i/o that results.
  138. # also only test for native abi
  139. if multilib_is_native_abi; then
  140. addread /sys
  141. addwrite /dev
  142. addwrite /run
  143. default_src_test
  144. fi
  145. }
  146. multilib_src_install_all() {
  147. prune_libtool_files --all
  148. insinto /lib/udev/rules.d
  149. doins "${FILESDIR}"/40-gentoo.rules
  150. }
  151. pkg_postinst() {
  152. mkdir -p "${EROOT}"run
  153. # "losetup -f" is confused if there is an empty /dev/loop/, Bug #338766
  154. # So try to remove it here (will only work if empty).
  155. rmdir "${EROOT}"dev/loop 2>/dev/null
  156. if [[ -d ${EROOT}dev/loop ]]; then
  157. ewarn "Please make sure your remove /dev/loop,"
  158. ewarn "else losetup may be confused when looking for unused devices."
  159. fi
  160. # https://cgit.freedesktop.org/systemd/systemd/commit/rules/50-udev-default.rules?id=3dff3e00e044e2d53c76fa842b9a4759d4a50e69
  161. # https://bugs.gentoo.org/246847
  162. # https://bugs.gentoo.org/514174
  163. enewgroup input
  164. # REPLACING_VERSIONS should only ever have zero or 1 values but in case it doesn't,
  165. # process it as a list. We only care about the zero case (new install) or the case where
  166. # the same version is being re-emerged. If there is a second version, allow it to abort.
  167. local rv rvres=doitnew
  168. for rv in ${REPLACING_VERSIONS} ; do
  169. if [[ ${rvres} == doit* ]]; then
  170. if [[ ${rv%-r*} == ${PV} ]]; then
  171. rvres=doit
  172. else
  173. rvres=${rv}
  174. fi
  175. fi
  176. done
  177. if use hwdb && has_version 'sys-apps/hwids[udev]'; then
  178. udevadm hwdb --update --root="${ROOT%/}"
  179. # https://cgit.freedesktop.org/systemd/systemd/commit/?id=1fab57c209035f7e66198343074e9cee06718bda
  180. # reload database after it has be rebuilt, but only if we are not upgrading
  181. # also pass if we are -9999 since who knows what hwdb related changes there might be
  182. if [[ ${rvres} == doit* ]] && [[ ${ROOT%/} == "" ]] && [[ ${PV} != "9999" ]]; then
  183. udevadm control --reload
  184. fi
  185. fi
  186. if [[ ${rvres} != doitnew ]]; then
  187. ewarn
  188. ewarn "You need to restart eudev as soon as possible to make the"
  189. ewarn "upgrade go into effect:"
  190. ewarn "\t/etc/init.d/udev --nodeps restart"
  191. fi
  192. elog
  193. elog "For more information on eudev on Gentoo, writing udev rules, and"
  194. elog "fixing known issues visit:"
  195. elog " https://www.gentoo.org/doc/en/udev-guide.xml"
  196. elog
  197. }