# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 95892 2012-07-25 23:03:30Z ryandesign@macports.org $

PortSystem          1.0

name                cputhrottle
#can't find any designated version number, so we'll use its release date
version             20100515
categories          sysutils
platforms           darwin
maintainers         nomaintainer

description         a tool to for throttling process cpu usage

long_description    Cputhrottle is a tool which allows cpu usage to be \
                    limited on a per-PID basis.

homepage            http://www.willnolan.com/cputhrottle/cputhrottle.html
master_sites        http://www.willnolan.com/cputhrottle/
distname            ${name}
dist_subdir         ${name}/${version}

checksums           md5     21b8c53310111dabe4d6b58cc702deb6 \
                    sha1    e88c7264cb09399f2e4c54f9d10978ffbb99078b \
                    rmd160  4fc0e11712e6fd308c955d821091c9bd2188b720

depends_build       port:boost

use_configure       no

variant universal {}

# For some reason this makefile expects "CC" to be a C++ compiler
build.args-append   CC="${configure.cxx} [get_canonical_archflags cxx]" \
                    BOOST_ROOT=${prefix} \
                    BOOST_INCLUDES=${prefix}/include

destroot {
    xinstall -W ${worksrcpath} cputhrottle ${destroot}${prefix}/bin
}

notes "
${name} must be run as root, i.e.

sudo cputhrottle <pid> <percentage>

For example:

sudo cputhrottle 328 25

would limit process ID 328 to a maximum of 25% CPU usage.
"
