Name:           cpu-g
Version:        0.9.0
Release:        1%{?_dist_release}
Summary:        shows useful information about your hardware
Summary(ja):    お使いのハードウェアに関する有用な情報を表示します

Group:          Applications/System
License:        GPLv3
URL:            http://sourceforge.net/projects/cpug/
Source0:        %{name}-%{version}.tar.gz

BuildRoot:      %{_tmppath}/%{name}-%{version}-root

Requires:       pygtk2 >= 2.10.0
Requires:       pygtk2-libglade
Requires:       gtk2 >= 2.10.0

%description
CPU-G is an application that shows useful information
about your hardware. It collects and displays information
about your CPU, RAM, Motherboard, some general information
about your system and more. 

%description -l ja
CPU-Gは、お使いのハードウェアに関する有用な情報を表示するアプリケーションです。
CPU・RAM・マザーボード、ほかいくつかの一般的情報を収集し、表示します。


%prep
%setup -q -n %{name}-%{version}

# change CPU/Vendor images path
sed -i 's|data/logos/|/usr/share/cpu-g/logos/|g' %{name}

# change cpu-g.glade path
sed -i 's|self.gladefile = "cpu-g.glade"|self.gladefile = "/usr/share/cpu-g/cpu-g.glade"|g' \
       %{name}

# change application icon path
sed -i 's|data/cpu-g.png|/usr/share/pixmaps/cpu-g.png|g' %{name}.glade

# change application icon path
sed -i 's|data/cpu-g.png|/usr/share/pixmaps/cpu-g.png|g' data/%{name}.desktop

%build

%install
rm -rf $RPM_BUILD_ROOT

mkdir -p $RPM_BUILD_ROOT%{_bindir}
install -m 755 %{name} $RPM_BUILD_ROOT%{_bindir}

mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name}
install -m 644 %{name}.glade $RPM_BUILD_ROOT%{_datadir}/%{name}/

mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications/
install -m 644 data/%{name}.desktop $RPM_BUILD_ROOT%{_datadir}/applications/

mkdir -p $RPM_BUILD_ROOT%{_datadir}/pixmaps/
install -m 644 data/%{name}.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/

mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name}/logos/
install -m 644 data/logos/*.png $RPM_BUILD_ROOT%{_datadir}/%{name}/logos/

mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1/
install -m 644 doc/%{name}.1 $RPM_BUILD_ROOT%{_mandir}/man1/

%clean
rm -rf $RPM_BUILD_ROOT

%post
touch --no-create %{_datadir}/icons/hicolor || :
%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
update-desktop-database > /dev/null 2>&1 || :

%postun
touch --no-create %{_datadir}/icons/hicolor || :
%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
update-desktop-database > /dev/null 2>&1 || :

%files
%defattr(-,root,root,-)
%doc COPYING README
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/%{name}/%{name}.glade
%{_datadir}/pixmaps/*
%{_datadir}/%{name}/logos/*
%{_mandir}/man1/*

%changelog
* Sat Jan 30 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.9.0-1
- initial build for VineLinux
