File crafty.spec of Package crafty

#
# spec file for package crafty
#
# Copyright (c) 2013 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/
#


Name:           crafty
Version:        23.4
Release:        0
License:        Contact author
Summary:        Chess Program
Url:            http://www.craftychess.com/
Group:          Amusements/Games/Board/Chess
Source0:        http://www.craftychess.com/%{name}-%{version}.zip
# http://www.craftychess.com/book.bin
Source1:        book-%{version}.bin
# Files from http://www.cis.uab.edu/hyatt/crafty/ for compiling/using crafty
# *****
# NOTE*
# *****
# Please run "sh update_crafty-data.sh" to update the files in "crafty-data.tar.bz2"
# "wget" package is required to make the update
# *****
Source2:        crafty-data.tar.bz2
# Custom files for compiling/using crafty
Source10:       README.openSUSE
Source11:       crafty.6
Source12:       crafty.rc
Source13:       make_books
Source14:       xcrafty
# Script to update "crafty-data.tar.bz2"
Source100:      update_crafty-data.sh
# PATCH-FIX-UPSTREAM crafty-23.2-security-203541.patch deb#203541 -- Don't strcpy argv[1]
Patch0:         crafty-23.2-security-203541.patch
# PATCH-FEATURE-OPENSUSE Makefile.patch -- Use the 'right' compiler flags for openSUSE
Patch1:         Makefile.patch
# PATCH-FEATURE-OPENSUSE paths.patch -- Use FHS pathnames for distribution packages
Patch2:         paths.patch
# PATCH-FIX-OPENSUSE numacompat1.patch asterios.dramis@gmail.com -- Add missing include for numacompat1.h
Patch3:         numacompat1.patch
# PATCH-FIX-OPENSUSE ix86.patch asterios.dramis@gmail.com -- Fix compilation in ix86
Patch4:         ix86.patch
%if 0%{?suse_version}
BuildRequires:  fdupes
%endif
BuildRequires:  gcc-c++
%ifarch x86_64
%if 0%{?suse_version}
BuildRequires:  libnuma-devel
%else
BuildRequires:  numactl-devel
%endif
%endif
BuildRequires:  unzip
%if 0%{?suse_version}
Recommends:     xboard
Suggests:       esound-utils
%endif
Provides:       chess_backend
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
A strong playing chess program. It uses opening books and endgame
databases. The graphical interface (xcrafty) requires the xboard
package.

%prep
%setup -q -a 2
%patch0
%patch1
%patch2 -p1
%patch3
%ifarch %ix86
%patch4
%endif
mv crafty-data/*.pgn .
pushd crafty-data/
tar zxf bitmaps.tgz
chmod 755 bitmaps
chmod 644 bitmaps/*
rm -f bitmaps/gifs.tar
unzip sound.zip
rm -f speak
popd
cp -a %{SOURCE10} %{SOURCE13} .
mkdir .crafty
touch .craftyrc .crafty/book.bin .crafty/bookc.bin .crafty/books.bin

%build
%ifarch x86_64
make CFLAGS="%{optflags}" CXFLAGS="%{optflags}" linux-amd64
%else
make CFLAGS="%{optflags}" CXFLAGS="%{optflags}" linux
%endif
/bin/sh make_books

%install
install -Dpm 0755 crafty %{buildroot}%{_bindir}/crafty
install -pm 0755 %{SOURCE14} %{buildroot}%{_bindir}/xcrafty
install -pm 0755 speak %{buildroot}%{_bindir}/crafty-speak
install -Dpm 0644 %{SOURCE11} %{buildroot}%{_mandir}/man6/crafty.6
ln -s crafty.6.gz %{buildroot}%{_mandir}/man6/xcrafty.6.gz
install -dm 0755 %{buildroot}%{_datadir}/crafty/bitmaps
install -dm 0755 %{buildroot}%{_datadir}/crafty/sound
install -dm 0755 %{buildroot}%{_datadir}/crafty/TB
install -pm 0644 %{SOURCE1} %{buildroot}%{_datadir}/crafty/book.bin
install -pm 0644 bookc.bin books.bin crafty.hlp %{buildroot}%{_datadir}/crafty/
install -pm 0644 crafty-data/bitmaps/* %{buildroot}%{_datadir}/crafty/bitmaps/
cp -a crafty-data/sound/* %{buildroot}%{_datadir}/crafty/sound/
install -pm 0644 crafty-data/*.emd %{buildroot}%{_datadir}/crafty/TB/
install -Dpm 0644 %{SOURCE12} %{buildroot}%{_sysconfdir}/crafty.rc
%if 0%{?suse_version}
%fdupes %{buildroot}
%endif

%files
%defattr(-,root,root,-)
%doc crafty-data/{crafty.doc.ascii,crafty.doc.ps,read.me,tournament.howto}
%doc README.openSUSE
%{_bindir}/crafty
%{_bindir}/xcrafty
%{_bindir}/crafty-speak
%{_mandir}/man6/crafty.6.gz
%{_mandir}/man6/xcrafty.6.gz
%{_datadir}/crafty/
%config(noreplace) %{_sysconfdir}/%{name}.rc

%changelog
openSUSE Build Service is sponsored by