Summary: Converts text and other types of files to PostScript(TM).
Summary(ja): テキストなどのPostscriptへのフィルタ
Name: a2ps
Version: 4.13b
Release: 56%{?_dist_release}
License: GPL
Group: Applications/Publishing
URL: http://www.inf.enst.fr/~demaille/a2ps/
Source: ftp://ftp.enst.fr/pub/unix/a2ps/%{name}-%{version}.tar.gz 
Source1: ftp://ftp.enst.fr/pub/unix/a2ps/i18n-fonts-0.1.tar.gz
Source2: a2ps.sh
Patch0: a2ps-4.13-conf.patch
Patch1: a2ps-4.13-etc.patch
Patch2: a2ps-4.13-flex.patch
Patch3: a2ps-4.13-security.patch
Patch4: a2ps-4.13-glibcpaper.patch
Patch5: a2ps-4.13-varargs.patch
Patch6: a2ps-tmpdir.patch
Patch7: a2ps-sort.patch
# EUC-JP support
Patch10: a2ps-4.13-eucjp.patch.bz2
Patch11: a2ps-4.13-autoenc.patch
Patch12: a2ps-4.13b-attr.patch
Patch13: a2ps-4.13b-numeric.patch
Patch14: a2ps-4.13b-encoding.patch
Patch15: a2ps-4.13b-tilde.patch
Patch16: a2ps-4.13b-rm.patch
Patch17: a2ps-4.13-euckr.patch
Patch18: a2ps-4.13-gnusource.patch
Patch19: a2ps-4.13-bison.patch
Patch20: a2ps-4.13-hebrew.patch
Patch21: a2ps-4.13-malloc.patch
Patch22: a2ps-shell.patch
Patch23: a2ps-includes.patch
Patch24: a2ps-underquoted.patch
Patch25: a2ps-autoconf.patch
Patch26: a2ps-make-fonts-map.patch
Patch27: a2ps-netscape.patch
Patch28: a2ps-wdiff.patch
Patch29: a2ps-U.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: emacsen, gperf, flex, automake, autoconf, texinfo
Requires: fileutils, sh-utils, info, mktemp
Requires: psutils, ghostscript
Obsoletes: a2ps-i18n
Provides: a2ps-i18n
Vendor: Project Vine
Distribution: Vine Linux

# Vine Patches
Patch100: a2ps-4.13b-ptex.patch
Patch101: a2ps-4.13-po.patch
Patch102: a2ps-4.13-printers.patch
Patch103: a2ps-4.13-pdf.patch
Patch104: a2ps-4.13-x86_64.patch

%description
The a2ps filter converts text and other types of files to PostScript(TM).
A2ps has pretty-printing capabilities and includes support for a wide
number of programming languages, encodings (ISO Latins, Cyrillic, etc.),
and medias.

%description -l ja
a2psは優れた印刷能力をもった, テキストを PostScriptへ変換するフィルタ
です。
これは、プログラム言語や文字コード(ISO Latins, Cyrillic, EUC-JP等)、
用紙、(インタフェースに対して)NLSなどを広範囲にサポートしています。
いくつかのファイルを別のアプリケーションでフィルタリングさせる機能も持っ
ており、DVIや PostScript等を全く同じインタフェースで区別することなく印
刷することができます。

%prep
%setup -q -n %{name}-4.13 -a 1
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1 -b .security
%patch4 -p1 -b .glibcpaper
%patch5 -p1
%patch6 -p1 -b .tmpdir
%patch7 -p1 -b .sort

%patch10 -p1 -b .euc
%patch11 -p1 -b .ae
%patch12 -p1 -b .attr

# Use C locale's decimal point style (bug #53715).
%patch13 -p1 -b .numeric

# Use locale to determine a sensible default encoding (bug #64584).
%patch14 -p1 -b .encoding

# Fix koi8 tilde (bug #66393).
%patch15 -p1 -b .tilde

# Prevent configure from going interactive (bug #70333).
%patch16 -p1 -b .rm

# Add Korean resource file (bug #81421).
%patch17 -p1 -b .euckr

# Prevent strsignal segfaulting (bug #104970).
%patch18 -p1 -b .gnusource

# Fix problems in .y file spotted by stricter bison.
%patch19 -p1 -b .bison

# Hebrew support (bug #113191).
%patch20 -p1 -b .hebrew

# Prevent "error: conflicting types for 'malloc'".
%patch21 -p1 -b .malloc

