# 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" PROC_CFG="/proc/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 will not work)," ewarn "because athcool will only set/unset the \"Disconnect enable when" ewarn "STPGNT detected\"" bit in the Northbridge of your 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 for ${PROC_CFG}..." if [ -f ${PROC_CFG} ]; then einfo "${PROC_CFG} found, using this." LINUX_CFG=${PROC_CFG} else einfo "${PROC_CFG} not found, trying ${LINUX_CFG}." ewarn "this can misindicate your configuration, if this is not the" ewarn "configuration for your currently running kernel." fi 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 }