+# NOTE
+# according to EULA we *can* store the .exe's in distfiles in
+# unaltered form (that is those .exe files), while can't distribute
+# resulting rpm.
#
# Conditional build:
-# _with_license_agreement - generates package
+%bcond_with license_agreement # generates package
#
+%define base_name fonts-TTF-microsoft
Summary: Microsoft True Type fonts
-Summary(pl): Fonty True Type firmy Microsoft
-Name: fonts-TTF-microsoft
+Summary(pl.UTF-8): Fonty True Type firmy Microsoft
+%if %{with license_agreement}
+Name: %{base_name}
+%else
+Name: %{base_name}-installer
+%endif
+%define _rel 8
Version: 20020525
-Release: 4
+Release: %{_rel}%{?with_license_agreement:wla}
License: Microsoft EULA (for non-commercial use)
-Group: X11/Fonts
-URL: http://www.microsoft.com/truetype/fontpack/
+Group: Fonts
+%if %{with license_agreement}
Source0: http://dl.sourceforge.net/corefonts/andale32.exe
# Source0-md5: cbdc2fdd7d2ed0832795e86a8b9ee19a
Source1: http://dl.sourceforge.net/corefonts/arial32.exe
# Source9-md5: 12d2a75f8156e10607be1eaa8e8ef120
Source10: http://dl.sourceforge.net/corefonts/webdin32.exe
# Source10-md5: 230a1d13a365b22815f502eb24d9149b
-%if %{!?_with_license_agreement:1}%{?_with_license_agreement:0}
-NoSource: 0
-NoSource: 1
-NoSource: 2
-NoSource: 3
-NoSource: 4
-NoSource: 5
-NoSource: 6
-NoSource: 7
-NoSource: 8
-NoSource: 9
-NoSource: 10
+%else
+Source21: license-installer.sh
+# extracted from one of the above
+Source20: Microsoft-EULA.txt
%endif
+URL: http://corefonts.sourceforge.net/
+%if %{with license_agreement}
BuildRequires: cabextract
Requires(post,postun): fontpostinst
Requires: %{_fontsdir}/TTF
-Buildarch: noarch
+Requires: fontpostinst
+%else
+Requires: cabextract
+Requires: mktemp > 1.5-18
+Requires: rpm-build-tools
+%endif
+BuildArch: noarch
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%define ttffontsdir %{_fontsdir}/TTF
%description
Microsoft free True Type fonts collection.
-%description -l pl
-Kolekcja darmowych fontów True Type firmy Microsoft.
+%description -l pl.UTF-8
+Kolekcja darmowych fontów True Type firmy Microsoft.
%prep
+%if %{with license_agreement}
%setup -q -c -T
-/usr/bin/cabextract -L %{SOURCE0} %{SOURCE1} %{SOURCE2} %{SOURCE3} \
+%{_bindir}/cabextract -L %{SOURCE0} %{SOURCE1} %{SOURCE2} %{SOURCE3} \
%{SOURCE4} %{SOURCE5} %{SOURCE6} %{SOURCE7} %{SOURCE8} %{SOURCE9} \
%{SOURCE10}
+%endif
-%if %{!?_with_license_agreement:1}%{?_with_license_agreement:0}
-cat Licen.TXT
+%install
+rm -rf $RPM_BUILD_ROOT
-cat <<EOF
+%if !%{with license_agreement}
+install -d $RPM_BUILD_ROOT{%{_bindir},%{_datadir}/%{base_name}}
-Use:
- rpm -ba --with license_agreement <specfile>
-to rebuild the package if you accept the above license.
+sed -e '
+ s/@BASE_NAME@/%{base_name}/g
+ s/@TARGET_CPU@/%{_target_cpu}/g
+ s-@VERSION@-%{version}-g
+ s-@RELEASE@-%{release}-g
+ s,@SPECFILE@,%{_datadir}/%{base_name}/%{base_name}.spec,g
+ s,@LICENSE@,%{_datadir}/%{base_name}/Microsoft-EULA.txt,
+' %{SOURCE21} > $RPM_BUILD_ROOT%{_bindir}/%{base_name}.install
-EOF
-exit 1
-%endif
+install %{_specdir}/%{base_name}.spec $RPM_BUILD_ROOT%{_datadir}/%{base_name}
+install %{SOURCE20} $RPM_BUILD_ROOT%{_datadir}/%{base_name}
-%install
-rm -rf $RPM_BUILD_ROOT
+%else
install -d $RPM_BUILD_ROOT%{ttffontsdir}
install *.ttf $RPM_BUILD_ROOT%{ttffontsdir}
+%endif
%clean
rm -rf $RPM_BUILD_ROOT
+%if %{with license_agreement}
%post
fontpostinst TTF
%postun
fontpostinst TTF
+%else
+%post
+echo "
+If you accept the license enclosed in the file
+%{_datadir}/%{base_name}/Microsoft-EULA.txt
+and want to install real fonts, then rebuild the package with the
+following command:
+
+%{_bindir}/%{base_name}.install --with license_agreement %{_datadir}/%{base_name}/%{base_name}.spec
+"
+%endif
+
%files
%defattr(644,root,root,755)
-%doc Licen.TXT
+%if %{with license_agreement}
+%doc licen.txt
%{ttffontsdir}/*
+%else
+%attr(755,root,root) %{_bindir}/%{base_name}.install
+%{_datadir}/%{base_name}
+%endif