razercfg-0.32.ebuild 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. # Copyright 1999-2015 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. PYTHON_COMPAT=( python3_4 )
  5. inherit cmake-utils multilib eutils udev python-single-r1
  6. DESCRIPTION="Utility for advanced configuration of Razer mice (DeathAdder, Krait, Lachesis)"
  7. HOMEPAGE="http://bues.ch/cms/hacking/razercfg.html"
  8. SRC_URI="http://bues.ch/${PN}/${P}.tar.bz2"
  9. LICENSE="GPL-2"
  10. SLOT="0"
  11. KEYWORDS="~amd64 ~x86"
  12. IUSE="+pm-utils qt4 systemd +udev"
  13. RDEPEND="qt4? ( >=dev-python/pyside-1.2.1[${PYTHON_USEDEP}] )
  14. systemd? ( sys-apps/systemd )
  15. udev? ( virtual/udev )
  16. pm-utils? ( sys-power/pm-utils )
  17. virtual/libusb:1"
  18. DEPEND="virtual/pkgconfig
  19. dev-python/setuptools[${PYTHON_USEDEP}]
  20. virtual/libusb:1"
  21. src_prepare() {
  22. sed -i \
  23. -e '/udevadm control/{N;d}' \
  24. -e '/systemctl/{N;d}' \
  25. -e "s:/etc/pm/sleep.d:/usr/$(get_libdir)/pm-utils/sleep.d/:" \
  26. -e 's:50-razer:80razer:' \
  27. CMakeLists.txt \
  28. || die "sed failed"
  29. sed -i \
  30. -e '/ldconfig/{N;d}' \
  31. -e "s:DESTINATION lib:DESTINATION $(get_libdir):" \
  32. librazer/CMakeLists.txt \
  33. || die "sed failed"
  34. }
  35. src_configure() {
  36. mycmakeargs="${mycmakeargs} -DPYTHON='${PYTHON}'"
  37. cmake-utils_src_configure
  38. }
  39. src_install() {
  40. cmake-utils_src_install
  41. newinitd "${FILESDIR}"/razerd.init.d-r2 razerd
  42. dodoc README razer.conf
  43. if ! use qt4; then
  44. rm "${D}"/usr/bin/qrazercfg
  45. else
  46. make_desktop_entry qrazercfg "Razer Mouse Settings" mouse "Qt;Settings"
  47. fi
  48. use pm-utils || rm "${D}"/usr/$(get_libdir)/pm-utils/sleep.d/80razer
  49. }
  50. pkg_postinst() {
  51. use udev && udevadm control --reload-rules && udevadm trigger --subsystem-match=usb
  52. if [[ -e "${ROOT}"usr/bin/pyrazer.pyc ]]; then
  53. echo
  54. eerror "A stale ${ROOT}usr/bin/pyrazer.pyc exists and will prevent"
  55. eerror "the Python frontends from working until removed manually."
  56. echo
  57. fi
  58. }