Summary:	CPU Frequency adjusting daemon.
Summary(ja):	CPU 周波数調整デーモン
Name:		cpuspeed
Version:	1.5
Release:	2%{?_dist_release}
Group:		System Environment/Base
License:	GPLv2+

Vendor: Project Vine
Distribution: Vine Linux
Packager: daisuke, kazutaka


Source0:	cpuspeed-1.5.tar.bz2
Source1:	cpuspeed.init
Source2:	cpuspeed.conf
Source3:	cpuspeed.8
Patch1:         cpuspeed-1.5-Makefile.patch
Patch2:         cpuspeed-1.5-no-affected_cpus-fallback.patch


Buildroot:	%{_tmppath}/%{name}-%{version}-root
BuildRequires: 	automake autoconf util-linux groff gettext
ExclusiveArch:	%{ix86} x86_64 ppc ppc64


%description
cpuspeed is a daemon that dynamically changes the speed
of your processor(s) depending upon its current workload
if it is capable (needs Intel Speedstep, AMD PowerNow!,
or similar support).

%description -l ja
cpuspeed は、システムの現在のワークロードに応じて CPU の速度(周波数)を
動的に変化させるデーモンです。これを利用するには Intel の Speedstep や
AMD のPowerNow! などの省電力機構が必要になります。

%prep
%setup -q

%patch1 -p1 -b .make
%patch2 -p1 -b .ac

%build
rm -rf $RPM_BUILD_ROOT

mkdir -p $RPM_BUILD_ROOT%{_sbindir}
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man8/

make

%install
make DESTDIR=$RPM_BUILD_ROOT install
install -m755 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/cpuspeed
install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/cpuspeed.conf
install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/cpuspeed.conf.dist
install -m644 %{SOURCE3} $RPM_BUILD_ROOT%{_mandir}/man8/cpuspeed.8

%clean
[ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUILD_ROOT;

%files
%defattr(-,root,root)
%doc CHANGES EXAMPLES CONTRIBUTORS FEATURES README USAGE
%{_sbindir}/cpuspeed
%{_sysconfdir}/rc.d/init.d/cpuspeed
%{_sysconfdir}/cpuspeed.conf.dist
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/cpuspeed.conf
%{_mandir}/man8/*

%preun
if [ "$1" = "0" ] ; then
 /sbin/chkconfig --del cpuspeed
fi

%postun
if [ "$1" -ge "1" ]; then
  service cpuspeed condrestart > /dev/null 2>&1 || :
fi

%post
/sbin/chkconfig --add cpuspeed

%triggerpostun -- cpuspeed < 1.5-1
if [ -f /etc/cpuspeed.conf ]; then
  if (! grep -q "GOVERNER=$" /etc/cpuspeed.conf); then
    if [ -f /etc/cpuspeed.conf.dist ]; then
      cp -f /etc/cpuspeed.conf /etc/cpuspeed.conf.rpmsave
      cp -f /etc/cpuspeed.conf.dist /etc/cpuspeed.conf
    fi
  fi
fi


%changelog
* Thu Apr 07 2011 Daisuke SUZUKI <daisuke@linux.or.jp> 1.5-2
- rebuild for Vine 6
- s/BuildPreReq/BuildRequires

* Thu Jun 04 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 1.5-1
- new upstream release
- update cpuspeed.init, cpuspeed.conf
  - use ondemand governor by default.
  - comment out older settings.
- add %%triggerpostun to relpace cpuspeed.conf if upgrade from 
  older (userspace) version.

* Sun Aug 17 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.2.1-3
- fix typo in %%postun
- spec in utf8

* Sun Apr 13 2008 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 1.2.1-2
- update cpuspeed.init & cpuspeed.conf
  - use userspace governor (and cpuspeed daemon) as default
  - set some default values from previous cpuspeed.conf
- add "|| ;" in %%postun script to avoid scriptlet failure 

* Fri Apr 11 2008 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 1.2.1-1
- update Source1&2 (based on fedora development)
- add Patch4 for multicore-workaround (from fedora development)
- apply new versioning policy

* Thu Nov 01 2007 Daisuke SUZUKI <daisuke@linux.or.jp> 1.2.1-0vl7
- add e_powersaver and acpi-cpufreq to driver list.
- change default cpuspeed.conf
  - modify polling interval and threshold to change cpu speed 
    more frequently.

* Sat Nov 18 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.2.1-0vl6
- change default cpuspeed.conf
  - set polling interval to change cpu speed more frequently.
  - set cpu idle percentage threshold.

* Sat Oct 14 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.2.1-0vl5
- do not load cpufreq-nforce2 automatically (<BTS:247>)

* Thu Sep 21 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.2.1-0vl4
- update cpuspeed.init to load cpufreq driver automatically.

* Thu Sep 14 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.2.1-0vl3
- add Patch10 to modify default configuration.
- add Documents to %%files (<BTS:180>)
- restart daemon on upgrade

* Sun Jun 19 2005 Daisuke SUZUKI <daisuke@linux.or.jp> 1.2.1-0vl2
- add Japanese summary and description

* Mon Jun 13 2005 Daisuke SUZUKI <daisuke@linux.or.jp> 1.2.1-0vl1
- initial build for Vine Linux based on FC package.

* Mon May  9 2005 Dave Jones <davej@redhat.com>
- Fix debuginfo generation.

* Wed Apr  6 2005 Dave Jones <davej@redhat.com>
- Don't count nice time as idle time. (#132383)

* Tue Mar  1 2005 Dave Jones <davej@redhat.com>
- Rebuild for gcc4.

* Tue Feb  8 2005 Dave Jones <davej@redhat.com>
- Rebuild with -D_FORTIFY_SOURCE=2

* Fri Feb  4 2005 Dave Jones <davej@redhat.com>
- Enable builds for PPC (#147089)

* Tue Jan 11 2005 Dave Jones <davej@redhat.com>
- Add missing Obsoletes: kernel-utils

* Mon Jan 10 2005 Dave Jones <davej@redhat.com>
- Update to upstream 1.2.1 release.

* Sat Dec 18 2004 Dave Jones <davej@redhat.com>
- Initial packaging, split out from kernel-utils.