# Use environment variable to pass filenames to shell (bug #128647).
%patch22 -p1 -b .shell

# Apply patch from bug #122699 to fix "too many includes" error.
%patch23 -p1 -b .includes

# Fixed m4 files.
%patch24 -p1 -b .underquoted

# Fixed configure.in.
%patch25 -p1 -b .autoconf

# Fix problems in make_fonts_map script (bug #142299).  Patch from
# Michal Jaegermann.
%patch26 -p1 -b .make-fonts-map

# Don't try to run netscape.  Run mozilla instead (bug #121393).
%patch27 -p1 -b .netscape

# Make pdiff default to not requiring wdiff (bug #68537).
%patch28 -p1 -b .wdiff

# Make pdiff use diff(1) properly (bug #156916).
%patch29 -p1 -b .U

#
# Vine patches
#

# use ptex, platex, jbibtex instead of tex, latex, bibtex
%patch100 -p1 -b .ptex

# year-month-day fix
#%patch101 -p0 -b .po

# default output to stdout
%patch102 -p0 -b .print

# for ps2pdf
%patch103 -p1 -b .pdf

# for x86_64
%patch104 -p0 -b .x86_64

# Fix reference to a2ps binary (bug #112930).
perl -pi -e "s,/usr/local/bin,%{_bindir}," contrib/emacs/a2ps.el

%__libtoolize --copy --force
%__cp %{_datadir}/aclocal/libtool.m4 m4/
%__aclocal -I m4
%__autoconf

%build
chmod 644 {po/ja.po,encoding/euc-jp.edf,README.eucJP}.euc
chmod 644 encoding/euc-kr.edf.euckr
touch `find $PWD`
EMACS=emacs ./configure \
  --prefix=%{_prefix} \
  --libdir=%{_libdir} \
  --sysconfdir=%{_sysconfdir} \
  --infodir=%{_infodir} \
  --mandir=%{_mandir} \
  --datadir=%{_datadir} \
  --with-medium=_glibc \
  --enable-kanji

# Remove prebuilt info files to force regeneration at build time
find . -name "*.info*" -exec rm -f {} \;
# force rebuilding scanners by flex - patched or not
find src lib -name '*.l' -exec touch {} \;
# these scanners use 'lineno' - incompatible with -CFe flex flags
(
    cd src
    /bin/sh ../auxdir/ylwrap "flex" sheets-map.l lex.yy.c sheets-map.c --
    /bin/sh ../auxdir/ylwrap "flex" lexssh.l lex.yy.c lexssh.c --
    cd ../lib
    /bin/sh ../auxdir/ylwrap "flex" lexppd.l lex.yy.c lexppd.c --
)

make CFLAGS="$RPM_OPT_FLAGS"

%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install

mkdir -p %{buildroot}%{_datadir}/a2ps/{afm,fonts}
pushd i18n-fonts-0.1/afm
install -m 0644 *.afm %{buildroot}%{_datadir}/a2ps/afm
pushd ../fonts
install -m 0644 *.pfb %{buildroot}%{_datadir}/a2ps/fonts
popd
popd

# for ja_JP.UTF-8
mv %{buildroot}%{_bindir}/a2ps %{buildroot}%{_bindir}/a2ps.bin
install -c -m 0755 %{SOURCE2} %{buildroot}%{_bindir}/a2ps
ln -sf %{_bindir}/a2ps %{buildroot}%{_bindir}/a2pdf

