%define desktop_file 1
%if %{desktop_file}
%define desktop_file_utils_version 0.2.90
%endif

Summary: An X Window System utility for monitoring system resources.
Summary(ja): X Window System のシステムリソースモニタ
Name: xosview
Version: 1.8.3
Release: 1%{?_dist_release}
Exclusiveos: Linux
Source0: http://prdownloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
URL: http://xosview.sourceforge.net/
Source1: xosview.png
Patch0: xosview-non-i386.patch
Patch1: xosview-io_h.patch
Patch2: xosview-ppc.patch
Patch3: xosview-rpath.patch
Patch5: xosview-1.7.1-s390.patch
Patch6: xosview-1.8.0-proc.patch
Patch7: xosview-1.7.3-gcc3.patch
Patch8: xosview-1.8.0-procstat.patch
Patch9: xosview-1.8.0-strip.patch
License: GPL/BSD
Group: Applications/System
Buildroot: %{_tmppath}/%{name}-%{version}-root
# XXX ia64 needs porting work
ExcludeArch: alpha ia64 sparc

BuildRequires: libX11-devel
%if %{desktop_file}
BuildRequires: desktop-file-utils >= %{desktop_file_utils_version}
%endif

%description
The xosview utility displays a set of bar graphs which show the
current system state, including memory usage, CPU usage, system load,
etc. Xosview runs under the X Window System.

%description -l ja
xosview は,メモリ・CPU の使用率やシステム負荷など,現在のシステムの
状態をグラフで表示するユーティリティです.xosview は X Window System
上で動作します.


%prep
%setup -q
#%patch0 -p0
#%patch1 -p0
#%patch2 -p1 -b .ppc
#%patch3 -p0
#%patch5 -p1 -b .s390
#%patch6 -p1 -b .proc
#%patch7 -p1 -b .gcc3
#%patch8 -p1 -b .procstat
#%patch9 -p1 -b .strip

