Blob Blame History Raw
%global pre     alpha
%global title   BrutalChess

#global buildtex  0

Name:           brutalchess
Version:        0.5.2
Release:        0.1.%{pre}%{?dist}
Summary:        Chess game with impressive 3D graphics

License:        GPLv2+
URL:            http://sf.net/projects/%{name}
##we don't want the original fonts due to legal reasoning
#http://sf.net/projects/%{name}/files/%{name}-%{pre}/%{name}-%{pre}-%{version}/%{name}-%{pre}-%{version}-src.tar.gz
Source0:        %{name}-%{pre}-%{version}-nofonts.tar.xz
Source1:        %{name}-nofonts.sh

Patch0:         https://sf.net/p/%{name}/patches/8/attachment/%{name}-freetype2.patch
# fonts: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=584416
Patch1:         https://sf.net/p/%{name}/patches/7/attachment/%{name}-fonts.diff

# features later:
# FIXME crafty https://sourceforge.net/p/brutalchess/patches/4/
# FIXME PGN https://sourceforge.net/p/brutalchess/patches/3/
# FIXME -l option https://sourceforge.net/p/brutalchess/patches/2/

Source10:       http://slackbuilds.org/slackbuilds/14.1/games/%{name}/%{name}.desktop
Source11:       http://slackbuilds.org/slackbuilds/14.1/games/%{name}/%{name}.png
Patch10:        http://slackbuilds.org/slackbuilds/14.1/games/%{name}/%{name}-%{version}-fix-FTBFS.patch
Patch11:        http://slackbuilds.org/slackbuilds/14.1/games/%{name}/%{name}-%{version}-gcc4.3.patch
Patch12:        http://slackbuilds.org/slackbuilds/14.1/games/%{name}/%{name}-%{version}-gcc4.7.patch

BuildRequires:  libXt-devel mesa-libGL-devel libXi-devel libXmu-devel
BuildRequires:  SDL-devel SDL_image-devel
BuildRequires:  freetype-devel
BuildRequires:  gnu-free-mono-fonts gnu-free-sans-fonts gnu-free-serif-fonts
BuildRequires:  dos2unix doxygen
%if 0%{?buildtex:1}
BuildRequires:  tex2html
BuildRequires:  %{_bindir}/latex texlive-texconfig
BuildRequires:  %{_bindir}/dvips %{_bindir}/ps2pdf %{_bindir}/psnup
%endif
BuildRequires:  desktop-file-utils


%description
%{title} features full 3D graphics, an advanced particle engine, 
and several different levels of intelligent AI, inspired by the once 
popular "Battle Chess" released by Interplay circa 1988.


%package doc
Summary:        Additional documentation files for the game %{title}
BuildArch:      noarch
Requires:       %{name} = %{version}-%{release}

%description doc
Extra documentation files for the game %{title}, like doxygen withfor
html and latex formats.


%prep
%setup -q
sed -i s,fonts,, Makefile.in
%patch0 -p0
%patch1 -p1
%patch10
%patch11
%patch12 -p1
dos2unix NEWS README
doxygen -u


%build
##FIXME libXt support is a feature
%configure --with-x
make %{?_smp_mflags}
doxygen

##distribute tex
cd doc
mv latex refman
cd refman
%if 0%{?buildtex:1}
# FIXME is the html from tarball generated from tex?
tex2html refman.tex
# FIXME latex issues ahead!
#make pdf
#make ps_2on1 pdf_2on1
#make all
rm *.tex
%endif
make clean


%install
%make_install

##misplaced content
rm -r %{buildroot}%{_datadir}/%{name}/doc

##desktop
desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{SOURCE10}
install -d %{buildroot}%{_datadir}/pixmaps
cp -p %{SOURCE11} %{buildroot}%{_datadir}/pixmaps

##fonts configuration made legally
##FIXME ugly hackery with symlinks for fixed file names,
##could change in future, maybe better ask upstream to patch source
install -d %{buildroot}%{_datadir}/%{name}/fonts
pushd %{buildroot}%{_datadir}/%{name}/fonts
find -name \*.TTF -or -name \*.tff -delete
ln -s ../../fonts/gnu-free/FreeSerifBold.ttf COOLVETI.TTF
ln -s ../../fonts/gnu-free/FreeSerif.ttf Ghostwri.ttf
ln -s ../../fonts/gnu-free/FreeMono.ttf VeraMono.ttf
ln -s ../../fonts/gnu-free/FreeSans.ttf ZERO__.TTF
popd

##doxygen
install -d %{buildroot}%{_pkgdocdir}
cp -ap doc/html %{buildroot}%{_pkgdocdir}


%files
%doc AUTHORS COPYING ChangeLog NEWS README
# engine
%{_bindir}/%{name}
%{_libexecdir}/md3view
%{_libexecdir}/objview
# desktop & icon
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png
# data
%{_datadir}/%{name}/
#%{_datadir}/%{name}/art/
#%{_datadir}/%{name}/models/
# fonts
#%{_datadir}/%{name}/fonts/

%files doc
%dir %{_pkgdocdir}
%doc doc/html/
%doc doc/refman/


%changelog
* Mon Dec 15 2014 Raphael Groner <projects.rg [AT] smart.ms> - 0.5.2-0.1.alpha
- original by Timur Kristóf (rhbz#701812)
- fixes for new review (rhbz#1157213)
- fix broken BR for Xorg
- remove subpackages
- additional doc package
- desktop stuff and gcc patches from Slackware
- link freetype2 properly
- replace fonts, patch adopted from Debian
- macro title in description
- enhance documentation with doxygen and latex