%define fontdir %{_datadir}/fonts/default/ghostscript
%define catalogue %{_sysconfdir}/X11/fontpath.d

# font manipulation macro
%define __mkfontscale	umask 133;%{_bindir}/mkfontscale
%define __mkfontdir	umask 133;%{_bindir}/mkfontdir
%define __fccache	umask 133;which fc-cache &> /dev/null && fc-cache

Summary: Fonts for the Ghostscript PostScript(TM) interpreter
Summary(ja): Ghostscript ポストスクリプト(TM) インタプリタ用のフォント
Name: ghostscript-fonts
Version: 5.50
Release: 4%{?_dist_release}
License: GPLv2+ and Hershey and MIT and OFL and Public Domain
Group: Applications/Publishing
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
URL: http://www.gnu.org/software/ghostscript/
Source: gnu-gs-fonts-other-%{version}-nobch.tar.gz
Source1: Kevin_Hartig-Font_License.txt
Source2: SIL-Open-Font-License.txt
# gnu-gs-fonts-other-5.50 contains fonts with a non-free license (bug #690593).
# Therefore we use this script to remove those fonts before shipping
# it.  Download the upstream tarball (from
# http://ftp.gnu.org/gnu/ghostscript/) and invoke this script while in
# the tarball's directory:
# ./generate-tarball.sh 5.50
Source3: generate-tarball.sh
Requires: ghostscript
Requires: fontconfig
Requires(post): xorg-x11-font-utils
Requires(post): fontconfig
Requires(postun): fontconfig
BuildArch: noarch

%description
Ghostscript-fonts contains a set of fonts that Ghostscript, a
PostScript interpreter, uses to render text. These fonts are in
addition to the fonts shared by Ghostscript and the X Window System.

You'll need to install ghostscript-fonts if you're installing
ghostscript.

%description -l ja
ghostscript-fonts には Ghostscripts ポストスクリプトインタプリタ
でテキストをレンダリングするために必要なフォント一式が含まれてい
ます。このフォントは Ghostscript と X ウィンドウシステムの両方で
利用されます。

ghostscript をインストールする場合は ghostscript-fonts もインス
トールする必要があります。

%prep
%setup -q -c ghostscript-fonts-%{version}
cp -p %{SOURCE1} %{SOURCE2} .

# Remove Hershey fonts as they cause problems (bug #707007).
find fonts -type f | xargs grep -lw Hershey | xargs rm -f

%build

%install
%__rm -rf $RPM_BUILD_ROOT
%__mkdir_p $RPM_BUILD_ROOT%{fontdir}
%__cp -p fonts/* $RPM_BUILD_ROOT%{fontdir}

# Touch ghosted files
touch $RPM_BUILD_ROOT%{fontdir}/fonts.{dir,scale}

# Install catalogue symlink
%__mkdir_p $RPM_BUILD_ROOT%{catalogue}
%__ln_s -f %{fontdir} $RPM_BUILD_ROOT%{catalogue}/default-ghostscript

%post
%{__mkfontscale} %{fontdir} ||:
%{__mkfontdir} %{fontdir} ||:
%{__fccache} %{_datadir}/fonts ||:

%postun
if [ "$1" = "0" ]; then
   %{__fccache} %{_datadir}/fonts ||:
fi

%clean
%__rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%{_datadir}/fonts/default/ghostscript
%{catalogue}/default-ghostscript

%changelog
* Sat Jul 4 2015 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 5.50-4
- removed files that have problems.

* Mon Jan 20 2014 Munehiro Yamamoto <munepi@vinelinux.org> 5.50-3
- rebuild

* Sat Apr 16 2011 Munehiro Yamamoto <munepi@vinelinux.org> 5.50-2
- added %%{catalogue}/default-ghostscript
- fixed BuildRoot:, URL: tags

* Fri Aug 15 2008 Shu KONNO <owa@bg.wakwak.com> 5.50-1vl5
- applied new versioning policy, spec in utf-8

* Wed Sep 20 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 5.50-1vl2
- rebuild to add gpg sign
- add Japanese summary and description.

* Mon Feb 18 2002 Daisuke SUZUKI <daisuke@linux.or.jp> 5.50-1vl1
- just rebuild with Vine Linux

* Mon Feb 14 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- 5.50

* Sun Mar 21 1999 Cristian Gafton <gafton@redhat.com> 
- auto rebuild in the new build environment (release 3)

* Wed Feb 24 1999 Preston Brown <pbrown@redhat.com>
- Injected new description and group.

* Wed Jan 13 1999 Preston Brown <pbrown@redhat.com>
- renamed package to be consistent with new ghostscript.

* Fri Nov 13 1998 Preston Brown <pbrown@redhat.com>
- removed the std fonts...now shared between X11 and gs with URW fonts pkg.

* Thu Jul  2 1998 Jeff Johnson <jbj@redhat.com>
- update to 4.03.

* Mon May 04 1998 Erik Troan <ewt@redhat.com>
- set the owner and group of all of the files to 0.0

* Tue Sep 23 1997 Erik Troan <ewt@redhat.com>
- made a noarch package
