File xboard.spec of Package xboard

#
# spec file for package xboard
#
# Copyright (c) 2018 SUSE LINUX 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:           xboard
Version:        4.9.1
Release:        0
Summary:        X Window System Interface for playing chess
License:        GPL-3.0+
Group:          Amusements/Games/Board/Chess
Url:            http://www.gnu.org/software/xboard/
Source:         http://ftp.gnu.org/pub/gnu/xboard/%{name}-%{version}.tar.gz
# https://pgp.mit.edu
# Source3:        xboard.keyring
# PATCH-FIX-OPENSUSE xboard-prefer-gnuchess.patch
Patch0:         xboard-prefer-gnuchess.patch
BuildRequires:  automake
BuildRequires:  autoconf
BuildRequires:  cairo-devel
BuildRequires:  gtk2-devel >= 2.20.0
%if 0%{?fedora_version}
BuildRequires:  librsvg2-devel
%else
BuildRequires:  librsvg-devel
%endif
# BuildRequires:  pango-devel
BuildRequires:  pkgconfig
BuildRequires:  texinfo
# BuildRequires:  texlive-latex
%if 0%{?fedora_version}
# https://src.fedoraproject.org/rpms/desktop-file-utils
BuildRequires:  desktop-file-utils
%else
BuildRequires:  update-desktop-files
%endif
BuildRequires:  xdg-utils
# BuildRequires:  xorg-x11-devel
# BuildRequires:  xorg-x11-libXt-devel
%if 0%{?suse_version} < 1330
BuildRequires:  hicolor-icon-theme
BuildRequires:  shared-mime-info
%endif
Requires:       chess_backend
Recommends:     gnuchess
%if 0%{?suse_version}
Requires(post): %{install_info_prereq}
Requires(preun): %{install_info_prereq}
%endif
# next 2 required on Fedora and openSUSE
# Suggests: libicu-devel
# Suggests: xpdf-libs

%description
XBoard is a graphical user interface for chess in all its major forms, including international chess, xiangqi (Chinese chess), shogi Japanese chess) and Makruk, in addition to many minor variants such as Losers Chess, Crazyhouse, Chess960 and Capabanca Chess. It displays a chessboard on the screen, accepts moves made with the mouse, and loads and saves games in Portable Game Notation (PGN). It serves as a front-end for many different chess services, including:

    * Chess engines that will run on your machine and play a game against you or help you analyze, such as GNU Chess, Crafty, or many others.

    * Chess servers on the Internet, where you can connect to play chess with people from all over the world, watch other users play, or just hang out and chat.

    * Correspondence chess played by electronic mail. The CMail program automates the tasks of parsing email from your opponent, playing his moves out on your board, and mailing your reply move after you have chosen it.

%if 0%{?fedora_version}
%{!?ext_man: %define ext_man .gz}
%{!?ext_info: %define ext_info .gz}
%endif

%prep
%setup -q
%patch -P 0 -p 1

%build
autoreconf -i -f -s
%configure --disable-silent-rules --enable-zippy --disable-update-mimedb
make %{?_smp_mflags}

