%define xfontdir_       %{_datadir}/fonts/ko
%define xfontdir        %{xfontdir_}/TrueType
%define	gsver		7.07
%define	gslibdir	%{_datadir}/ghostscript/%{gsver}/lib

Summary: 	Baekmuk Korean TrueType Fonts
Summary(ja):	Baekmuk 韓国語 TrueType フォント
Name:           TrueType-baekmuk
Version:        2.2
Release:	1%{?_dist_release}
License:        BSD
Group: 		User Interface/X
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{PACKAGE_VERSION}-root
BuildRequires:	ghostscript >= %{gsver}

Source0:        http://kldp.net/frs/download.php/1429/baekmuk-ttf-2.2.tar.gz
Source5:	CIDFnmap.ko

PreReq:         chkfontpath, freetype-utils
PreReq:         XOrg-font-utils

%description
This package provides Baekmuk Korean TrueType fonts.

%prep
%setup -n baekmuk-ttf-%{version}

%build

%install
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT

install -d $RPM_BUILD_ROOT%{xfontdir}
install -m 0644 ttf/*.ttf $RPM_BUILD_ROOT%{xfontdir}/

# for ghostscript
install -d $RPM_BUILD_ROOT%{gslibdir}
install -m 0644 %{SOURCE5} $RPM_BUILD_ROOT%{gslibdir}/

%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT

%post
{
  /usr/bin/ttmkfdir -d %{xfontdir} -o %{xfontdir}/fonts.scale
  /usr/X11R6/bin/mkfontdir %{xfontdir}
  /usr/sbin/chkfontpath -q -a %{xfontdir}
  if [ -x /usr/bin/vine-update-gnome-font-install ]; then
    /usr/bin/vine-update-gnome-font-install
  fi
  if [ -x /usr/bin/redhat-update-gnome-font-install2 ]; then
    /usr/bin/redhat-update-gnome-font-install2
  fi
  [ -x /usr/bin/fc-cache ] && /usr/bin/fc-cache %{xfontdir}
} >& /dev/null ||:

%postun
{
  /usr/bin/ttmkfdir -d %{xfontdir} -o %{xfontdir}/fonts.scale
  /usr/X11R6/bin/mkfontdir %{xfontdir}
  if [ "$1" = 0 ]; then
    /usr/sbin/chkfontpath -q -r %{xfontdir}
    if [ -x /usr/bin/vine-update-gnome-font-install ]; then
        /usr/bin/vine-update-gnome-font-install
    fi
    if [ -x /usr/bin/redhat-update-gnome-font-install2 ]; then
        /usr/bin/redhat-update-gnome-font-install2
    fi
    [ -x /usr/bin/fc-cache ] && /usr/bin/fc-cache %{xfontdir}
  fi
} >& /dev/null ||:

%files
%defattr(-, root, root)
%doc README COPYRIGHT COPYRIGHT.ks
%attr(0755, root, root) %dir %{xfontdir_}
%attr(0755, root, root) %dir %{xfontdir}
%{xfontdir}/*.ttf
%{gslibdir}/CIDFnmap.ko

%changelog
* Sun Oct 05 2008 Shu KONNO <owa@bg.wakwak.com> 2.2-1vl5
- applied new versioning policy, spec in utf-8

* Fri Apr 15 2005 Daisuke SUZUKI <daisuke@linux.or.jp> 2.2-0vl1
- new upstream source

* Wed Aug 25 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 2.1-0vl1
- initial build for Vine Linux
