diff -r -Nup freetype-2.3.9-6.fc12.src/freetype.spec freetype-2.3.9-6.fc12.3.src/freetype.spec
--- freetype-2.3.9-6.fc12.src/freetype.spec	2009-07-30 22:06:51.000000000 +0400
+++ freetype-2.3.9-6.fc12.3.src/freetype.spec	2009-10-01 12:55:12.000000000 +0400
@@ -1,15 +1,9 @@
-# Patented bytecode interpreter and patented subpixel rendering disabled by default.
-# Pass '--with bytecode_interpreter' and '--with subpixel_rendering' on rpmbuild
-# command-line to enable them.
-%{!?_with_bytecode_interpreter: %{!?_without_bytecode_interpreter: %define _without_bytecode_interpreter --without-bytecode_interpreter}}
-%{!?_with_subpixel_rendering: %{!?_without_subpixel_rendering: %define _without_subpixel_rendering --without-subpixel_rendering}}
-
 %{!?with_xfree86:%define with_xfree86 1}
 
 Summary: A free and portable font rendering engine
 Name: freetype
 Version: 2.3.9
-Release: 6%{?dist}
+Release: 6%{?dist}.3
 License: FTL or GPLv2+
 Group: System Environment/Libraries
 URL: http://www.freetype.org
