%define name	t1lib
%define version	5.0.2
%define release	2%{?_dist_release}

Summary:	Type 1 font rasterizer
Name:		%{name}
Version:	%{version}
Release:	%{release}
URL:		http://freshmeat.net/projects/t1lib
Source:		ftp://sunsite.unc.edu/pub/Linux/libs/graphics/%{name}-%{version}.tar.gz
Patch0:         %{name}-DESTDIR.patch
Patch1:		%{name}-doc.patch.bz2
Patch2:         %{name}-config.patch.bz2
Group:		System Environment/Libraries
#BuildRequires:	XFree86-devel xpm-devel
BuildRequires:	xorg-x11-devel libXpm-devel
BuildRequires:  tetex
BuildRequires:  tetex-latex
License:	LGPL
Prefix:		%{_prefix}
BuildRoot:	%{_tmppath}/%{name}-%{version}-%(id -u -n)
Epoch: 		1

%description
T1lib is a library for generating character and string-glyphs from
Adobe Type 1 fonts under UNIX. T1lib uses most of the code of the X11
rasterizer donated by IBM to the X11-project. But some disadvantages
of the rasterizer being included in X11 have been eliminated.
T1lib also includes a support for antialiasing.

%package devel
Summary: 	Header files for Type 1 font rasterizer
Group: 		Development/Libraries
Requires: 	%{name} = %{epoch}:%{version}
Provides: 	%{name}-devel = %{version}-%{release}

%description devel
Header files required for compiling packages
needing the t1lib.

%package static-devel
Summary:        Static libraries for Type 1 font rasterizer
Group:          Development/Libraries
Requires:       %{name}-devel = %{epoch}:%{version}-%{release}
Provides:       %{name}-static-devel = %{version}-%{release}

%description static-devel
Static libraries required for staticaly compiling packages needing the t1lib.

%package progs
Summary: 	Programs dor manipulating Type 1 font
Group: 		Applications/Graphics
License: 	GPL
Requires: 	%{name} = %{epoch}:%{version}
Provides: 	%{name}-progs

%description progs
The t1lib-progs contains the programs "xglyph" and "type1afm"
It also contains the "t1libconfig" script used to configure t1lib.

%prep
rm -rf %buildroot

%setup -q
%patch0 -p1
%patch1 -p0
%patch2 -p0

%build
%configure
export tagname=CC
perl -pi -e 's,-DGLOBAL_CONFIG_DIR="\\"/usr/share/t1lib\\"",-DGLOBAL_CONFIG_DIR="\\"/etc/t1lib\\"",;' Makefile
(cd lib
perl -pi -e 's,$(DESTDIR)/usr/share/t1lib,$(DESTDIR)$(datedir)t1lib,;' Makefile
)
make without_doc LIBTOOL=/usr/bin/libtool
(cd doc
make clean
make pdf)

%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT%{_libdir} \
	$RPM_BUILD_ROOT%{_datadir} \
	$RPM_BUILD_ROOT%{_bindir} \
        $RPM_BUILD_ROOT%{_includedir}

export tagname=CC
%makeinstall DESTDIR=$RPM_BUILD_ROOT LIBTOOL=/usr/bin/libtool

#rm -rf %buildroot/%{_datadir}/t1lib/doc
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/t1lib
mv $RPM_BUILD_ROOT%{_datadir}/t1lib/t1lib.config $RPM_BUILD_ROOT%{_sysconfdir}/t1lib

%ifarch alpha
(cd $RPM_BUILD_ROOT%{_libdir}
ln -sf libt1.so libt1.so.0)
%endif

