# Copyright 1999-2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 # $Header: $ DESCRIPTION="athcool is a small utility, enabling/disabling Powersaving mode for AMD Athlon/Duron processors." HOMEPAGE="http://members.jcom.home.ne.jp/jacobi/linux/softwares.html" SRC_URI="http://members.jcom.home.ne.jp/jacobi/linux/files/${P}.tar.gz" LICENSE="GPL-2" KEYWORDS="~x86" IUSE="" LINUX_CFG="/usr/src/linux/.config" depend() { sys-apps/pciutils } acpi_check_fail() { eerror "${LINUX_CFG} indicates your kernel was NOT configured" eerror "to support ACPI." ewarn "" ewarn "Powersaving works if your kernel support ACPI (APM not work)," ewarn "because athcool only set/unset \"Disconnect enable when STPGNT detected\"" ewarn "bits in the Northbridge of Chipset." ewarn "To really save power, someone has to send the STPGNT signal when idle." ewarn "This is done by the ACPI subsystem when C2 state enterd." ewarn "" exit 1 } acpi_check() { einfo "checking ${LINUX_CFG}..." if [ ! -f ${LINUX_CFG} ]; then eerror "ERROR: can't read ${LINUX_CFG}" exit 1 fi grep '^CONFIG_ACPI=y' ${LINUX_CFG} || acpi_check_fail grep '^CONFIG_ACPI_BUS=y' ${LINUX_CFG} || acpi_check_fail grep '^CONFIG_ACPI_POWER=y' ${LINUX_CFG} || acpi_check_fail grep '^CONFIG_ACPI_SLEEP=y' ${LINUX_CFG} || acpi_check_fail grep '^CONFIG_ACPI_SYSTEM=y' ${LINUX_CFG} || acpi_check_fail grep '^CONFIG_ACPI_PROCESSOR=y' ${LINUX_CFG} || acpi_check_fail einfo "${LINUX_CFG} indicates your kernel supports ACPI. good." } src_unpack() { acpi_check unpack ${A} einfo "patching Makefile to use dynamically linked libpci" sed -i -e 's/\/usr\/lib\/libpci.a/-lpci/' ${S}/Makefile } src_compile() { emake } src_install() { dodoc README exeinto /sbin doexe athcool exeinto /etc/init.d newexe ${FILESDIR}/athcool.init athcool }