Summary: An interactive spelling checker program.
Name: ispell
Version: 3.1.20
Release: 28%{?_dist_release}
Group: Applications/Text
License: GPL
URL: http://www.cs.hmc.edu/~geoff/ispell.html
Source0: ftp://prep.ai.mit.edu/pub/gnu/ispell-3.1.20.tar.gz
Source1: spell
Source10: idanish-1.2.1.tar.gz
Source11: hk2-deutsch.tar.gz 
Source12: espa%7Enol-1.5.tar.gz
Source13: francais-IREQ-1.4.tar.gz
Source14: dutch96.tar.gz
Source15: ispell-norsk-1.1a.tar.gz
Source16: portugues.tar.gz
Source17: iswedish-1.2.1.tar.gz
Source18: italian.tar.gz
Source19: ispellcat.tar.gz
Source20: iczech.tar.gz
Source21: polish.tar.gz
Source22: ellhnika.tar.gz
Source23: ispell-rus-1.1.tar.gz
Source24: eo-spell.tgz

Patch0: ispell-3.1.20-config.patch
Patch1: ispell-3.1.20-german.patch 

Patch3: ispell-3.1.20-termio.patch
Patch4: ispell-3.1.20-mask.patch
Patch5: ispell-3.1.20-strcmp.patch
Patch6: ispell-3.1.20-jbj.patch
Patch7: ispell-3.1.20-dict.patch
Patch8: ispell-sed.patch
Patch9: ispell-3.1.20-grep.patch
Patch10: ispell-3.1.20-openbsd.patch
Patch100: ispell-3.1.20-vine.patch
Patch101: ispell-3.1.20-buildhash.patch
Patch102: ispell-3.1.20-mask-vine.patch
Patch103: ispell-3.1.20-dict-vine.patch
Patch104: ispell-3.1.20-link.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: words, ncurses-devel, byacc, perl, sed

%description
Ispell is an interactive spelling checker.  Ispell can check text
files or standard input for spelling and typographical errors.  When
it finds a word that is not in the dictionary, it will suggest
correctly spelled words for the misspelled word. Ispell is faster and
easier to use than UNIX spell, and it can handle languages other than
English.

