%define ttfdir %_datadir/fonts/default/TrueType-ms

Name: ms-fonts-ttf
Version: 1.0
Release: alt6

Summary: Unicode True Type fonts from MS
Summary (ru_RU.UTF-8): Unicode True Type шрифты от Микрософт 
License: free to use, but restricted (see EULA)
Group: System/Fonts/True type
Url: http://telia.dl.sourceforge.net/sourceforge/corefonts
Source0: ms_eula.htm
Source1: arial32.exe
Source2: arialb32.exe
Source3: times32.exe
Source4: courie32.exe
BuildArchitectures: noarch
PreReq: cabextract >= 0.6 chkfontpath freetype fontconfig
BuildRequires: cabextract >= 0.6 freetype
Obsoletes: ms-ttf
Conflicts: ms-ttf

%description
A set of Unicode True Type fonts from MS

%description -l ru_RU.UTF-8
Набор Unicode True Type шрифтов от Микрософт.

%build
cp %SOURCE0 .
cp %SOURCE1 .
cp %SOURCE2 .
cp %SOURCE3 .
cp %SOURCE4 .
for i in *32.exe ; do
  cabextract $i
  rm -f fontinst.exe
  rm -f FONTINST.EXE
done
rm -f *.inf
for f in *.[Tt][Tt][Ff] ; do
  new_name=`echo "$f" | tr A-Z a-z`
  [ "$new_name" == "$f" ] || mv "$f" "$new_name"
done
%_sbindir/ttmkfdir > fonts.dir

%install
install -d $RPM_BUILD_ROOT%ttfdir
cp *.exe  $RPM_BUILD_ROOT%ttfdir
cp *.ttf $RPM_BUILD_ROOT%ttfdir
cp *.dir $RPM_BUILD_ROOT%ttfdir
ln -sf /etc/X11/encodings.dir encodings.dir

%post
cd %ttfdir
for i in *32.exe ; do
  cabextract $i >/dev/null 2>&1
  rm -f fontinst.exe FONTINST.EXE
done
rm -f *.inf
for f in *.[Tt][Tt][Ff] ; do
  new_name=`echo "$f" | tr A-Z a-z`
  [ "$new_name" = "$f" ] || mv "$f" "$new_name"
done
rm -f *.exe
%_bindir/fc-cache %ttfdir
chkfontpath -q --add %ttfdir

%postun
chkfontpath --remove %ttfdir

%files
%doc ms_eula.htm
%ghost %verify (not mtime) %ttfdir/*.ttf
%config (missingok) %ttfdir/*.exe
%ttfdir/*.dir

%changelog
* Wed Aug 27 2003 Vyacheslav Dikonov <slava@altlinux.ru> 1.0-alt6
- Changed dir
- Cleanups (removed obsolete gnome-font-install and xftcache calls, fontconfig)
- Requirements fixed
- Translation
- Renamed to ms-fonts-ttf

* Mon Oct 07 2002 AEN <aen@altlinux.ru> 1.0-alt5
- fc-cache & gnome-font install added in %post

* Wed Sep 25 2002 AEN <aen@altlinux.ru> 1.0-alt4
- built with cabextract-0.6

* Wed Sep 25 2002 AEN <aen@altlinux.ru> 1.0-alt3
- build rpm with fonts

* Thu Nov 01 2001 Sergey Vlasov <vsu@altlinux.ru> 1.0-alt2
- convert file names to lower case

* Mon Jul 16 2001 AEN <aen@logic.ru> 1.0-alt1
- build for Sisyphus
