iotools-1.4.ebuild 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # Copyright 1999-2013 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="4"
  4. inherit eutils toolchain-funcs
  5. DESCRIPTION="Simple commands to access hardware device registers"
  6. HOMEPAGE="https://code.google.com/p/iotools/"
  7. SRC_URI="https://iotools.googlecode.com/files/${P}.tar.gz"
  8. LICENSE="GPL-2"
  9. SLOT="0"
  10. KEYWORDS="~amd64 ~x86"
  11. IUSE="static make-symlinks"
  12. src_prepare() {
  13. epatch "${FILESDIR}"/${P}-cpuid-pic.patch
  14. epatch "${FILESDIR}"/${P}-ldflags.patch
  15. sed -i 's:-Werror::' Makefile || die
  16. }
  17. src_compile() {
  18. emake \
  19. CC="$(tc-getCC)" \
  20. STATIC=$(usex static 1 0) \
  21. IOTOOLS_DEBUG="${CFLAGS}"
  22. }
  23. src_install() {
  24. dosbin iotools
  25. # Note: This is done manually because invoking the iotools binary
  26. # when cross-compiling will likely fail.
  27. local known_cmds="and btr bts busy_loop cmos_read cmos_write cpu_list cpuid io_read16 io_read32 io_read8 io_write16 io_write32 io_write8 mmio_dump mmio_read16 mmio_read32 mmio_read64 mmio_read8 mmio_write16 mmio_write32 mmio_write64 mmio_write8 not or pci_list pci_read16 pci_read32 pci_read8 pci_write16 pci_write32 pci_write8 rdmsr rdtsc runon shl shr smbus_quick smbus_read16 smbus_read8 smbus_readblock smbus_receive_byte smbus_send_byte smbus_write16 smbus_write8 smbus_writeblock wrmsr xor"
  28. if ! tc-is-cross-compiler ; then
  29. local check_cmds=$(echo $(./iotools --list-cmds 2>/dev/null | grep '^ ' | LC_ALL=C sort))
  30. if [[ ${known_cmds} != "${check_cmds:-${known_cmds}}" ]] ; then
  31. eerror "known_cmds = ${known_cmds}"
  32. eerror "check_cmds = ${check_cmds}"
  33. die "need to update known_cmds cache in the ebuild"
  34. fi
  35. fi
  36. if use make-symlinks ; then
  37. local cmd
  38. for cmd in ${known_cmds} ; do
  39. dosym iotools /usr/sbin/${cmd}
  40. done
  41. fi
  42. }