%define wtver 0.9
Summary:   WineTools is a menu driven installer for installing Windows programs under Linux.
Name:      winetools
Version:   0.9
Release:   3mdk
Copyright: GPL
Url:       http://www.von-thadden.de/Joachim/WineTools/

Group:     Applications/Emulator
Source:    %{name}-%{wtver}jo-III.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
Requires:  Xdialog, wine

%description
WineTools is a menu driven installer for installing about 90 Windows programs under the x86 (Athlon or Intel PC)
processor architecture with the Linux operating system using Wine. This software lets you install the following
Windows software:

    * DCOM98
    * IE6
    * Windows Core Fonts
    * Windows System Software
    * Office & Office Viewer
    * Adobe Photoshop 7, Illustrator 9
    * many other programs

It also sets up your .wine directory in the correct way, downloads the files to install from the web (only the
free and shareware ones for sure), installs Windows fonts and lets you uninstall and configure your software.
And it does much more than Sidenet, although it uses a part of the configuration for IE6 (thanks for that!).

WineTools was initially written by Frank Hendriksen and was extended by me (Joachim von Thadden). It
is licensed under the GPL.
%prep
%setup -q -n %{name}-%{wtver}jo-III
%build
%install
mkdir -p $RPM_BUILD_ROOT/usr/share/%{name}/%{version}
mkdir -p $RPM_BUILD_ROOT/usr/bin
cp -a $RPM_BUILD_DIR/%{name}-%{wtver}jo-III/* $RPM_BUILD_ROOT/usr/share/%{name}/%{version}
rm  $RPM_BUILD_ROOT/usr/share/%{name}/%{version}/Xdialog
sed -e 's/BASEDIR=\"\/usr\/local\/winetools/BASEDIR=\"\/usr\/share\/%{name}\/%{version}/' \
 -e 's/DIALOG=\"\$BASEDIR\/Xdialog/DIALOG=\"\/usr\/bin\/Xdialog/' \
 -e 's/TEXTDOMAINDIR=\/usr\/local\/share\/locale/TEXTDOMAINDIR=\/usr\/share\/locale/' \
 -e 's/dillo firefox mozilla konqueror/dillo mozilla-firefox mozilla konqueror/' \
   $RPM_BUILD_DIR/%{name}-%{wtver}jo-III/wt%{wtver}jo  1>$RPM_BUILD_ROOT/usr/share/%{name}/%{version}/wt%{wtver}jo
sed -e 's/BASEDIR=\"\/usr\/local\/winetools/BASEDIR=\"\/usr\/share\/%{name}\/%{version}/' \
 -e 's/DIALOG=\"\/usr\/local\/winetools\/Xdialog/DIALOG=\"\/usr\/bin\/Xdialog/' \
 -e 's/TEXTDOMAINDIR=\/usr\/local\/share\/locale/TEXTDOMAINDIR=\/usr\/share\/locale/' \
   $RPM_BUILD_DIR/%{name}-%{wtver}jo-III/findwine  1>$RPM_BUILD_ROOT/usr/share/%{name}/%{version}/findwine
ln -sf /usr/share/%{name}/%{version}/wt%{wtver}jo $RPM_BUILD_ROOT/usr/bin/wt
ln -sf /usr/share/%{name}/%{version}/wt%{wtver}jo $RPM_BUILD_ROOT/usr/bin/%{name}
ln -sf /usr/share/%{name}/%{version}/findwine $RPM_BUILD_ROOT/usr/bin/findwine
cd $RPM_BUILD_ROOT/usr/share/%{name}/%{version}/po
for i in $( ls  *.po|cut -f1 -d.); do
	mkdir -p $RPM_BUILD_ROOT/usr/share/locale/$i/LC_MESSAGES
	msgfmt $i.po -o $RPM_BUILD_ROOT/usr/share/locale/$i/LC_MESSAGES/wt0.9.mo
        echo "Installed translations for $i to $RPM_BUILD_ROOT/usr/share/locale/$i/LC_MESSAGES/wt0.9.mo"
done

%clean
rm -rf $RPM_BUILD_ROOT/*
rm -rf $RPM_BUILD_DIR/%{name}-%{wtver}jo-III

%post

%preun

%files
%doc INSTALL.txt LICENSE.txt doc/*
/usr/share/%{name}/%{version}
/usr/share/locale
/usr/bin

%changelog
* Thu Dec 08 2005 Joachim von Thadden <thadden@web.de>
- version 0.9 III

* Sat Nov 19 2005 Joachim von Thadden <thadden@web.de>
- version 0.9 II

* Thu Nov 08 2005 Joachim von Thadden <thadden@web.de>
- version for 0.9

* Sun May 22 2005 Nicolas Brouard <Nicolas.Brouard@mandrake.org> 2.1.2-0mdk
- Version 2.1.2

* Wed Feb 24 2005 Nicolas Brouard <brouard@ined.fr> 2.1.1-0mdk
- First packaging for MandrakeClub
- Integration of fr.po
- firefox is mozilla-firefox on mandrake
- Xdialog binary removed
- winetools seems to require native wine20041019-mdk from wine hq. Don't know
  how to adapt from Mandrake rpm.