@@ -38,12 +32,6 @@ Buildroot: %{_tmppath}/%{name}-%{version
 
 BuildRequires: libX11-devel
 
-%if %{?_with_bytecode_interpreter:1}%{!?_with_bytecode_interpreter:0}
-Provides: %{name}-bytecode
-%endif
-%if %{?_with_subpixel_rendering:1}%{!?_with_subpixel_rendering:0}
-Provides: %{name}-subpixel
-%endif
 
 %description
 The FreeType engine is a free and portable font rendering
@@ -54,6 +42,18 @@ individual glyphs. FreeType is not a fon
 text-rendering library.
 
 
+%package rfremix
+Summary: A free and portable font rendering engine with bcl and spr
+Group: System Environment/Libraries
+Requires: %{name} = %{version}-%{release}
+Provides: %{name}-bytecode = %{version}-%{release}
+Provides: %{name}-subpixel = %{version}-%{release}
+
+%description rfremix
+The FreeType engine built with bytecode interpreter and subpixel
+rendering.
+
+
 %package demos
 Summary: A collection of FreeType demos
 Group: System Environment/Libraries
@@ -82,28 +82,31 @@ FreeType.
 
 
 %prep
-%setup -q -b 1 -a 2
+%setup -q -b 1 -c
 
+# dual source configuration
+pushd freetype-%{version}
+tar xvf %{SOURCE2}
 pushd ft2demos-%{version}
 %patch5 -p1 -b .mathlib
 popd
-
-%if %{?_with_bytecode_interpreter:1}%{!?_with_bytecode_interpreter:0}
-%patch20  -p1 -b .enable-ft2-bci
-%endif
-
-%if %{?_with_subpixel_rendering:1}%{!?_with_subpixel_rendering:0}
-%patch21  -p1 -b .enable-spr
-%endif
-
 %patch46  -p1 -b .enable-valid
-
 %patch88 -p1 -b .multilib
 %patch89 -p1 -b .memcpy
 %patch90 -p1 -b .aliasing
+popd
+
+cp -a freetype-%{version} rfremix
+mv freetype-%{version} fedora
+
+pushd rfremix
+%patch20  -p1 -b .enable-ft2-bci
+%patch21  -p1 -b .enable-spr
+popd
 
 %build
 
+pushd fedora
 %configure --disable-static
 sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' builds/unix/libtool
 sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' builds/unix/libtool
@@ -122,12 +125,83 @@ iconv -f latin1 -t utf-8 < FTL.TXT > FTL
 touch -r FTL.TXT FTL.TXT.tmp && \
 mv FTL.TXT.tmp FTL.TXT
 popd
+popd
+
+pushd rfremix
+%configure --disable-static
+sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' builds/unix/libtool
+sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' builds/unix/libtool
+make %{?_smp_mflags}
+
+%if %{with_xfree86}
+# Build demos
+pushd ft2demos-%{version}
+make TOP_DIR=".."
+popd
+%endif
+
+# Convert FTL.txt to UTF-8
+pushd docs
+iconv -f latin1 -t utf-8 < FTL.TXT > FTL.TXT.tmp && \
+touch -r FTL.TXT FTL.TXT.tmp && \
+mv FTL.TXT.tmp FTL.TXT
+popd
+popd
 
 
 %install
 rm -rf $RPM_BUILD_ROOT
 
+pushd fedora
+%makeinstall gnulocaledir=$RPM_BUILD_ROOT%{_datadir}/locale
+
+{
+  for ftdemo in ftbench ftchkwd ftdump ftlint ftmemchk ftvalid ; do
+      builds/unix/libtool --mode=install install -m 755 ft2demos-%{version}/bin/$ftdemo $RPM_BUILD_ROOT/%{_bindir}
+  done
+}
+%if %{with_xfree86}
+{
+  for ftdemo in ftdiff ftgamma ftgrid ftmulti ftstring fttimer ftview ; do
+      builds/unix/libtool --mode=install install -m 755 ft2demos-%{version}/bin/$ftdemo $RPM_BUILD_ROOT/%{_bindir}
+  done
+}
+%endif
+
+# fix multilib issues
+%ifarch x86_64 s390x ia64 ppc64 alpha sparc64
+%define wordsize 64
+%else
+%define wordsize 32
+%endif
+
+mv $RPM_BUILD_ROOT%{_includedir}/freetype2/freetype/config/ftconfig.h \
+   $RPM_BUILD_ROOT%{_includedir}/freetype2/freetype/config/ftconfig-%{wordsize}.h
+cat >$RPM_BUILD_ROOT%{_includedir}/freetype2/freetype/config/ftconfig.h <<EOF
+#ifndef __FTCONFIG_H__MULTILIB
+#define __FTCONFIG_H__MULTILIB
+
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 32
+# include "ftconfig-32.h"
+#elif __WORDSIZE == 64
+# include "ftconfig-64.h"
+#else
+# error "unexpected value for __WORDSIZE macro"
+#endif
 
+#endif 
+EOF
+
+# Don't package static a or .la files
+rm -f $RPM_BUILD_ROOT%{_libdir}/*.{a,la}
+
+mv $RPM_BUILD_ROOT%{_libdir}/libfreetype.so.6.3.20 \
+    $RPM_BUILD_ROOT%{_libdir}/libfreetype-fedora.so.6.3.20
+popd
+
+pushd rfremix
 %makeinstall gnulocaledir=$RPM_BUILD_ROOT%{_datadir}/locale
 
 {
@@ -172,6 +246,15 @@ EOF
 # Don't package static a or .la files
 rm -f $RPM_BUILD_ROOT%{_libdir}/*.{a,la}
 
+mv $RPM_BUILD_ROOT%{_libdir}/libfreetype.so.6.3.20 \
+    $RPM_BUILD_ROOT%{_libdir}/libfreetype-rfremix.so.6.3.20
+popd
+
+pushd $RPM_BUILD_ROOT%{_libdir}
+ln -s /etc/alternatives/freetype libfreetype.so.6.3.20
+popd
+
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
@@ -185,16 +268,65 @@ rm -rf $RPM_BUILD_ROOT
   exit 0
 }
 
-%post -p /sbin/ldconfig
 
-%postun -p /sbin/ldconfig
+%post
+%ifarch x86_64
+/usr/sbin/alternatives --install %{_libdir}/libfreetype.so.6.3.20 freetype-x86_64 %{_libdir}/libfreetype-fedora.so.6.3.20 1
+%else
+/usr/sbin/alternatives --install %{_libdir}/libfreetype.so.6.3.20 freetype-i386 %{_libdir}/libfreetype-fedora.so.6.3.20 1
+%endif
+/sbin/ldconfig
+
+
+%post rfremix
+%ifarch x86_64
+/usr/sbin/alternatives --remove freetype-x86_64 %{_libdir}/libfreetype-fedora.so.6.3.20 > /dev/null 2>&1
+/usr/sbin/alternatives --install %{_libdir}/libfreetype.so.6.3.20 freetype-x86_64 %{_libdir}/libfreetype-rfremix.so.6.3.20 2
+%else
+/usr/sbin/alternatives --remove freetype-i386 %{_libdir}/libfreetype-fedora.so.6.3.20 > /dev/null 2>&1
+/usr/sbin/alternatives --install %{_libdir}/libfreetype.so.6.3.20 freetype-i386 %{_libdir}/libfreetype-rfremix.so.6.3.20 2
+%endif
+/sbin/ldconfig
+
+
+%postun
+if [ "$1" -eq 0 ]; then
+    %ifarch x86_64
+    /usr/sbin/alternatives --remove freetype-x86_64 %{_libdir}/libfreetype-fedora.so.6.3.20
+    %else
+    /usr/sbin/alternatives --remove freetype-i386 %{_libdir}/libfreetype-fedora.so.6.3.20
+    %endif
+fi
+/sbin/ldconfig
+
+
+%postun rfremix
+if [ "$1" -eq 0 ]; then
+    %ifarch x86_64
+    /usr/sbin/alternatives --remove freetype-x86_64 %{_libdir}/libfreetype-rfremix.so.6.3.20
+    /usr/sbin/alternatives --install %{_libdir}/libfreetype.so.6.3.20 freetype-x86_64 %{_libdir}/libfreetype-fedora.so.6.3.20 1
+    %else
+    /usr/sbin/alternatives --remove freetype-i386 %{_libdir}/libfreetype-rfremix.so.6.3.20
+    /usr/sbin/alternatives --install %{_libdir}/libfreetype.so.6.3.20 freetype-i386 %{_libdir}/libfreetype-fedora.so.6.3.20 1
+    %endif
+fi
+/sbin/ldconfig
+
 
 %files
 %defattr(-,root,root)
+%{_libdir}/libfreetype-fedora.so.*
 %{_libdir}/libfreetype.so.*
-%doc README
-%doc docs/LICENSE.TXT docs/FTL.TXT docs/GPL.TXT
-%doc docs/CHANGES docs/VERSION.DLL docs/formats.txt docs/ft2faq.html
+%doc fedora/README
+%doc fedora/docs/LICENSE.TXT fedora/docs/FTL.TXT fedora/docs/GPL.TXT
+%doc fedora/docs/CHANGES fedora/docs/VERSION.DLL fedora/docs/formats.txt fedora/docs/ft2faq.html
+
+%files rfremix
+%defattr(-,root,root)
+%{_libdir}/libfreetype-rfremix.so.*
+%doc rfremix/README
+%doc rfremix/docs/LICENSE.TXT rfremix/docs/FTL.TXT rfremix/docs/GPL.TXT
+%doc rfremix/docs/CHANGES rfremix/docs/VERSION.DLL rfremix/docs/formats.txt rfremix/docs/ft2faq.html
 
 %files demos
 %defattr(-,root,root)
@@ -213,7 +345,7 @@ rm -rf $RPM_BUILD_ROOT
 %{_bindir}/fttimer
 %{_bindir}/ftview
 %endif
-%doc ChangeLog README
+%doc fedora/ChangeLog fedora/README
 
 %files devel
 %defattr(-,root,root)
@@ -224,12 +356,19 @@ rm -rf $RPM_BUILD_ROOT
 %{_libdir}/libfreetype.so
 %{_bindir}/freetype-config
 %{_libdir}/pkgconfig/freetype2.pc
-%doc docs/design
-%doc docs/glyphs
-%doc docs/reference
-%doc docs/tutorial
+%doc fedora/docs/design
+%doc fedora/docs/glyphs
+%doc fedora/docs/reference
+%doc fedora/docs/tutorial
 
 %changelog
+* Thu Oct  1 2009 Arkady L. Shane <ashejn@yandex-team.ru> 2.3.9-6.3
+- different alternatives for different arches
+
+* Wed Sep 30 2009 Arkady L. Shane <ashejn@yandex-team.ru> 2.3.9-6.2
+- added alternatives to select proper freetype
+- added freetype-rfremix package what contains patches library
+
 * Thu Jul 30 2009 Behdad Esfahbod <behdad@redhat.com> 2.3.9-6
 - Add freetype-2.3.9-aliasing.patch
 - Resolves: 513582