# --- XXX Cruft Alert!
rm -f linux/*.o

%build
export CXX=g++
%{__cp} /usr/share/libtool/config.* config/
CXXFLAGS="$RPM_OPT_FLAGS -Wno-deprecated -DHAVE_SNPRINTF" %configure --disable-linux-memstat

make all


%install
rm -rf %{buildroot}
mkdir -p %{buildroot}{%{_bindir},%{_mandir}/man1,%{_datadir}/X11/app-defaults} \
         %{buildroot}%{_datadir}/icons

make install PREFIX_TO_USE=$RPM_BUILD_ROOT%{_prefix} \
     XAPPLOADDIR=$RPM_BUILD_ROOT%{_datadir}/X11/app-defaults
install -m 644 %{SOURCE1} %{buildroot}%{_datadir}/icons

chmod u-s %{buildroot}%{_bindir}/*

%if %{desktop_file}
mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications/
desktop="%{buildroot}%{_datadir}/applications/xosview.desktop"
%else
mkdir -p %{buildroot}/etc/X11/applnk/Utilities
desktop="%{buildroot}/etc/X11/applnk/Utilities/xosview.desktop"
%endif
cat > $desktop <<EOF
[Desktop Entry]
Encoding=UTF-8
Categories=Application;System;
name=xosview
Comment=OS resource statistics Viewer
Exec=xosview
Terminal=false
Type=Application
Icon=/usr/share/icons/xosview.png
EOF

%clean
rm -rf %{buildroot}


%files
%defattr(-,root,root,0755)
%doc README* TODO CHANGES
%{_bindir}/xosview
%{_mandir}/man1/*
%{_datadir}/X11/app-defaults/XOsview
%{_datadir}/icons/*
%if %{desktop_file}
%{_datadir}/applications/*
%else
/etc/X11/applnk/Utilities/xosview.desktop
%endif

%changelog
* Thu Jun  5 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.8.3-1
- rebuilt with xorg-x11 7.3
- fixed installed location
- added -DHAVE_SNPRINTF flags to CXXFLAGS
- spec in UTF-8

* Sun May 13 2007 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.8.3-0vl2
- rebuilt with new toolchain

* Mon Jan  8 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.8.3-0vl1
- new upstream release
- changed %desktop_file to 1

* Wed Jul 13 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.8.2-0vl1
- new upstream release, work on kernel 2.6
- dropped Patches (which were merged into upstream)
- added BuildRequires: XOrg-devel

* Thu Mar 20 2003 IWAI Masaharu <iwai@alib.jp> 1.8.0-9vl2
- add README*, TODO and CHANGES in the document directory

* Wed Nov 27 2002 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.8.0-9vl1
- based on 1.8.0-9 from Rawhide and built for Vine Linux
- built with new toolchain environment
- %%define desktop_file 0 for Vine
- the previous Vine version was 1.7.1-2vl5. The changelog was as follows:

  - Fri Mar 15 2002 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.7.1-2vl5
  - rebuilt with glibc > 2.2

  - Wed Jul 18 2001 <sagami@vinelinux.org>
  - 1.7.1-2vl5: use %%{ix86} for _arch instead of i386 :-)

  - Tue Feb 20 2001 Tomoya TAKA <tomoya@olive.plala.or.jp>
  - 1.7.1-2vl4
  - add alpha patch (%%patch1) from Kondara
  - include alpha, again

  - Thu Jan 25 2001 Tomoya TAKA <tomoya@olive.plala.or.jp>
  - 1.7.1-2vl3
  - ExcludeArch: alpha :-P
  - added Japanese summary and description

  - Sun Nov 12 2000 MACHINO, Satoshi <machino@vinelinux.org> 1.7.1-2vl2
  - build on gcc-2.95.3
  - added patch0 for i386
  - partially used rpmmacros

  - Wed Feb 16 2000 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rhythmaning.org>
  - 1.7.1-2vl1
  - modified spec for ppc archtecture

* Tue Sep 17 2002 Than Ngo <than@redhat.com> 1.8.0-9
- Adjust some patch files (bug #74141)

* Sat Aug 10 2002 Elliot Lee <sopwith@redhat.com>
- rebuilt with gcc-3.2 (we hope)

* Wed Jul 24 2002 Than Ngo <than@redhat.com> 1.8.0-7
- desktop file issue (bug #69551)

* Tue Jul 23 2002 Tim Powers <timp@redhat.com> 1.8.0-6
- build using gcc-3.2-0.1

* Fri Jun 21 2002 Tim Powers <timp@redhat.com> 1.8.0-5
- automated rebuild

* Thu Jun 20 2002 Than Ngo <than@redhat.com> 1.8.0-4
- Don't forcibly strip binaries

* Sun Jun 2 2002 Than Ngo <than@redhat.com> 1.8.0-3
- fix a bug in cpumeter (bug #64798)

* Thu May 23 2002 Tim Powers <timp@redhat.com>
- automated rebuild

* Wed Apr 24 2002 Karsten Hopp <karsten@redhat.de> 1.8.0-1
- update to current version
- redo .proc patch
- change URLs

* Fri Feb 22 2002 Than Ngo <than@redhat.com> 1.7.3-10
- rebuild in new environment.

* Wed Jan 09 2002 Tim Powers <timp@redhat.com>
- automated rebuild

* Tue Dec 18 2001 Than Ngo <than@redhat.com> 1.7.3-8
- xosview +net goes into hard loop (bug #57150)
- add patch for building against g++ 3
- use RPM_OPT_FLAG

* Wed Nov 14 2001 Than Ngo <than@redhat.com> 1.7.3-7
- added missing Icon in desktop file
- fixed Url

* Wed Sep 12 2001 Tim Powers <timp@redhat.com>
- rebuild with new gcc and binutils

* Tue Apr 10 2001 Phil Knirsch <pknirsch@redhat.de>
- Fix for s390 patch to actually work

* Tue Mar 20 2001 Preston Brown <pbrown@redhat.com>
- fix up .desktop entry

* Sun Feb 11 2001 Florian La Roche <Florian.LaRoche@redhat.de>
- fix typo

* Sun Feb 11 2001 Florian La Roche <Florian.LaRoche@redhat.de>
- adjusted s390 patches

* Wed Jan 31 2001 Preston Brown <pbrown@redhat.com>
- upgrade to 1.7.3, fixes (#11380)

* Mon Jan 15 2001 Than Ngo <than@redhat.com>
- ported to ibm s/390

* Tue Jul 25 2000 Jeff Johnson <jbj@redhat.com>
- migrate wmconfig to applnk.

* Fri Jul 14 2000 Jeff Johnson <jbj@redhat.com>
- rebuild the auto-rebuild.
- exclude alpha and i164 for now.

* Thu Jul 13 2000 Prospector <bugzilla@redhat.com>
- automatic rebuild

* Tue Jul  2 2000 Jakub Jelinek <jakub@redhat.com>
- Rebuild with new C++

* Fri Jun  2 2000 Jeff Johnson <jbj@redhat.com>
- rebuild for 7.0

* Mon Feb 14 2000 Matt Wilson <msw@redhat.com>
- rebuild on i386

* Mon Feb  7 2000 Jeff Johnson <jbj@redhat.com>
- compress man pages.

* Sun Mar 21 1999 Cristian Gafton <gafton@redhat.com> 
- auto rebuild in the new build environment (release 2)

* Mon Mar  8 1999 Jeff Johnson <jbj@redhat.com>
- updated to 1.7.1.

* Wed Mar  3 1999 Matt Wilson <msw@redhat.com>
- updated to 1.7.0

* Fri Feb  5 1999 Bill Nottingham <notting@redhat.com>
- build against new libstdc++, build on arm

* Tue Dec 22 1998 Jeff Johnson <jbj@redhat.com>
- update to 1.6.2.a.

* Tue Jun 16 1998 Jeff Johnson <jbj@redhat.com>
- add sparc/alpha functionality.
- add %clean

* Mon Jun 01 1998 Prospector System <bugs@redhat.com>
- translations modified for de

* Mon Jun 01 1998 Erik Troan <ewt@redhat.com>
- how the hell did this get setuid root?

* Thu May 07 1998 Prospector System <bugs@redhat.com>
- translations modified for de, fr, tr

* Wed Apr 29 1998 Cristian Gafton <gafton@redhat.com>
- upgraded to 1.5.1 (so that it compiles with egcs)
- buildroot

* Tue Nov  4 1997 Erik Troan <ewt@redhat.com>
- commented out line causing core dumps when exiting

* Fri Oct 24 1997 Marc Ewing <marc@redhat.com>
- wmconfig

* Fri Aug 22 1997 Erik Troan <ewt@redhat.com>
- built against glibc