### FIXME ###
inst()
{
mkdir -p %{buildroot}%{_datadir}/emacs/site-lisp/
for f in contrib/emacs/*.el; do \
  install -m 0644 $f %{buildroot}%{_datadir}/emacs/site-lisp/ ; done
}

rm -f $RPM_BUILD_ROOT%{_infodir}/dir
gzip $RPM_BUILD_ROOT%{_infodir}/* || :

%find_lang %name

%clean
rm -rf $RPM_BUILD_ROOT

%post
/sbin/install-info %{_infodir}/a2ps.info.gz %{_infodir}/dir
/sbin/install-info %{_infodir}/ogonkify.info.gz %{_infodir}/dir
/sbin/install-info %{_infodir}/regex.info.gz %{_infodir}/dir
(cd %{_datadir}/a2ps/afm;
	./make_fonts_map.sh > /dev/null 2>&1 || /bin/true
	if [ -f fonts.map.new ]; then
	    mv fonts.map.new fonts.map
	fi
)

%preun
if [ $1 = 0 ]; then
   /sbin/install-info --delete %{_infodir}/a2ps.info.gz %{_infodir}/dir
   /sbin/install-info --delete %{_infodir}/ogonkify.info.gz %{_infodir}/dir
   /sbin/install-info --delete %{_infodir}/regex.info.gz %{_infodir}/dir
fi

%files -f %{name}.lang
%defattr(-,root,root)
%config (noreplace) %{_sysconfdir}/a2ps.cfg
%config(noreplace) %{_sysconfdir}/a2ps-site.cfg
%doc AUTHORS ChangeLog COPYING NEWS README TODO THANKS
%{_bindir}/*
%{_libdir}/*.a
%{_libdir}/*.la
%{_includedir}/*
%{_infodir}/a2ps.info*
%{_infodir}/ogonkify.info*
%{_infodir}/regex.info*
%{_mandir}/*/*
%config %{_datadir}/a2ps/afm/fonts.map
%{_datadir}/a2ps/afm/*.afm
%{_datadir}/a2ps/afm/make_fonts_map.sh
%{_datadir}/a2ps/README
%{_datadir}/a2ps/encoding
%{_datadir}/a2ps/fonts
%{_datadir}/a2ps/ppd
%{_datadir}/a2ps/ps
%{_datadir}/a2ps/sheets
%{_datadir}/ogonkify/
%{_datadir}/emacs/site-lisp/*
%dir %{_datadir}/a2ps/afm
%dir %{_datadir}/a2ps

%changelog
* Sat Jun 13 2009 KOBAYASHI Taizo <tkoba@vinelinux.org> 4.13b-54
- add x86_64 patch (patch104)

* Thu Apr 30 2009 KOBAYASHI Taizo <tkoba@vinelinux.org> 4.13b-55
- modified a2ps/pf wrapper script for handling utf-8

* Sun Sep 14 2008 Shu KONNO <owa@bg.wakwak.com> 4.13b-54vl5
- applied new versioning policy, spec in utf-8
- fixed typo of release number at Sun Aug 20 2006

#* Sun Aug 20 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 4.13b-30vl5
* Sun Aug 20 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 4.13b-53vl1
- add BuildRequires: emacsen instead of emacs
- add BuildRequires: flex, automake, autoconf
- add Requires: mktemp
- update conf.patch (patch0)
- move {po,printers,pdf}.patch to patch101-103
- not apply po.patch (patch101)
- sync with fedora core's 4.13b-53

  * Fri Jul 14 2006 Tim Waugh <twaugh@redhat.com> 4.13b-53
  - Fixed Hebrew font names (bug #174304).

  * Tue May 30 2006 Tim Waugh <twaugh@redhat.com> 4.13b-51
  - Build requires gettext (bug #193346).

  * Tue Apr  4 2006 Tim Waugh <twaugh@redhat.com> 4.13b-50
  - Use sort correctly in make_font_map.sh (bug #187884).

  * Wed Feb 15 2006 Tim Waugh <twaugh@redhat.com> 4.13b-49
  - Use mktemp in scripts.

  * Thu May  5 2005 Tim Waugh <twaugh@redhat.com> 4.13b-47
  - Make pdiff use diff(1) properly (bug #156916).

  * Wed Mar 23 2005 Tim Waugh <twaugh@redhat.com> 4.13b-46
  - Make pdiff default to not requiring wdiff (bug #68537).

  * Wed Feb  2 2005 Tim Waugh <twaugh@redhat.com> 4.13b-44
  - Don't try to run netscape.  Run mozilla instead (bug #121393).

  * Thu Dec  9 2004 Tim Waugh <twaugh@redhat.com> 4.13b-43
  - Fixed font path (bug #142294).
  - Fixed problems in make_fonts_map script (bug #142299).  Patch from
    Michal Jaegermann.

  * Tue Dec  7 2004 Tim Waugh <twaugh@redhat.com> 4.13b-42
  - Fixed configure.in.
  - Fixed m4 files.
  - Apply patch from bug #122699 to fix "too many includes" error.

  * Tue Oct  5 2004 Tim Waugh <twaugh@redhat.com> 4.13b-41
  - Build requires texinfo (bug #134663).

  * Thu Jul 29 2004 Tim Waugh <twaugh@redhat.com> 4.13b-40
  - Use environment variable to pass filenames to shell (bug #128647).

  * Thu Jun 24 2004 Tim Waugh <twaugh@redhat.com> 4.13b-39
  - Build requires libtool (bug #125823).

  * Mon Mar 22 2004 Tim Waugh <twaugh@redhat.com> 4.13b-37
  - Build requires flex (bug #118892).

  * Tue Mar  2 2004 Tim Waugh <twaugh@redhat.com> 4.13b-35
  - Prevent "error: conflicting types for 'malloc'".

  * Fri Jan 16 2004 Tim Waugh <twaugh@redhat.com> 4.13b-33
  - Post scriptlet requires sed, coreutils (bug #107322).

  * Mon Jan 12 2004 Tim Waugh <twaugh@redhat.com> 4.13b-32
  - Hebrew support (bug #113191).

  * Tue Jan  6 2004 Tim Waugh <twaugh@redhat.com> 4.13b-31
  - Build requires gperf.
  - Fix problems in .y file spotted by stricter bison.
  - Fix reference to a2ps binary (bug #112930).

* Mon Dec 06 2004 KOBAYASHI R. Taizo <tkoba@vinelinux.org> 4.13b-30vl4
- added {pdf,po,printers}.patch
  changed default output dev from printer to stdout.
- added a2pdf and requires ghostscript
- build requires gperf

* Thu Apr 24 2004 Satoshi MACHINO <machino@vinelinux.org> 4.13b-30vl2
- fixed char set in spec
	-- SJIS to EUC-JP

* Mon Dec 22 2003 KOBAYASHI R. Taizo <tkoba@vinelinux.org> 4.13b-30vl1
- modified for Vine
- added patch100 for using ptex and platex instead of tex and latex

* Fri Oct 17 2003 Tim Waugh <twaugh@redhat.com> 4.13b-30
- Prevent strsignal segfaulting (bug #104970).

* Wed Jun 04 2003 Elliot Lee <sopwith@redhat.com>
- rebuilt

* Wed Jan 22 2003 Tim Powers <timp@redhat.com>
- rebuilt

* Thu Jan  9 2003 Tim Waugh <twaugh@redhat.com> 4.13b-27
- Add Korean resource file (bug #81421).

* Tue Jan  7 2003 Jeff Johnson <jbj@redhat.com> 4.13b-26
- don't include -debuginfo files in package.

* Wed Nov 20 2002 Tim Powers <timp@redhat.com>
- rebuild on all arches
- remove lingering files from the buildroot that we aren't shipping
- pass %%{_libdir} and %%{_datadir} to configure so that we are lib64'ized
- fix bad perms on some files

* Mon Aug  5 2002 Tim Waugh <twaugh@redhat.com> 4.13b-24
- Prevent configure from going interactive (bug #70333).
- Try to cope with UTF-8 a little bit (bug #70057).

* Fri Jun 21 2002 Tim Powers <timp@redhat.com> 4.13b-23
- automated rebuild

* Fri Jun 21 2002 Tim Waugh <twaugh@redhat.com> 4.13b-22
- Fix koi8 tilde (bug #66393).

* Thu May 30 2002 Tim Waugh <twaugh@redhat.com> 4.13b-21
- Provide a2ps-i18n (bug #65231).
- Fix default encoding (bug #64584).

* Thu May 23 2002 Tim Powers <timp@redhat.com> 4.13b-20
- automated rebuild

* Mon Feb 25 2002 Tim Waugh <twaugh@redhat.com> 4.13b-19
- Rebuild in new environment.

* Tue Jan 22 2002 Tim Waugh <twaugh@redhat.com> 4.13b-18
- Fix a2ps-4.13-conf.patch (bug #31360).
- Add documentation about the default behaviour concerning LC_PAPER
  (bug #43829).

* Wed Jan 09 2002 Tim Powers <timp@redhat.com> 4.13b-17
- automated rebuild

* Wed Jan  9 2002 Tim Waugh <twaugh@redhat.com>
- Fix build with newer compiler.
- s/Copyright:/License:/.
- Use C locale's decimal point style (bug #53715).

* Fri Jun  1 2001 Oliver Paukstadt <oliver.paukstadt@millenux.com>
- fixed varargs-usage in title.c

* Thu Apr 26 2001 Florian La Roche <Florian.LaRoche@redhat.de>
- call libtoolize to allow easy porting to new archs

* Thu Feb 28 2001 SATO Satoru <ssato@redhat.com>
- bunzip2-ed all patches except eucjp

* Thu Feb 22 2001 SATO Satoru <ssato@redhat.com>
- support Japanese
- bzip2-ed all patches
- replace macros (%%makeinstall, %%configure) with traditional 
  commands to avoid some troubles those macros caused.

* Tue Feb 20 2001 Trond Eivind Glomsr <teg@redhat.com>
- Using letter is as weird as oz, fl. oz, Fahrenheit, lb etc. 
  Add a patch for using the glibc media type for giving US
  letter for en_US (only locale with this paper), and A4
  for everyone else.

* Tue Feb 20 2001 Tim Powers <timp@redhat.com>
- changed default medium back to letter (bug 27794)

* Mon Feb 19 2001 Trond Eivind Glomsr <teg@redhat.com>
- langify
- use %%{_tmppath}

* Mon Feb 12 2001 Tim Waugh <twaugh@redhat.com>
- Fix tmpfile security patch so that it actually _works_ (bug #27155).

* Sun Jan 21 2001 Tim Waugh <twaugh@redhat.com>
- New-style prereq line.
- %%post script requires fileutils (mv) and sh-utils (true).  This
  should fix bug #24251).

* Mon Jan 08 2001 Trond Eivind Glomsr <teg@redhat.com>
- Add /usr/bin/emacs to BuildRequires
- A4
- specify use of GNU Emacs for building

* Fri Jan 05 2001 Preston Brown <pbrown@redhat.com>
- security patch for tmpfile creation from Olaf Kirch <okir@lst.de>

* Mon Dec 11 2000 Preston Brown <pbrown@redhat.com>
- obsoleted old a2ps-i18n package (it was tiny) and included those fonts
  directly here.

* Thu Dec  7 2000 Tim Powers <timp@redhat.com>
- built for dist-7.1

* Mon Aug 07 2000 Tim Powers <timp@redhat.com>
- update to 4.13b to fix some bugs, thanks to czar@acm.org for giving me a
  heads up on this (bug #15679)

* Mon Jul 24 2000 Prospector <prospector@redhat.com>
- rebuilt

* Mon Jul 10 2000 Tim Powers <timp@redhat.com>
- rebuilt

* Fri Jun 23 2000 Tim Powers <timp@redhat.com>
- info pages weren't getting gzipped.
- stdout & stderror redirected to /dev/null in post section

* Mon Jun 19 2000 Tim Powers <timp@redhat.com>
- fixed bug 12451 which was a stupid mistake by me.
- quiet the post section
- added patches from michal@ellpspace.math.ualberta.ca and did some spec file
  magic he suggested as well.

* Fri Jun 2 2000 Tim Powers <timp@redhat.com>
- fixed bug 5876, was not setting the paper size to Letter again :(
- man pages and info pages to /usr/share, FHS compliant.
- used macros wherever possible

* Wed May 31 2000 Tim Powers <timp@rehat.com>
- fixed bug #11078, now requires psutils

* Wed Apr 26 2000 Tim Powers <timp@redhat.com>
- updated to 4.13
- compress man pages

* Thu Feb 10 2000 Tim Powers <timp@redhat.com>
- gzip man pages
- strip binaries

* Mon Jan 24 2000 Tim Powers <timp@redhat.com>
- had to be more specific since the i18n stuff was removed from the package.
	There is a new a2ps-i18n package which treats the
	/usr/share/a2ps/afm/fonts.map file as a config file
	
* Wed Oct 27 1999 Tim Powers <timp@redhat.com>
- added the --with-medium=Letter option to the configure process

* Thu Aug 5 1999 Tim Powers <timp@redhat.com>
- fixed problems with missing dirs as reported in bug 3822
- built for powertools

* Tue Jul 6 1999 Tim Powers <timp@redhat.com>
- rebuilt for powertools 6.1

* Wed May 12 1999 Bill Nottingham <notting@redhat.com>
- add a2ps-site.cfg

* Mon Apr 26 1999 Preston Brown <pbrown@redhat.com>
- update to 4.12 for Powertools 6.0

* Sat Oct 24 1998 Jeff Johnson <jbj@redhat.com>
- narrower range of %files splats.
- install info correctly.
- new description/summary text.

* Tue Oct 06 1998 Michael Maher <mike@redhat.com>
- updated source

* Sat Jul 04 1998 Michael Maher <mike@redhat.com>
- built package
