File gnuchess.spec of Package gnuchess

#
# spec file for package gnuchess (Version 5.07)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild


Name:           gnuchess
BuildRequires:  bison flex readline-devel
Url:            http://www.gnu.org/software/chess/chess.html
License:        GPLv2+
Group:          Amusements/Games/Board/Chess
Provides:       chess_backend
Provides:       gchess
AutoReqProv:    on
Version:        5.07
Release:        145
Summary:        GNU Chess Program
Source:         %{name}-%{version}.tar.bz2
# WARNING: Don't forget to re-generate book.dat manually before submit!
# Simply remove the source and build, updated book will be generated.
Source1:        book_1.01.pgn.bz2
Source2:        book.dat.bz2
Source3:        genbook.sh
Source4:        gnuchess.6
Patch0:         gnuchess-nonstatic.diff
Patch1:         gnuchess-getline.diff
# PATCH-FIX-OPENSUSE gnuchess-5.07-fix-missing-fclose.patch bnc#534576
Patch2:         gnuchess-5.07-fix-missing-fclose.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
A worthy chess opponent that runs in text mode. Find an X11 interface
in the xboard package.



Authors:
--------
    Hans Eric Sandstrom <hes@log-sv.se>
    Stuart Cracraft <cracraft@rice-chex.ai.mit.edu>
    Mike McGann <mwm@hslrswi.hasler.ascom.ch>
    Philippe Schnoebelen <phs@lifia.imag.fr>
    Tim Mann <mann@src.dec.com>

%prep
%setup
%patch0
%patch1

%build
CFLAGS="$RPM_OPT_FLAGS"
./configure --prefix=%{_prefix} \
    --mandir=%{_mandir} \
    --datadir=%{_datadir}
sed '/\/usr\/lib\/games\/gnuchess\/book\.dat/d;s:/usr/share/games:%{_datadir}:' <src/book.h >src/book.h~
mv src/book.h~ src/book.h
make

%install
if [ -f %{SOURCE2} ] ; then
    bzcat %{SOURCE2} >book.dat
else
    sh %{SOURCE3} %{SOURCE1}
fi
rm -rf doc/CVS
make DESTDIR=$RPM_BUILD_ROOT install
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man6
cp %{SOURCE4} $RPM_BUILD_ROOT%{_mandir}/man6
mkdir -p $RPM_BUILD_ROOT%{_datadir}/gnuchess
cp book.dat $RPM_BUILD_ROOT%{_datadir}/gnuchess

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%{_prefix}/bin/*
%{_mandir}/man*/*
%{_datadir}/gnuchess
%doc AUTHORS COPYING ChangeLog NEWS README TODO doc

%changelog