summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-apps/iotools')
-rw-r--r--sys-apps/iotools/Manifest2
-rw-r--r--sys-apps/iotools/files/iotools-1.4-cpuid-pic.patch22
-rw-r--r--sys-apps/iotools/files/iotools-1.4-ldflags.patch13
-rw-r--r--sys-apps/iotools/iotools-1.4.ebuild52
-rw-r--r--sys-apps/iotools/iotools-1.5.ebuild54
-rw-r--r--sys-apps/iotools/metadata.xml10
6 files changed, 153 insertions, 0 deletions
diff --git a/sys-apps/iotools/Manifest b/sys-apps/iotools/Manifest
new file mode 100644
index 000000000000..d12e009bef08
--- /dev/null
+++ b/sys-apps/iotools/Manifest
@@ -0,0 +1,2 @@
+DIST iotools-1.4.tar.gz 22217 SHA256 56e7348bb5b91f6b93a9b2759993545575eeb3fa5f9203a9cbb95dad9883807b SHA512 10b5f5c4183fb78900c254359b1d40d681519d4b0a79d10795c44d6f1691d73b93d02ede57cf84b5bac67e6083bc5a0de45c464caccbad8b2127a2c53cd7e94b WHIRLPOOL 808ba3b70c602ff0cdfe38ffcf7c1a3c4ab72cacf977ee8db34049159f20b034b48949f0bd70f1b27436f1183dda5cb677338f80afaf65ba1e1a0ec96a973418
+DIST iotools-1.5.tar.gz 23422 SHA256 3186ba296072f644dda881b78d77e3774b79e8cef3e828fffc947d558b08830d SHA512 d298343ee814c8b7d8404bc6af4050df730e89963a7c53798b3d251e94fd2b13e04c36e6da7ec5fd4126ea3a961be26a937910f791844e1b1d5b7dc5aa638c44 WHIRLPOOL 52d5aedf0ae4ee3257e19a6868f792e54b6ac9d79c0816c934b714811e4da0bc288a7f597098fd9ff2ed65f11cf486db1e2db76c85c0ecde0a095e09f24b2fbe
diff --git a/sys-apps/iotools/files/iotools-1.4-cpuid-pic.patch b/sys-apps/iotools/files/iotools-1.4-cpuid-pic.patch
new file mode 100644
index 000000000000..3fde16c6ca01
--- /dev/null
+++ b/sys-apps/iotools/files/iotools-1.4-cpuid-pic.patch
@@ -0,0 +1,22 @@
+http://code.google.com/p/iotools/issues/detail?id=2
+
+--- a/misc.c
++++ b/misc.c
+@@ -149,8 +149,16 @@ cpuid_inline(int cpu, int function, int index, uint32_t *data)
+ }
+
+ asm volatile (
++#ifdef __i386__
++ "xchg %%ebx, %%esi;" /* save ebx (for PIC) */
++ "cpuid;"
++ "xchg %%esi, %%ebx;" /* restore ebx & pass to caller */
++ : "=S" (data[1]),
++#else
+ "cpuid\n\t"
+- : "=a" (data[0]), "=b" (data[1]), "=c" (data[2]), "=d" (data[3])
++ : "=b" (data[1]),
++#endif
++ "=a" (data[0]), "=c" (data[2]), "=d" (data[3])
+ : "0" (function), "2" (index)
+ : "memory"
+ );
diff --git a/sys-apps/iotools/files/iotools-1.4-ldflags.patch b/sys-apps/iotools/files/iotools-1.4-ldflags.patch
new file mode 100644
index 000000000000..242f6912b69a
--- /dev/null
+++ b/sys-apps/iotools/files/iotools-1.4-ldflags.patch
@@ -0,0 +1,13 @@
+http://code.google.com/p/iotools/issues/detail?id=3
+
+--- a/Makefile
++++ b/Makefile
+@@ -44,7 +44,7 @@ OBJS=$(OBJS_TO_BUILD)
+ all: $(BINARY)
+
+ $(BINARY): $(OBJS) iotools.o Makefile
+- $(CC) $(CFLAGS) -o $@ iotools.o $(OBJS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ iotools.o $(OBJS)
+
+ RUSER ?= root
+ RHOST ?=
diff --git a/sys-apps/iotools/iotools-1.4.ebuild b/sys-apps/iotools/iotools-1.4.ebuild
new file mode 100644
index 000000000000..2a145de079c0
--- /dev/null
+++ b/sys-apps/iotools/iotools-1.4.ebuild
@@ -0,0 +1,52 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils toolchain-funcs
+
+DESCRIPTION="Simple commands to access hardware device registers"
+HOMEPAGE="http://code.google.com/p/iotools/"
+SRC_URI="http://iotools.googlecode.com/files/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="static make-symlinks"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-cpuid-pic.patch
+ epatch "${FILESDIR}"/${P}-ldflags.patch
+ sed -i 's:-Werror::' Makefile || die
+}
+
+src_compile() {
+ emake \
+ CC="$(tc-getCC)" \
+ STATIC=$(usex static 1 0) \
+ IOTOOLS_DEBUG="${CFLAGS}"
+}
+
+src_install() {
+ dosbin iotools
+
+ # Note: This is done manually because invoking the iotools binary
+ # when cross-compiling will likely fail.
+ 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"
+ if ! tc-is-cross-compiler ; then
+ local check_cmds=$(echo $(./iotools --list-cmds 2>/dev/null | grep '^ ' | LC_ALL=C sort))
+ if [[ ${known_cmds} != "${check_cmds:-${known_cmds}}" ]] ; then
+ eerror "known_cmds = ${known_cmds}"
+ eerror "check_cmds = ${check_cmds}"
+ die "need to update known_cmds cache in the ebuild"
+ fi
+ fi
+
+ if use make-symlinks ; then
+ local cmd
+ for cmd in ${known_cmds} ; do
+ dosym iotools /usr/sbin/${cmd}
+ done
+ fi
+}
diff --git a/sys-apps/iotools/iotools-1.5.ebuild b/sys-apps/iotools/iotools-1.5.ebuild
new file mode 100644
index 000000000000..6decae02b896
--- /dev/null
+++ b/sys-apps/iotools/iotools-1.5.ebuild
@@ -0,0 +1,54 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils toolchain-funcs
+
+DESCRIPTION="Simple commands to access hardware device registers"
+HOMEPAGE="http://code.google.com/p/iotools/"
+SRC_URI="http://iotools.googlecode.com/files/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~arm ~ppc x86"
+IUSE="static make-symlinks"
+
+src_prepare() {
+ sed -i 's:-Werror::' Makefile || die
+}
+
+src_compile() {
+ emake \
+ CC="$(tc-getCC)" \
+ STATIC=$(usex static 1 0) \
+ IOTOOLS_DEBUG="${CFLAGS}"
+}
+
+src_install() {
+ dosbin iotools
+
+ # Note: This is done manually because invoking the iotools binary
+ # when cross-compiling will likely fail.
+ local known_cmds="and btr bts busy_loop cmos_read cmos_write cpu_list mem_dump mem_read16 mem_read32 mem_read64 mem_read8 mem_write16 mem_write32 mem_write64 mem_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 runon shl shr smbus_quick smbus_read16 smbus_read8 smbus_readblock smbus_receive_byte smbus_send_byte smbus_write16 smbus_write8 smbus_writeblock xor"
+ case ${ARCH} in
+ amd64|x86) known_cmds+=" cpuid io_read16 io_read32 io_read8 io_write16 io_write32 io_write8 rdmsr rdtsc wrmsr";;
+ esac
+ if ! tc-is-cross-compiler ; then
+ local sorted_cmds=$(echo $(printf '%s\n' ${known_cmds} | LC_ALL=C sort))
+ local check_cmds=$(echo $(./iotools --list-cmds 2>/dev/null | grep '^ ' | LC_ALL=C sort))
+ if [[ ${sorted_cmds} != "${check_cmds:-${sorted_cmds}}" ]] ; then
+ eerror "known_cmds = ${sorted_cmds}"
+ eerror "check_cmds = ${check_cmds}"
+ die "need to update known_cmds cache in the ebuild"
+ fi
+ fi
+
+ if use make-symlinks ; then
+ local cmd
+ for cmd in ${known_cmds} ; do
+ dosym iotools /usr/sbin/${cmd}
+ done
+ fi
+}
diff --git a/sys-apps/iotools/metadata.xml b/sys-apps/iotools/metadata.xml
new file mode 100644
index 000000000000..8c8fbb191c80
--- /dev/null
+++ b/sys-apps/iotools/metadata.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer>
+ <email>vapier@gentoo.org</email>
+</maintainer>
+<use>
+ <flag name='make-symlinks'>Generate sub-command symlinks to iotools -- note that a lot are simple like "xor"</flag>
+</use>
+</pkgmetadata>