%install
%make_install
%find_lang %{name} %{name}.lang
mkdir -p  %{buildroot}/%{_datadir}/icons/hicolor/32x32/mimetypes
mkdir -p  %{buildroot}/%{_datadir}/icons/hicolor/48x48/mimetypes
mv %{buildroot}/%{_datadir}/games/xboard/pixmaps/textures/ini32.png %{buildroot}/%{_datadir}/icons/hicolor/32x32/mimetypes/application-x-chess-opt.png
mv %{buildroot}/%{_datadir}/games/xboard/pixmaps/textures/ini48.png %{buildroot}/%{_datadir}/icons/hicolor/48x48/mimetypes/application-x-xboard-opt.png
mv %{buildroot}/%{_datadir}/games/xboard/pixmaps/textures/board32.png %{buildroot}/%{_datadir}/icons/hicolor/32x32/mimetypes/application-x-chess-pgn.png
mv %{buildroot}/%{_datadir}/games/xboard/pixmaps/textures/cross32.png %{buildroot}/%{_datadir}/icons/hicolor/32x32/mimetypes/application-x-xboard-trn.png
mv %{buildroot}/%{_datadir}/games/xboard/pixmaps/textures/board48.png %{buildroot}/%{_datadir}/icons/hicolor/48x48/mimetypes/application-x-chess-pgn.png
mv %{buildroot}/%{_datadir}/games/xboard/pixmaps/textures/cross48.png %{buildroot}/%{_datadir}/icons/hicolor/48x48/mimetypes/application-x-xboard-trn.png
%if 0%{?suse_version}
%suse_update_desktop_file -i %{name} Game BoardGame
%suse_update_desktop_file -i -u %{name}-tourney Game BoardGame
%suse_update_desktop_file -i -u %{name}-pgn-viewer Game BoardGame
%suse_update_desktop_file -i -u %{name}-fen-viewer Game BoardGame
%else
# https://docs.fedoraproject.org/en-US/packaging-guidelines/
desktop-file-install --add-category="Game" --dir=%{buildroot}%{_datadir}/applications %{buildroot}/%{_datadir}/applications/%{name}.desktop 
desktop-file-install --add-category="Game" --dir=%{buildroot}%{_datadir}/applications %{buildroot}/%{_datadir}/applications/%{name}-tourney.desktop
desktop-file-install --add-category="Game" --dir=%{buildroot}%{_datadir}/applications %{buildroot}/%{_datadir}/applications/%{name}-pgn-viewer.desktop
desktop-file-install --add-category="Game" --dir=%{buildroot}%{_datadir}/applications %{buildroot}/%{_datadir}/applications/%{name}-fen-viewer.desktop
%endif

# avoid packaged vs. installed errors of the openSUSE build service..
rm -rf %{buildroot}/%{_infodir}/dir

%post
%if 0%{?suse_version} < 1330
%mime_database_post
%desktop_database_post
%icon_theme_cache_post
%endif
%if 0%{?fedora_version}
%desktop_database_post
install-info --info-dir=%{_infodir} %{_infodir}/%{name}.info.gz
%else
%install_info --info-dir=%{_infodir} %{_infodir}/%{name}.info.gz
%endif

%preun
%if 0%{?fedora_version}
install-info --quiet --delete --info-dir=%{_infodir} %{_infodir}/%{name}.info.gz
%else
%install_info_delete --info-dir=%{_infodir} %{_infodir}/%{name}.info.gz
%endif

%if 0%{?suse_version} < 1330
%postun
%mime_database_postun
%desktop_database_postun
%icon_theme_cache_postun
%endif
%if 0%{?fedora_version}
%desktop_database_postun
%endif

%files -f %{name}.lang
%license COPYING
%doc AUTHORS ChangeLog COPYRIGHT FAQ.html DIFFSTAT SHORTLOG NEWS README TODO engine-intf.html ics-parsing.txt readme.htm zippy.README
%{_bindir}/*
%{_mandir}/man6/*.*
%{_infodir}/xboard.info%{?ext_info}
%{_datadir}/applications/*.desktop
%{_datadir}/mime/packages/*.xml
%dir %{_datadir}/games/xboard
%dir %{_datadir}/games/xboard/sounds/
%dir %{_datadir}/games/xboard/themes
%dir %{_datadir}/games/xboard/themes/conf/
%dir %{_datadir}/games/xboard/themes/default/
%dir %{_datadir}/games/xboard/themes/shogi/
%dir %{_datadir}/games/xboard/themes/xiangqi/
%dir %{_datadir}/games/xboard/themes/textures/
%{_datadir}/games/xboard/sounds/*
%{_datadir}/games/xboard/themes/conf/*
%{_datadir}/games/xboard/themes/default/*svg
%{_datadir}/games/xboard/themes/shogi/*svg
%{_datadir}/games/xboard/themes/xiangqi/*svg
%{_datadir}/games/xboard/themes/textures/*png
%{_datadir}/icons/hicolor/48x48/apps/%{name}.png
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
%{_datadir}/icons/hicolor/48x48/mimetypes/*png
%{_datadir}/icons/hicolor/32x32/mimetypes/*png
%config %{_sysconfdir}/%{name}.conf

%changelog
openSUSE Build Service is sponsored by