Blob Blame History Raw
%define         name            efont-unicode-bdf
%define         fontdir         %{_datadir}/fonts/japanese/%{name}

Name:           %{name}
Version:        0.4.2
Release:        6.1%{?dist}
Summary:        Unicode font by Electronic Font Open Laboratory

Group:          User Interface/X
License:        BSD
URL:            http://openlab.jp/efont/unicode/
Source0:        http://openlab.jp/efont/dist/unicode-bdf/efont-unicode-bdf-%{version}.tar.bz2
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch:      noarch

BuildRequires:  xorg-x11-font-utils
BuildRequires:  gzip
Requires(post):  %{_bindir}/mkfontdir, %{_sbindir}/chkfontpath, fontconfig
Requires(postun):    %{_sbindir}/chkfontpath, fontconfig

%description
This package provides Unicode bitmap fonts provided by
Electronic Font Open Laboratory.

%prep
%setup -q

%build
for f in *bdf ; do
  g=${f%bdf}pcf
  bdftopcf -o $g $f
  gzip -9 $g
done

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{fontdir}
for g in *pcf.gz ; do
  install -m 644 $g $RPM_BUILD_ROOT%{fontdir}
done

# create ghost files
touch $RPM_BUILD_ROOT%{fontdir}/{fonts.dir,fonts.cache-1}

# convert documents' encoding to UTF8.
for f in README.{naga10,shinonome} ; do
   mv ${f} ${f}.tmp
   iconv -f EUCJP -t UTF8 ${f}.tmp > ${f} && rm -f ${f}.tmp || \
      mv ${f}.tmp ${f}
done

%clean
rm -rf $RPM_BUILD_ROOT

%post
if [ -x %{_bindir}/mkfontdir -a -x %{_sbindir}/chkfontpath ] ; then
   %{_bindir}/mkfontdir %{fontdir} && %{_sbindir}/chkfontpath -q -a %{fontdir}
fi
[ -x %{_bindir}/fc-cache ] && %{_bindir}/fc-cache 2>/dev/null

%postun
# final remove?
if [ "$1" == "0" ] ; then
   [ -x %{_sbindir}/chkfontpath ] && %{_sbindir}/chkfontpath -q -r %{fontdir}
fi
[ -x %{_bindir}/fc-cache ] && %{_bindir}/fc-cache 2>/dev/null

%files
%defattr(-,root,root,-)
%doc README* COPYRIGHT ChangeLog List.html
%dir %{fontdir}
%{fontdir}/*pcf.gz
%ghost %verify(not md5 size mtime) %{fontdir}/fonts.cache-1
%ghost %verify(not md5 size mtime) %{fontdir}/fonts.dir

%changelog
* Mon Aug 28 2006 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 0.4.2-6.1
- Rebuild.

* Tue Aug 18 2006 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 0.4.2-6
- Change %%post.

* Tue Aug 15 2006 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 0.4.2-5
- package again.

* Tue Aug 15 2006 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 0.4.2-4
- Own the original font directory.

* Thu Aug 10 2006 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 0.4.2-3
- Again more treatments.

* Thu Aug 10 2006 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 0.4.2-2
- More neat treatments for post and postun.

* Thu Aug 10 2006 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 0.4.2-1
- Initial packaging.