eudev-3.2.1.ebuild 7.2 KB

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