## remove unuse files
rm -rf $RPM_BUILD_ROOT%{_libdir}/*.la


%post 	-n %{name} -p /sbin/ldconfig
%postun -n %{name} -p /sbin/ldconfig

%clean
rm -rf $RPM_BUILD_ROOT


%files -n %{name}
%defattr(-,root,root)
%config(noreplace) %{_sysconfdir}/t1lib/t1lib.config
%doc Changes LGPL README.t1*
%attr(755,root,root) %{_libdir}/libt1*.so.*

%files -n %{name}-devel
%defattr(-,root,root)
%doc LGPL doc/t1lib_doc.pdf
%{_includedir}/*
%{_libdir}/*.so

%files -n %{name}-static-devel
%defattr(-,root,root)
%doc LGPL
%{_libdir}/*.a
#%{_libdir}/*.la

%files -n %{name}-progs
%defattr(-,root,root)
%doc LICENSE README.t1python
%attr(755,root,root) %{_bindir}/*

%changelog
* Sun Nov 09 2008 Shu KONNO <owa@bg.wakwak.com> 5.0.2-2vl5
- rebuild with libXaw.so.7 (libXaw-1.0.5)
- spec in utf-8

* Sat Sep 20 2008 Shu KONNO <owa@bg.wakwak.com> 5.0.2-1vl5
- applied new versioning policy
- removed *.la
- added BuildRequires: xorg-x11-devel libXpm-devel, instead of XFree86-devel xpm-devel

* Sat Dec 24 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 5.0.2-0vl2
- fixed spec file to build current environment
- added %{epoch} related t1libs

* Sat Jun 19 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 5.0.2-0vl1
- updated to 5.0.2
- changed Group:

* Sun Mar 16 2003 Daisuke SUZUKI <daisuke@linux.or.jp> 5.0.0-0vl1
- new upstream release 5.0.0

* Fri May 31 2002 KOBAYASHI R. Taizo <tkoba@vinelinux.org> 1.3.1-5vl0
- modified for Vine

* Thu May 16 2002 Yves Duret <yduret@mandrakesoft.com> 1.3.1-5mdk
- 9.0 lib policy: added %libname-static-devel

* Wed Apr 17 2002 Yves Duret <yduret@mandrakesoft.com> 1.3.1-4mdk
- use %%makeinstall_std
- use %%buildroot
- devel package provides %%version-%%release

* Sat Feb 02 2002 Giuseppe Ghibメ<ghibo@mandrakesoft.com> 1.3.1-3mdk
- fixed multiple "install -d" (problem with {).

* Mon Jan 21 2002 Yves Duret <yduret@mandrakesoft.com> 1.3.1-2mdk
- use the freshmeat url

* Sun Jan 13 2002 Geoffrey Lee <snailtalk@mandrakesoft.com> 1.3.1-1mdk
- 1.3.1.
- Remove the URL. There doesn't seem to be one for it.

* Sun Oct 28 2001 Geoffrey Lee <snailtalk@mandrakesoft.com> 1.3-1mdk
- The all new-and-shiny t1lib 1.3.

* Wed Aug 15 2001 Giuseppe Ghibメ<ghibo@mandrakesoft.com> 1.2-2mdk
- removed .dvi.gz doc.
- removed .ps docs and unneeded .eps files. All printable doc files
  now replaced with only one PDF doc file.

* Tue Aug 07 2001 Yves Duret <yduret@mandrakesoft.com> 1.2-1mdk
- version 1.2
- s{Serial}{Epoch} & s{Copyright}{License}
- updated url & source
- added Patch{0,1,2}
- fix buildrequires
- remove big, fussy and redundand pdf/ps doc (ghibo sux) : 
  size of devel rpm divided by more than 2 !

* Wed May 23 2001 Yves Duret <yduret@mandrakesoft.com> 1.1.1-2mdk
- more and more macros
- s{Copyright}{License}

* Sat May 05 2001 Giuseppe Ghibメ<ghibo@mandrakesoft.com> 1.1.1-1mdk
- updated to release 1.1.1 (bugfixes).

* Tue Mar 13 2001 Giuseppe Ghibメ<ghibo@mandrakesoft.com> 1.1.0-1mdk
- updated to release 1.1.0.
- gzip doc instead of bzip2.
- removed docdir patch.

* Wed Dec 27 2000 Yves Duret <yduret@mandrakesoft.com> 1.0.1-6mdk
- added a obsoletes -devel tag.

* Tue Dec 26 2000 Yves Duret <yduret@mandrakesoft.com> 1.0.1-5mdk
- splitted into main deval and progs packages.
- config file now in /etc as it should be
- used bzip2 instead of gzip for doc
- macros

* Mon Aug 07 2000 Frederic Lepied <flepied@mandrakesoft.com> 1.0.1-4mdk
- automatically added BuildRequires

* Fri Jul 28 2000 Frederic Crozat <fcrozat@mandrakesoft.com> 1.0.1-3mdk
- BM + macroszification

* Tue May 16 2000 Chmouel Boudjnah <chmouel@mandrakesoft.com> 1.0.1-2mdk
- Move .so from devel to package and add some links for alpha.

* Sat Apr 01 2000 Giuseppe Ghibメ<ghibo@mandrakesoft.com> 1.0.1-1mdk
- updated to version 1.0.1.
- moved .so file to devel package.
- exchanged package group between main and -devel packages.

* Thu Mar 23 2000 Daouda Lo <daouda@mandrakesoft.com> 0.9.2-3mdk
- fix group.

* Thu Jan 13 2000 Pixel <pixel@mandrakesoft.com>
- libtoolize --force.

* Sat Oct 30 1999 Giuseppe Ghibメ<ghibo@linux-mandrake.com>
- updated to version 0.9.2.

* Thu Aug 12 1999 Giuseppe Ghibメ<ghibo@linux-mandrake.com>
- added PostScript documentation.
- split into main and devel package.

* Sun Aug 1 1999 Richard D. Jackson <richardj@1gig.net>
- first release of t1lib-0.9.1