hwids-20160421.ebuild 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit udev eutils
  5. DESCRIPTION="Hardware (PCI, USB, OUI, IAB) IDs databases"
  6. HOMEPAGE="https://github.com/gentoo/hwids"
  7. if [[ ${PV} == "99999999" ]]; then
  8. EGIT_REPO_URI="${HOMEPAGE}.git"
  9. inherit git-2
  10. else
  11. SRC_URI="${HOMEPAGE}/archive/${P}.tar.gz"
  12. KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux"
  13. fi
  14. LICENSE="|| ( GPL-2 BSD ) public-domain"
  15. SLOT="0"
  16. IUSE="+net +pci +udev +usb"
  17. DEPEND="udev? (
  18. dev-lang/perl
  19. >=virtual/udev-206
  20. )"
  21. [[ ${PV} == "99999999" ]] && DEPEND+=" udev? ( net-misc/curl )"
  22. RDEPEND="!<sys-apps/pciutils-3.1.9-r2
  23. !<sys-apps/usbutils-005-r1"
  24. S=${WORKDIR}/hwids-${P}
  25. src_prepare() {
  26. [[ ${PV} == "99999999" ]] && emake fetch
  27. sed -i -e '/udevadm hwdb/d' Makefile || die
  28. # Create a rules file compatible with older udev.
  29. sed -e 's/evdev:name/keyboard:name/' \
  30. -e 's/evdev:atkbd:dmi/keyboard:dmi/' \
  31. -e 's/evdev:input:b\([^v]*\)v\([^p]*\)p\([^e]*\)\(e.*\)\?/keyboard:usb:v\2p\3/' \
  32. -e 's/keyboard:usb:v046DpC52D\*/keyboard:usb:v046DpC52Dd*dc*dsc*dp*ic*isc*ip*in00*/' \
  33. -e 's/keyboard:usb:v0458p0708\*/keyboard:usb:v0458p0708d*dc*dsc*dp*ic*isc*ip*in01*/' \
  34. udev/60-keyboard.hwdb > udev/61-oldkeyboard.hwdb || die
  35. }
  36. _emake() {
  37. emake \
  38. NET=$(usex net) \
  39. PCI=$(usex pci) \
  40. UDEV=$(usex udev) \
  41. USB=$(usex usb) \
  42. "$@"
  43. }
  44. src_compile() {
  45. _emake
  46. }
  47. src_install() {
  48. _emake install \
  49. DOCDIR="${EPREFIX}/usr/share/doc/${PF}" \
  50. MISCDIR="${EPREFIX}/usr/share/misc" \
  51. HWDBDIR="${EPREFIX}$(get_udevdir)/hwdb.d" \
  52. DESTDIR="${D}"
  53. }
  54. pkg_postinst() {
  55. if use udev; then
  56. udevadm hwdb --update --root="${ROOT%/}"
  57. # https://cgit.freedesktop.org/systemd/systemd/commit/?id=1fab57c209035f7e66198343074e9cee06718bda
  58. [ "${ROOT:-/}" = "/" ] && udevadm control --reload
  59. fi
  60. }