Blob Blame History Raw
%define         name            efont-unicode-bdf
%define         fontdir         %{_datadir}/fonts/japanese/%{name}
%define         catalogdir      %{_sysconfdir}/X11/fontpath.d
%define         catalogname     %{name}


Name:           %{name}
Version:        0.4.2
Release:        9%{?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:  fontconfig
BuildRequires:  ttmkfdir
BuildRequires:  gzip
%if 0%{?fedora} < 8
Requires(post):  %{_bindir}/mkfontdir, %{_sbindir}/chkfontpath, fontconfig
Requires(postun):    %{_sbindir}/chkfontpath, fontconfig
%endif

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

%prep
%setup -q

# convert documents' encoding to UTF8.
# must be done in %%prep
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

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

%install
# 1. install actual fonts
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

# 2-1. create fonts.scale and fonts.dir in advance
ttmkfdir -d $RPM_BUILD_ROOT%{fontdir} -o $RPM_BUILD_ROOT%{fontdir}/fonts.scale
mkfontdir $RPM_BUILD_ROOT%{fontdir}

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

# 2.3 create libXfont catalogue symlink
mkdir -p $RPM_BUILD_ROOT%{catalogdir}
pushd $RPM_BUILD_ROOT%{catalogdir}
pushd ../../..
if [ x$(pwd) != x$RPM_BUILD_ROOT ] ; then
   echo "Current directory is not $RPM_BUILD_ROOT"
   exit 1
fi
popd
ln -sf ../../..%{fontdir} fonts-%{name}
popd

%clean
rm -rf $RPM_BUILD_ROOT

%post
umask 0133
%if 0%{?fedora} < 8
if [ -x %{_bindir}/mkfontdir -a -x %{_sbindir}/chkfontpath ] ; then
   %{_bindir}/mkfontdir %{fontdir} && %{_sbindir}/chkfontpath -q -a %{fontdir}
fi
%endif
[ -x %{_bindir}/fc-cache ] && %{_bindir}/fc-cache %{fontdir} 2>/dev/null
exit 0

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

%files
%defattr(-,root,root,-)
%doc README* COPYRIGHT ChangeLog List.html

%dir %{fontdir}
%{fontdir}/*pcf.gz
%verify(not md5 size mtime) %{fontdir}/fonts.scale
%verify(not md5 size mtime) %{fontdir}/fonts.dir
%ghost %verify(not md5 size mtime) %{fontdir}/fonts.cache-1
%ghost %verify(not md5 size mtime) %{fontdir}/encodings.dir

%{catalogdir}/fonts-%{name}

%changelog
* Fri Mar 27 2009 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 0.4.2-9
- F-11: Again rebuild for new virtual font Provides (#491958)

* Tue Feb 24 2009 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 0.4.2-8
- F-11: Mass rebuild

* Sat Aug 18 2007 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 0.4.2-7
- Drop X related dependency completely, along with chkfontpath drop
  (related to #252268, #252275)
- Generate fonts.dir at the build time instead of the runtime
  (following fonts-japanese)

* 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.