eudev-3.1.2.ebuild 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  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} = 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 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="doc gudev +hwdb +kmod introspection selinux static-libs test"
  18. COMMON_DEPEND=">=sys-apps/util-linux-2.20
  19. gudev? ( >=dev-libs/glib-2.34.3:2[${MULTILIB_USEDEP}] )
  20. introspection? ( >=dev-libs/gobject-introspection-1.38 )
  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. doc? ( >=dev-util/gtk-doc-1.18
  37. app-text/docbook-xml-dtd:4.2
  38. app-text/docbook-xml-dtd:4.5
  39. app-text/docbook-xsl-stylesheets
  40. dev-libs/libxslt
  41. )
  42. >=dev-util/intltool-0.50
  43. test? ( app-text/tree dev-lang/perl )"
  44. RDEPEND="${COMMON_DEPEND}
  45. !<sys-fs/lvm2-2.02.103
  46. !<sec-policy/selinux-base-2.20120725-r10
  47. !sys-fs/udev
  48. !sys-apps/systemd
  49. gudev? ( !dev-libs/libgudev )"
  50. PDEPEND=">=sys-fs/udev-init-scripts-26
  51. hwdb? ( >=sys-apps/hwids-20140304[udev] )"
  52. # The multilib-build.eclass doesn't handle situation where the installed headers
  53. # are different in ABIs. In this case, we install libgudev headers in native
  54. # ABI but not for non-native ABI.
  55. multilib_check_headers() { :; }
  56. pkg_pretend() {
  57. ewarn
  58. ewarn "As of 2013-01-29, ${P} provides the new interface renaming functionality,"
  59. ewarn "as described in the URL below:"
  60. ewarn "https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames"
  61. ewarn
  62. ewarn "This functionality is enabled BY DEFAULT because eudev has no means of synchronizing"
  63. ewarn "between the default or user-modified choice of sys-fs/udev. If you wish to disable"
  64. ewarn "this new iface naming, please be sure that /etc/udev/rules.d/80-net-name-slot.rules"
  65. ewarn "exists: touch /etc/udev/rules.d/80-net-name-slot.rules"
  66. ewarn
  67. }
  68. pkg_setup() {
  69. CONFIG_CHECK="~BLK_DEV_BSG ~DEVTMPFS ~!IDE ~INOTIFY_USER ~!SYSFS_DEPRECATED ~!SYSFS_DEPRECATED_V2 ~SIGNALFD ~EPOLL ~FHANDLE ~NET ~UNIX"
  70. linux-info_pkg_setup
  71. get_running_version
  72. # These are required kernel options, but we don't error out on them
  73. # because you can build under one kernel and run under another.
  74. if kernel_is lt ${KV_min//./ }; then
  75. ewarn
  76. ewarn "Your current running kernel version ${KV_FULL} is too old to run ${P}."
  77. ewarn "Make sure to run udev under kernel version ${KV_min} or above."
  78. ewarn
  79. fi
  80. }
  81. src_prepare() {
  82. # change rules back to group uucp instead of dialout for now
  83. sed -e 's/GROUP="dialout"/GROUP="uucp"/' -i rules/*.rules \
  84. || die "failed to change group dialout to uucp"
  85. epatch_user
  86. if use doc; then
  87. gtkdocize --docdir docs || die "gtkdocize failed"
  88. else
  89. echo 'EXTRA_DIST =' > docs/gtk-doc.make
  90. fi
  91. eautoreconf
  92. }
  93. multilib_src_configure() {
  94. tc-export CC #463846
  95. export cc_cv_CFLAGS__flto=no #502950
  96. # Keep sorted by ./configure --help and only pass --disable flags
  97. # when *required* to avoid external deps or unnecessary compile
  98. local econf_args
  99. econf_args=(
  100. ac_cv_search_cap_init=
  101. ac_cv_header_sys_capability_h=yes
  102. DBUS_CFLAGS=' '
  103. DBUS_LIBS=' '
  104. --with-rootprefix=
  105. --with-rootrundir=/run
  106. --docdir=/usr/share/doc/${PF}
  107. --libdir=/usr/$(get_libdir)
  108. --with-rootlibexecdir=/lib/udev
  109. --with-html-dir="/usr/share/doc/${PF}/html"
  110. --enable-split-usr
  111. --enable-manpages
  112. --disable-hwdb
  113. --exec-prefix=/
  114. $(use_enable gudev)
  115. )
  116. # Only build libudev for non-native_abi, and only install it to libdir,
  117. # that means all options only apply to native_abi
  118. if multilib_is_native_abi; then
  119. econf_args+=(
  120. --with-rootlibdir=/$(get_libdir)
  121. $(use_enable doc gtk-doc)
  122. $(use_enable introspection)
  123. $(use_enable kmod)
  124. $(use_enable static-libs static)
  125. $(use_enable selinux)
  126. )
  127. else
  128. econf_args+=(
  129. --disable-static
  130. --disable-gtk-doc
  131. --disable-introspection
  132. --disable-kmod
  133. --disable-selinux
  134. )
  135. fi
  136. ECONF_SOURCE="${S}" econf "${econf_args[@]}"
  137. }
  138. multilib_src_compile() {
  139. if multilib_is_native_abi; then
  140. emake
  141. else
  142. emake -C src/shared
  143. emake -C src/libudev
  144. use gudev && emake -C src/gudev
  145. fi
  146. }
  147. multilib_src_install() {
  148. if multilib_is_native_abi; then
  149. emake DESTDIR="${D}" install
  150. else
  151. emake -C src/libudev DESTDIR="${D}" install
  152. use gudev && emake -C src/gudev DESTDIR="${D}" install
  153. fi
  154. }
  155. multilib_src_test() {
  156. # make sandbox get out of the way
  157. # these are safe because there is a fake root filesystem put in place,
  158. # but sandbox seems to evaluate the paths of the test i/o instead of the
  159. # paths of the actual i/o that results.
  160. # also only test for native abi
  161. if multilib_is_native_abi; then
  162. addread /sys
  163. addwrite /dev
  164. addwrite /run
  165. default_src_test
  166. fi
  167. }
  168. multilib_src_install_all() {
  169. prune_libtool_files --all
  170. rm -rf "${ED}"/usr/share/doc/${PF}/LICENSE.*
  171. insinto /lib/udev/rules.d
  172. doins "${FILESDIR}"/40-gentoo.rules
  173. if ! [[ ${PV} = 9999* ]]; then
  174. insinto /usr/share/doc/${PF}/html/gudev
  175. doins "${S}"/docs/gudev/html/*
  176. insinto /usr/share/doc/${PF}/html/libudev
  177. doins "${S}"/docs/libudev/html/*
  178. fi
  179. }
  180. pkg_preinst() {
  181. local htmldir
  182. for htmldir in gudev libudev; do
  183. if [[ -d ${EROOT}usr/share/gtk-doc/html/${htmldir} ]]; then
  184. rm -rf "${EROOT}"usr/share/gtk-doc/html/${htmldir}
  185. fi
  186. if [[ -d ${ED}/usr/share/doc/${PF}/html/${htmldir} ]]; then
  187. dosym ../../doc/${PF}/html/${htmldir} \
  188. /usr/share/gtk-doc/html/${htmldir}
  189. fi
  190. done
  191. }
  192. pkg_postinst() {
  193. mkdir -p "${EROOT}"run
  194. # "losetup -f" is confused if there is an empty /dev/loop/, Bug #338766
  195. # So try to remove it here (will only work if empty).
  196. rmdir "${EROOT}"dev/loop 2>/dev/null
  197. if [[ -d ${EROOT}dev/loop ]]; then
  198. ewarn "Please make sure your remove /dev/loop,"
  199. ewarn "else losetup may be confused when looking for unused devices."
  200. fi
  201. # https://cgit.freedesktop.org/systemd/systemd/commit/rules/50-udev-default.rules?id=3dff3e00e044e2d53c76fa842b9a4759d4a50e69
  202. # https://bugs.gentoo.org/246847
  203. # https://bugs.gentoo.org/514174
  204. enewgroup input
  205. # REPLACING_VERSIONS should only ever have zero or 1 values but in case it doesn't,
  206. # process it as a list. We only care about the zero case (new install) or the case where
  207. # the same version is being re-emerged. If there is a second version, allow it to abort.
  208. local rv rvres=doitnew
  209. for rv in ${REPLACING_VERSIONS} ; do
  210. if [[ ${rvres} == doit* ]]; then
  211. if [[ ${rv%-r*} == ${PV} ]]; then
  212. rvres=doit
  213. else
  214. rvres=${rv}
  215. fi
  216. fi
  217. done
  218. if use hwdb && has_version 'sys-apps/hwids[udev]'; then
  219. udevadm hwdb --update --root="${ROOT%/}"
  220. # https://cgit.freedesktop.org/systemd/systemd/commit/?id=1fab57c209035f7e66198343074e9cee06718bda
  221. # reload database after it has be rebuilt, but only if we are not upgrading
  222. # also pass if we are -9999 since who knows what hwdb related changes there might be
  223. if [[ ${rvres} == doit* ]] && [[ ${ROOT%/} == "" ]] && [[ ${PV} != "9999" ]]; then
  224. udevadm control --reload
  225. fi
  226. fi
  227. if [[ ${rvres} != doitnew ]]; then
  228. ewarn
  229. ewarn "You need to restart eudev as soon as possible to make the"
  230. ewarn "upgrade go into effect:"
  231. ewarn "\t/etc/init.d/udev --nodeps restart"
  232. fi
  233. elog
  234. elog "For more information on eudev on Gentoo, writing udev rules, and"
  235. elog "fixing known issues visit:"
  236. elog " https://www.gentoo.org/doc/en/udev-guide.xml"
  237. elog
  238. }