Summary:	PostScript Type 1 font rasterizer
Name:		t1lib
Epoch: 		1
Version:	5.1.2
Release:	5%{?_dist_release}
Group:		system
Vendor: 	Project Vine
Distribution: 	Vine Linux

License:	LGPLv2+
URL:		ftp://sunsite.unc.edu/pub/Linux/libs/graphics/t1lib-%{version}.lsm
Source:		ftp://sunsite.unc.edu/pub/Linux/libs/graphics/%{name}-%{version}.tar.gz
Patch0:         http://ftp.de.debian.org/debian/pool/main/t/t1lib/t1lib_5.1.2-3.diff.gz
Patch1:		t1lib-5.1.2-segf.patch
# Fixes CVE-2010-2642, CVE-2011-0433
# http://bugzilla.redhat.com/show_bug.cgi?id=679732
Patch2:		t1lib-5.1.2-afm-fix.patch
# Fixes CVE-2011-0764, CVE-2011-1552, CVE-2011-1553, CVE-2011-1554
# http://bugzilla.redhat.com/show_bug.cgi?id=692909
Patch3:		t1lib-5.1.2-type1-inv-rw-fix.patch
# Add aarch64 support
# https://bugzilla.redhat.com/show_bug.cgi?id=926603
Patch4:		t1lib-5.1.2-aarch64.patch
Patch5:		t1lib-5.1.2-format-security.patch

BuildRoot:	%{_tmppath}/%{name}-%{version}-root
BuildRequires:	libXaw-devel


%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 PostScript Type 1 font rasterizer
Group: 		programming
Requires: 	%{name} = %{epoch}:%{version}-%{release}
Provides: 	%{name}-devel = %{version}-%{release}

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


%package static-devel
Summary:        Static libraries for PostScript Type 1 font rasterizer
Group: 		programming
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 for manipulating Type 1 font
Group: 		graphics
License: 	GPLv2+
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.


%debug_package


%prep
%setup -q
%patch0 -p1
%patch1 -p1 -b .segf
%patch2 -p1 -b .afm-fix
%patch3 -p1 -b .type1-inv-rw-fix
%patch4 -p1 -b .aarch64
%patch5 -p1 -b .format-security

# use debian patches directly instead of duplicating them
#patch -p1 < debian/patches/segfault.diff -b -z .segf
patch -p1 < debian/patches/no-config.diff
patch -p1 < debian/patches/no-docs.diff
patch -p1 < debian/patches/lib-cleanup.diff

iconv -f latin1 -t utf8 < Changes > Changes.utf8
touch -r Changes Changes.utf8
mv Changes.utf8 Changes


%build
%configure
#export tagname=CC
perl -pi -e 's,-DGLOBAL_CONFIG_DIR="\\"/usr/share/t1lib\\"",-DGLOBAL_CONFIG_DIR="\\"/etc/t1lib\\"",;' Makefile
# remove rpaths
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool

make %{?_smp_mflags} without_doc 
touch -r lib/t1lib/t1lib.h.in lib/t1lib.h
touch -r lib/t1lib/t1libx.h lib/t1libx.h
ln README.t1lib-%{version} README
sed -e 's;/usr/share/X11/fonts;%{_datadir}/X11/fonts;' \
  -e 's;/usr/share/fonts/type1;%{_datadir}/fonts %{_datadir}/texmf/fonts;' \
  -e 's;/etc/t1lib/;%{_datadir}/t1lib/;' \
 debian/t1libconfig > t1libconfig
touch -r README.t1lib-%{version} t1libconfig


%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT INSTALL='install -p'
rm $RPM_BUILD_ROOT%{_libdir}/libt1*.la
chmod a+x $RPM_BUILD_ROOT%{_libdir}/libt1*.so.*

mkdir -p $RPM_BUILD_ROOT%{_mandir}/man{1,5,8}
install -p -m 644 debian/man/FontDatabase.5 $RPM_BUILD_ROOT%{_mandir}/man5/
install -p -m 644 debian/man/t1libconfig.8 $RPM_BUILD_ROOT%{_mandir}/man8/
install -p -m 644 debian/man/type1afm.1 $RPM_BUILD_ROOT%{_mandir}/man1/
install -p -m 644 debian/man/xglyph.1 $RPM_BUILD_ROOT%{_mandir}/man1/
touch -r README.t1lib-%{version} $RPM_BUILD_ROOT%{_mandir}/man?/*.*

mkdir -p $RPM_BUILD_ROOT%{_sbindir}
install -p -m 755 t1libconfig $RPM_BUILD_ROOT%{_sbindir}/

mkdir -p $RPM_BUILD_ROOT%{_datadir}/t1lib/
touch $RPM_BUILD_ROOT%{_datadir}/t1lib/{FontDatabase,t1lib.config}

%post
%{?ldconfig}
%{_sbindir}/t1libconfig --force > /dev/null

%ldconfig_postun


%clean
rm -rf $RPM_BUILD_ROOT


%files -n %{name}
%defattr(-,root,root)
%license LGPL LICENSE
%doc Changes README.t1*
%dir %{_datadir}/t1lib
%ghost %verify(not size mtime md5) %{_datadir}/t1lib/t1lib.config
%ghost %verify(not size mtime md5) %{_datadir}/t1lib/FontDatabase
%{_libdir}/libt1*.so.*
%{_mandir}/man5/*
%{_mandir}/man8/*
%{_sbindir}/t1libconfig

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

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

%files -n %{name}-progs
%defattr(-,root,root)
%license LICENSE
%{_bindir}/*
%{_mandir}/man1/*


%changelog
* Mon Mar 08 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 5.1.2-5
- re-imported all patches from rawhide.

* Sun Aug 03 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 5.1.2-4
- rebuild with VineSeed environment

* Mon Jan 16 2012 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 5.1.2-3
- add patch10 for fix CVE-2010-2642 (AFM font metrics parser)
  CVE-2011-0433 is fixed on the this patch.
- add patch11 for fix CVE-2011-0764 (AFM font metrics parser)
  CVE-2011-0764, CVE-2011-1552, 53, 54 are fixed by this patch
- add Vendor/Distri Tags 

* Fri Jun 03 2011 Daisuke SUZUKI <daisuke@linux.or.jp> 5.1.2-2
- add BR: texlive-common

* Sun May 15 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 5.1.2-1
- updated to 5.1.2
- added Patch3 from Fedora

* Mon Apr 25 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 5.0.2-3
- rebuild with current VineSeed
- use BR: texlive instead of tetex

* 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