You should install ispell if you need a program for spell checking
(and who dosn't?).

%package catalan
Summary: Ispell spelling checker files for checking Catalan words.
Group: Applications/Text
%description catalan
Ispell is an interactive spelling checker. The ispell-catalan package
contains files that Ispell needs in order to generate a dictionary of
Catalan words. If you need a Catalan dictionary for Ispell, you'll
need to install this package, ispell, and ispell-dicts.

%package czech
Summary: Ispell spelling checker files for Czech words.
Group: Applications/Text
%description czech
Ispell is an interactive spelling checker. The ispell-czech package
contains files needed to generate a dictionary of Czech words for
Ispell. If you need a Czech dictionary for Ispell, you'll need to
install this package, ispell and ispell-dicts.

%package danish
Summary: Ispell spelling checker files for Danish words.
Group: Applications/Text
%description danish
Ispell is an interactive spelling checker. The ispell-danish package
contains files needed to generate an Ispell dictionary of Danish
words. If you need a Danish dictionary for Ispell, you'll need to
install this package, ispell and ispell-dicts.

%package dutch
Summary: Files needed to create an Ispell dictionary of Dutch words.
Group: Applications/Text
%description dutch
Ispell is an interactive spelling checker. The ispell-dutch package
contains files needed to generate an Ispell dictionary of Dutch
words. If you need a Dutch Ispell dictionary, you should install this
package, ispell and ispell-dicts.

%package esperanto
Summary: Files needed to generate an Ispell dictionary of Esperanto words.
Group: Applications/Text
%description esperanto
Ispell is an interactive spelling checker. The ispell-esperanto
package contains files needed to generate an Ispell dictionary of
Esperanto words. If you need an Ispell dictionary of Esperanto words,
you should install this package, ispell and ispell-dicts.

%package french
Summary: Files needed to generate an Ispell dictionary of French words.
Group: Applications/Text
%description french
Ispell is an interactive spelling checker. The ispell-french package
contains files needed to generate an Ispell dictionary of French
words. If you need an Ispell dictionary of French words, you should
install this package, ispell and ispell-dicts.

%package german
Summary: Files needed to generate an Ispell dictionary of German words.
Group: Applications/Text
%description german
Ispell is an interactive spelling checker. The ispell-german package
contains files needed to generate an Ispell dictionary of German
words. If you need an Ispell dictionary of German words, you should
install this package, ispell and ispell-dicts.

%package greek
Summary: Files needed to generate an Ispell dictionary of Greek words.
Group: Applications/Text
%description greek
Ispell is an interactive spelling checker. The ispell-greek package
contains files needed to generate an Ispell dictionary of Greek
words. If you need an Ispell dictionary of Greek words, you should
install this package, ispell and ispell-dicts.

%package italian
Summary: Files needed to generate an Ispell dictionary of Italian words.
Group: Applications/Text
%description italian
Ispell is an interactive spelling checker. The ispell-italian package
contains files needed to generate an Ispell dictionary of Italian
words. If you need an Ispell dictionary of Italian words, you should
install this package, ispell and ispell-dicts.

%package norwegian
Summary: Files needed to generate an Ispell dictionary of Norwegian words.
Group: Applications/Text
%description norwegian
Ispell is an interactive spelling checker. The ispell-norwegian
package contains files needed to generate an Ispell dictionary of
Norwegian words.  If you need an Ispell Norwegian dictionary, you
should install this package, ispell and ispell-dicts.

%package polish
Summary: Files needed to generate an Ispell dictionary of Polish words.
Group: Applications/Text
%description polish
Ispell is an interactive spelling checker. The ispell-polish package
contains files needed to generate an Ispell dictionary of Polish
words. If you need an Ispell dictionary of Polish words, you should
install this package, ispell and ispell-dicts.

%package portuguese
Summary: Files needed to generate an Ispell dictionary of Portuguese words.
Group: Applications/Text
%description portuguese
Ispell is an interactive spelling checker. The ispell-portuguese
package contains files needed to generate an Ispell dictionary of
Portuguese words. If you need an Ispell dictionary of Portuguese
words, you should install this package, ispell and ispell-dicts.

%package russian
Summary: Files needed to generate an Ispell dictionary of Russian words.
Group: Applications/Text
%description russian
Ispell is an interactive spelling checker. The ispell-russian package
contains files needed to generate an Ispell dictionary of Russian
words. If you need an Ispell dictionary of Russian words, you should
install this package, ispell and ispell-dicts.

%package spanish
Summary: Files needed to generate an Ispell dictionary of Spanish words.
Group: Applications/Text
%description spanish
Ispell is an interactive spelling checker. The ispell-spanish package
contains files needed to generate an Ispell dictionary of Spanish
words. If you need an Ispell dictionary of Spanish words, you should
install this package, ispell and ispell-dicts.

%package swedish
Summary: Files needed to generate an Ispell dictionary of Swedish words.
Group: Applications/Text
%description swedish
Ispell is an interactive spelling checker. The ispell-swedish package
contains files needed to generate an Ispell dictionary of Swedish
words. If you need an Ispell dictionary of Swedish words, you should
install this package, ispell and ispell-dicts.

%package dicts
Summary: Files for generating non-English Ispell dictionaries.
Group: Applications/Text
%description dicts
The ispell-dicts package contains files needed for generating Ispell
dictionaries in languages other than English. Ispell is an interactive
spelling checker.

%prep
%setup -q -n ispell-3.1 -a 10 -a 12 -a 17 -a 20 -a 23 -a 24

mkdir dicts

lang=danish
dir=dicts/$lang
mv idanish-1.2.1 $dir
mv -f $dir/Makefile{,.dist} || :
cp $dir/* languages/dansk

lang=german
dir=dicts/$lang
mkdir $dir
tar xzf %SOURCE11 -C $dir
mv -f $dir/Makefile{,.dist} || :
cp $dir/*.txt $dir/*.aff $dir/*README languages/deutsch
mv $dir/deutsch.aff{,-hk}

lang=spanish
dir=dicts/$lang
mv espa~nol-1.5 $dir
ln -sf espa~nol.words+ $dir/espanol.dict
mv -f $dir/Makefile{,.dist} || :
cp $dir/* languages/espanol

lang=french
dir=dicts/$lang
mkdir $dir
tar xzf %SOURCE13 -C $dir
mv -f $dir/Makefile{,.dist} || :
cp $dir/* languages/francais

lang=dutch
dir=dicts/$lang
mkdir $dir
tar xzf %SOURCE14 -C $dir
ln -sf dutch96.aff $dir/nederlands.aff
ln -sf dutch96.lat $dir/nederlands.lat
cp dicts/dutch/* languages/nederlands

lang=norwegian
dir=dicts/$lang
mkdir $dir
tar xzf %SOURCE15 -C $dir
ln -sf norsk.7bit $dir/norsk.aff
cp dicts/norwegian/* languages/norsk

lang=portuguese
dir=dicts/$lang
tar xzf %SOURCE16 -C ./dicts/
mv dicts/portugues $dir
cp dicts/portuguese/* languages/portugues

lang=swedish
dir=dicts/$lang
mv iswedish-1.2.1 $dir
mv -f $dir/Makefile{,.dist} || :
cp dicts/swedish/* languages/svenska

lang=italian
dir=dicts/$lang
mkdir $dir
tar xzf %SOURCE18 -C $dir
mv -f $dir/Makefile{,.dist} || :

lang=catalan
dir=dicts/$lang
mkdir $dir
tar xzf %SOURCE19 -C $dir

lang=czech
dir=dicts/$lang
mv iczech $dir
mv -f $dir/Makefile{,.dist} || :

lang=polish
dir=dicts/$lang
mkdir $dir
tar xzf %SOURCE21 -C dicts

lang=greek
dir=dicts/$lang
mkdir $dir
tar xzf %SOURCE22 -C $dir

lang=russian
dir=dicts/$lang
mv ispell-rus-1.1 $dir
mv -f $dir/Makefile{,.dist} || :

lang=esperanto
dir=dicts/$lang
mv eo $dir
ln -sf eo.aff $dir/esperanto.aff

%patch0 -p1
%patch1

%patch3 -p1 -b .termio

# This patch conflicts with patch101, so remake it as patch102 and apply later
#%ifarch alpha
#%patch4 -p1 -b .mask
#%endif

%patch5 -p1 -b .strcmp
%patch6 -p1 -b .jbj
%patch7 -p1 -b .dictpat
%patch8 -p1

%patch9 -p1 -b .grep

%patch10 -p1 -b .openbsd
%patch100 -p1 -b .vine
%patch101 -p1 -b .buildhash
%ifarch alpha
%patch102 -p1 -b .mask
%endif
%patch103 -p1 -b .vine-dict
%patch104 -p1 -b .link

%build

# Make config.sh first
TMPDIR=/var/tmp PATH=.:$PATH make config.sh
perl -pi -e "s/-O/$RPM_OPT_FLAGS -fexpensive-optimizations -fno-force-mem -pipe/" config.sh


# Now save build-rooted version (with time-stamp) for install ...
cp config.sh config.sh.BUILD
sed -e "s,/usr/,$RPM_BUILD_ROOT/usr/,g" < config.sh.BUILD > config.sh.INSTALL

# and then make everything
TMPDIR=/var/tmp PATH=.:$PATH make

install -c -m 0644 languages/fix8bit.c dicts/fix8bit.c
find dicts -name '*.dictpat' -exec rm -f {} \;
PATH=.:$PATH make -C dicts all

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_mandir}
mkdir -p $RPM_BUILD_ROOT/usr/lib/emacs/site-lisp
mkdir -p $RPM_BUILD_ROOT%{_infodir}

# Roll in the build-root'ed version (with time-stamp!)
rm -rf config.sh
ln config.sh.INSTALL config.sh
# ad-hoc solution to install man/info pages into _mandir/_infodir
cat >> config.sh << __EOF__
MAN1DIR='%{buildroot}%{_mandir}/man1'
MAN4DIR='%{buildroot}%{_mandir}/man5'
TEXINFODIR='%{buildroot}%{_infodir}'
__EOF__

TMPDIR=/var/tmp PATH=.:$PATH LIBDIR=$RPM_BUILD_ROOT/usr/lib/ispell make install

mv $RPM_BUILD_ROOT%{_infodir}/ispell $RPM_BUILD_ROOT%{_infodir}/ispell.info
gzip -9nf $RPM_BUILD_ROOT%{_infodir}/ispell.info

install -m 755 %SOURCE1 $RPM_BUILD_ROOT/usr/bin/spell

PATH=.:$PATH make -C dicts DESTDIR=$RPM_BUILD_ROOT install
( cd $RPM_BUILD_ROOT
  ln -sf deutschlxg.hash ./usr/lib/ispell/german.hash
  ln -sf deutschlxg.hash ./usr/lib/ispell/deutsch.hash
  ln -sf americanmed+.hash ./usr/lib/ispell/english.hash
)

mkdir -p $RPM_BUILD_ROOT/usr/share
tar cf - dicts | (cd $RPM_BUILD_ROOT/usr/share; tar xf -)

( cd $RPM_BUILD_ROOT/usr/share
  find dicts -name '*.cnt' -exec rm -f {} \;
  find dicts -name '*.stat' -exec rm -f {} \;
  find dicts -name '*.hash' -exec rm -f {} \;
)

# fix me!
# if any file is exceutable, it gets error at find-provides or find-requires
chmod 644 $RPM_BUILD_ROOT/usr/share/dicts/norwegian/expand.sh
chmod 644 $RPM_BUILD_ROOT/usr/share/dicts/norwegian/munch.sh
chmod 644 $RPM_BUILD_ROOT/usr/bin/findaffix
chmod 644 $RPM_BUILD_ROOT/usr/bin/munchlist
chmod 644 $RPM_BUILD_ROOT/usr/bin/tryaffix

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc README
# ELF
/usr/bin/buildhash
/usr/bin/icombine
/usr/bin/ijoin
/usr/bin/ispell
/usr/bin/sq
/usr/bin/unsq
# sh
/usr/bin/spell
# shell archive or script for antique kernel text?
%defattr(755,root,root)
/usr/bin/findaffix
/usr/bin/munchlist
/usr/bin/tryaffix


%{_infodir}/ispell.info.gz
#/usr/lib/emacs/site-lisp/ispell.el
%{_mandir}/man1/sq.1*
%{_mandir}/man1/buildhash.1*
%{_mandir}/man1/findaffix.1*
%{_mandir}/man1/ispell.1*
%{_mandir}/man1/munchlist.1*
%{_mandir}/man1/tryaffix.1*
%{_mandir}/man1/unsq.1*
%{_mandir}/man5/ispell.5*
%{_mandir}/man5/english.5*

%dir /usr/lib/ispell

/usr/lib/ispell/american.hash
/usr/lib/ispell/americanmed+.hash
/usr/lib/ispell/americanxlg.hash
/usr/lib/ispell/british.hash
/usr/lib/ispell/britishmed+.hash
/usr/lib/ispell/britishxlg.hash
/usr/lib/ispell/english.hash
/usr/lib/ispell/english.aff

%files catalan
%defattr(-,root,root)
%doc		dicts/catalan/LLEGEIX
         	/usr/lib/ispell/catala.aff
         	/usr/lib/ispell/catala.hash

%files czech
%defattr(-,root,root)
%doc		dicts/czech/README
         	/usr/lib/ispell/czech.aff
         	/usr/lib/ispell/czech.hash

%files danish
%defattr(-,root,root)
%doc		dicts/danish/{COPYING,danish.html}
         	/usr/lib/ispell/dansk.aff
         	/usr/lib/ispell/dansk.hash

%files dutch
%defattr(-,root,root)
%doc		dicts/dutch/README
         	/usr/lib/ispell/nederlands.aff
         	/usr/lib/ispell/nederlands.hash

%files esperanto
%defattr(-,root,root)
%doc		dicts/esperanto/{README,legumin.l3}
         	/usr/lib/ispell/esperanto.aff
         	/usr/lib/ispell/esperanto.hash

%files french
%defattr(-,root,root)
%doc		dicts/french/{LISEZMOI,COPYING,MANIFEST,ChangeLog}
         	/usr/lib/ispell/francais.aff
         	/usr/lib/ispell/francais.hash

%files german
%defattr(-,root,root)
%doc		dicts/german/{README,ANNOUNCE,Changes,Contributors}
         	/usr/lib/ispell/german.hash
         	/usr/lib/ispell/deutsch.hash
         	/usr/lib/ispell/deutsch.aff
         	/usr/lib/ispell/deutschlxg.hash
         	/usr/lib/ispell/deutschmed.hash

%files greek
%defattr(-,root,root)
         	/usr/lib/ispell/ellhnika.aff
         	/usr/lib/ispell/ellhnika.hash

%files italian
%defattr(-,root,root)
%doc		dicts/italian/README
         	/usr/lib/ispell/italian.aff
         	/usr/lib/ispell/italian.hash

%files norwegian
%defattr(-,root,root)
%doc		dicts/norwegian/README
         	/usr/lib/ispell/norsk.aff
         	/usr/lib/ispell/norsk.hash

%files polish
%defattr(-,root,root)
         	/usr/lib/ispell/polish.aff
         	/usr/lib/ispell/polish.hash

%files portuguese
%defattr(-,root,root)
%doc		dicts/portuguese/README
         	/usr/lib/ispell/portugues.aff
         	/usr/lib/ispell/portugues.hash

%files russian
%defattr(-,root,root)
%doc		dicts/russian/docs/{INSTALL.russian,Readme.russian,copyright,cyrispell,readme.makedict}
         	/usr/lib/ispell/russian.aff
         	/usr/lib/ispell/russian.hash

%files spanish
%defattr(-,root,root)
%doc		dicts/spanish/{LEAME,README}
         	/usr/lib/ispell/espanol.aff
         	/usr/lib/ispell/espanol.hash

%files swedish
%defattr(-,root,root)
%doc		dicts/swedish/{LaeSMIG,COPYING,Copyright}
         	/usr/lib/ispell/svenska.aff
         	/usr/lib/ispell/svenska.hash

%files dicts
%defattr(-,root,root)
%dir		/usr/share/dicts
/usr/share/dicts/fix8bit
%lang(ca)	/usr/share/dicts/catalan
%lang(cs)	/usr/share/dicts/czech
%lang(da)	/usr/share/dicts/danish
%lang(eo)	/usr/share/dicts/esperanto
%lang(fr)	/usr/share/dicts/french
%lang(de)	/usr/share/dicts/german
%lang(el)	/usr/share/dicts/greek
%lang(it)	/usr/share/dicts/italian
%lang(pl)	/usr/share/dicts/polish
%lang(pt)	/usr/share/dicts/portuguese
%lang(ru)	/usr/share/dicts/russian
%lang(es)	/usr/share/dicts/spanish
%lang(sv)	/usr/share/dicts/swedish

%lang(no)	/usr/share/dicts/norwegian
%defattr(755,root,root)
/usr/share/dicts/norwegian/*.sh

%changelog
* Wed Aug 20 2008 Shu KONNO <owa@bg.wakwak.com> 3.1.20-28vl5
- applied new versioning policy
- changed executable permission of some files temporarily for building

* Thu Oct 10 2002 Yoshihiro Ota <ota@j.email.ne.jp> 3.1.20-27vl5
- Fixed bug that corrupts soft and hard links after spell check

* Thu Mar 21 2002 Yoshihiro Ota <ota@j.email.ne.jp> 3.1.20-27vl4
- Looks at /usr/share/dict/words on (L)ookup, i.e. grep -E

* Fri Dec 21 2001 Tomoya TAKA <taka@vinelinux.org> 3.1.20-27vl3
- Patch4 conflicts with Patch101, so remake it as Patch102

* Wed Dec 19 2001 Toru Sagami <sagami@vinelinux.org> 3.1.20-27vl2
- added ispell-3.1.20-buildhash.patch to build correctly (taken from SuSE)

* Sat Aug 18 2001 Toru Sagami <sagami@vinelinux.org>
- 3.1.20-27vl1: was ported to VineSeed from rh62 updates
- mv Source12 espa%7Enol-1.5.tar.gz (side effect of rpm in Vine)
- install man/info pages into %%{_mandir}/%%{_infodir}

* Wed May 30 2001 Trond Eivind Glomsrƒi <teg@redhat.com>
- Replace the mkstemp patch with patch aa, ac and ad from 
  OpenBSD - this also converts some instances of gets to fgets

* Thu May 24 2001 Trond Eivind Glomsrƒi <teg@redhat.com>
- Use mkstemp instead of mktemp. Patch by 
  jhuuskon@hytti.uku.fi (#42210)

* Fri Feb 04 2000 Nalin Dahyabhai <nalin@redhat.com>
- add URL

* Wed Feb 02 2000 Cristian Gafton <gafton@redhat.com>
- fix descriptions
- man pages are compressed

* Fri Nov 19 1999 Michael K. Johnson <johnsonm@redhat.com>
- grep is in /bin, not /usr/bin
- removed lang(foo) from all language-specific packages.
- made the spell script a better clone of the old spell program.

* Tue Aug 31 1999 Bill Nottingham <notting@redhat.com>
- sed is in /bin, not /usr/bin

* Mon Aug 30 1999 Jeff Johnson <jbj@redhat.com>
- build *.hash and *.aff from dicts not languages.
- better russian dictionary.

* Sun Aug 29 1999 Jeff Johnson <jbj@redhat.com>
- add British English and dictionaries.

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

* Thu Feb 25 1999 Bill Nottingham <notting@redhat.com>
- add a buildroot

* Tue Jan 12 1999 Michael K. Johnson <johnsonm@redhat.com>
- strcmp may have different forms on different systems;
  do not declare it explicitly, just include <string.h>
- use /var/tmp instead of /usr/tmp

* Sun Nov 8 1998 Patricia Jung <trish@freiburg.linux.de>
- Added German dictionary

* Mon Sep 28 1998 Jeff Johnson <jbj@redhat.com>
- eliminate /usr/lib/emacs/site-lisp/ispell.el -- use emacs-20.3 version.

* Mon Jun 29 1998 Jeff Johnson <jbj@redhat.com>
- use posix termios (problem #558)
- add build root.

* Sat Jun 27 1998 Trent Jarvi <jarvi@ezlink.com>
- alphahack patch no longer required. struct winsize now in <ioctl-types.h>.
- change MASKWIDTH apropriately on alpha

* Sat May 09 1998 Prospector System <bugs@redhat.com>
- translations modified for de, fr, tr

* Sat May 09 1998 Erik Troan <ewt@redhat.com>
- have two Source1 lines isn't terribly brilliant

* Thu Apr 30 1998 Cristian Gafton <gafton@redhat.com>
- patch to avoid remaking ispell.info

* Thu Jul 10 1997 Erik Troan <ewt@redhat.com>
- built against glibc

* Thu Mar 06 1997 Michael K. Johnson <johnsonm@redhat.com>
- Added a spell program.
- Configured for 8-bit use.
