%define name thai-ttf %define version @VERSION@ %define release 1 %define manifest %{_builddir}/%{name}-%{version}-%{release}.manifest %define fontroot /usr/share/fonts %define fontdir %{fontroot}/th/TTF Name: %{name} Version: %{version} Release: %{release} License: freely redistributable Group: Extensions/Thai/font Source: %{name}-%{version}.tar.gz URL: http://linux.thai.net/cvs/ Distribution: Linux-TLE Vendor: NECTEC Packager: Theppitak Karoonboonyanan Requires: XFree86 > 3.2 Prereq: chkfontpath BuildArch: noarch BuildRoot: /var/tmp/%{name}-%{version} Summary: A collection of Thai TrueType fonts. %description Thai TrueType fonts included here are Norasi and Garuda from the National Font project. %prep %setup %build %configure --with-fontdir=$RPM_BUILD_ROOT%{fontdir} %install rm -rf $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT %makeinstall # __os_install_post is implicitly expanded after the # install section... do it now, and then disable it, # so all work is done before building manifest. %{?__os_install_post} %define __os_install_post %{nil} # build the file list automagically into %{manifest} cd $RPM_BUILD_ROOT rm -f %{manifest} find . -type d \ | sed '1,2d;s,^\.,\%attr(-\,root\,root) \%dir ,' >> %{manifest} find . -type f \ | sed '/fonts.scale/d;/fonts.dir/d;/encodings.dir/d' \ | sed 's,^\.,\%attr(-\,root\,root) ,' >> %{manifest} find . -type l \ | sed 's,^\.,\%attr(-\,root\,root) ,' >> %{manifest} %post cd %{fontdir} if which ttmkfdir > /dev/null 2>&1; then if ttmkfdir -e /usr/X11R6/lib/X11/fonts/encodings/encodings.dir > /dev/null 2>&1 then ttmkfdir -e /usr/X11R6/lib/X11/fonts/encodings/encodings.dir -o fonts.scale # ttmkfdir 2 else ttmkfdir > fonts.scale # ttmkfdir 1 fi elif which mkfontscale > /dev/null 2>&1; then mkfontscale fi mkfontdir -e /usr/X11R6/lib/X11/fonts/encodings if (/usr/sbin/chkfontpath --list | grep $RPM_BUILD_ROOT%{fontdir} > /dev/null) then /usr/sbin/chkfontpath --remove $RPM_BUILD_ROOT%{fontdir} fi /usr/sbin/chkfontpath --add $RPM_BUILD_ROOT%{fontdir} # Add dir to XftConfig if test -f /etc/X11/XftConfig && \ ! grep -e "dir *\"%{fontdir}\"" /etc/X11/XftConfig > /dev/null; then echo "dir \"%{fontdir}\"" > /tmp/tmp.$$ cat /etc/X11/XftConfig >> /tmp/tmp.$$ mv -f /tmp/tmp.$$ /etc/X11/XftConfig xftcache %{fontdir} fi # Refresh fontconfig cache if which fc-cache > /dev/null 2>&1; then fc-cache -f %{fontroot} fi # refresh font for gnome-print if which gnome-font-install > /dev/null 2>&1; then gnome-font-install -q fi %postun cd %{fontdir} rm -f fonts.scale fonts.dir encodings.dir if which ttmkfdir > /dev/null 2>&1; then if ttmkfdir -e /usr/X11R6/lib/X11/fonts/encodings/encodings.dir > /dev/null 2>&1 then ttmkfdir -e /usr/X11R6/lib/X11/fonts/encodings/encodings.dir -o fonts.scale # ttmkfdir 2 else ttmkfdir > fonts.scale # ttmkfdir 1 fi elif which mkfontscale > /dev/null 2>&1; then mkfontscale fi if test `head -1 fonts.scale` -gt 0; then mkfontdir -e /usr/X11R6/lib/X11/fonts/encodings if (/usr/sbin/chkfontpath --list | grep %{fontdir} > /dev/null) then /usr/sbin/chkfontpath --remove %{fontdir} fi /usr/sbin/chkfontpath --add %{fontdir} else rm -f fonts.scale find %{fontdir} -name fonts.cache-1 -exec rm {} \; cd /; rmdir %{fontdir} /usr/sbin/chkfontpath --remove %{fontdir} # Remove dir from XftConfig if test -f /etc/X11/XftConfig; then grep -v "dir *\"%{fontdir}\"" /etc/X11/XftConfig > /tmp/tmp.$$ mv -f /tmp/tmp.$$ /etc/X11/XftConfig xftcache %{fontdir} fi fi # Refresh fontconfig cache if which fc-cache > /dev/null 2>&1; then fc-cache -f %{fontroot} fi # refresh font for gnome-print if which gnome-font-install > /dev/null 2>&1; then gnome-font-install -q fi %clean rm -f %{manifest} rm -rf $RPM_BUILD_ROOT %files -f %{manifest} %defattr(-,root,root) #%doc README #%docdir #%config %changelog * Tue Dec 24 2002 Theppitak Karoonboonyanan + 0.3.1-1 - Version 0.3.1 * Sat Dec 21 2002 Theppitak Karoonboonyanan - Change fontdir from %{fontroot}/TIS-620/TrueType to %{fontroot}/th/TTF - Change URL to point to CVS snapshot * Mon Dec 16 2002 Theppitak Karoonboonyanan + 0.3.0-2 - Add xftcache calling, as per Supphachoke's suggestion - Add -f option to fc-cache calling - Split %{fontroot} from %{fontdir}, as fontconfig manipulation units * Mon Dec 09 2002 Theppitak Karoonboonyanan + 0.3.0-1 - Add supports for mkfontscale and fontconfig - Add checks for XftConfig existence before updating - Polish %post and %postun scripts, remove cluttered $RPM_BUILD_ROOT * Sun Jan 20 2002 Theppitak Karoonboonyanan + 0.2.1-4 - Add %post and %postun scripts to refresh font for gnome-print. * Wed Jan 16 2002 Theppitak Karoonboonyanan + 0.2.1-3 - Add %post and %postun scripts to manipulate /etc/X11/XftConfig. - Change font directory back to /usr/share/fonts/TIS-620/TrueType. * Tue Dec 19 2001 Theppitak Karoonboonyanan - Fix encoding path in ttmkfdir -e. - Fix %postun script: remove fonts.scale before rmdir. * Tue Dec 18 2001 Phattanon Duangdara 0.2.1-2 - Change font directory to /usr/share/fonts/th/TrueType. - Fixup ttmkfdir call use -o for output in %post and %postun stage. * Sun Nov 25 2001 Theppitak Karoonboonyanan 0.2.1-1 - Add thai-ttf.spec.in into the source tarball. - Add BuildArch: section. - Remove unneccessary 'make' in %build stage. - Filter out dynamic files from menifest. - Add ttmkfontdir and mkfontdir in %post stage. - Add checking for existing fonts in %postun stage.