libudev-zero-1.0.3.ebuild 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. # Copyright 2021-2024 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=8
  4. inherit multilib-minimal toolchain-funcs
  5. DESCRIPTION="Daemonless replacement for libudev"
  6. HOMEPAGE="https://github.com/illiliti/libudev-zero"
  7. SRC_URI="
  8. https://github.com/illiliti/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz
  9. "
  10. LICENSE="ISC"
  11. SLOT="0/$(ver_cut 1)"
  12. KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
  13. DEPEND="
  14. !sys-apps/systemd-utils[udev]
  15. "
  16. RDEPEND="${DEPEND}"
  17. IUSE="+hotplug static static-libs"
  18. cc_info() {
  19. tc-export_build_env
  20. local cflags=(
  21. ${BUILD_CFLAGS}
  22. ${BUILD_LDFLAGS}
  23. ${BUILD_CPPFLAGS}
  24. )
  25. set -- "$(tc-getCC)" "${cflags[@]}" "${@}"
  26. einfo "${*}"
  27. "${@}"
  28. }
  29. src_prepare() {
  30. default
  31. use static-libs || {
  32. sed -i Makefile \
  33. -e '/^all:/s/libudev.a//' \
  34. -e '/^install:/s/\w\+-static//' \
  35. || die
  36. }
  37. multilib_copy_sources
  38. }
  39. multilib_src_compile() {
  40. emake
  41. if use hotplug && multilib_is_native_abi; then
  42. cc_info $(usex static -static '') contrib/helper.c -o "${PN}-helper"
  43. fi
  44. }
  45. multilib_src_install() {
  46. emake install \
  47. DESTDIR="${D}" \
  48. PREFIX="${EPREFIX}/usr" \
  49. LIBDIR="${EPREFIX}/usr/$(get_libdir)"
  50. if use hotplug && multilib_is_native_abi; then
  51. dobin "${PN}-helper"
  52. fi
  53. }
  54. multilib_src_install_all() {
  55. if use hotplug && multilib_is_native_abi; then
  56. insinto "/usr/share/doc/${P}/examples"
  57. sed "s;/path/to/helper;${PN}-helper;g" contrib/mdev.conf \
  58. | newins - mdev.conf
  59. fi
  60. }