File scid_vs_pc.spec of Package scid_vs_pc

Name:           scid_vs_pc
Version:        4.26
Release:        0
Summary:        A chess database application
Group:          Amusements/Games/Board/Chess
License:        GPL-2.0-or-later
URL:            http://sourceforge.net/projects/scidvspc
Source0:        https://sourceforge.net/projects/scidvspc/files/source/%{name}-%{version}.tgz
Source1:        %{name}.desktop
Patch0:         %{name}-fix-world-writeable.patch
Patch1:         %{name}-strip-binaries.patch
Patch2:         %{name}-no-install-fonts.patch
Source3:        %{name}-exec-names.patch
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  tcl-devel
BuildRequires:  tk-devel
BuildRequires:  desktop-file-utils
BuildRequires:  update-desktop-files
#BuildRequires:  xorg-x11-devel
BuildRequires:  libstdc++-devel
BuildRequires:  lsb-release
Requires:       tcl
Requires:       tk
Suggests:       stockfish
Conflicts:      scid

%description
Shane's Chess Information Database is a huge chess toolkit with extensive
database, analysis, and chess-playing features.

Scid vs. PC is a usability and bug-fix fork of Scid. It has extensive interface
fixes and improvements and is fully compatible with Scid's .si4 databases.
Its new features include a rewitten Gamelist, a Computer Tournament, and FICS,
Tree, and Book improvements.

%prep
%autosetup
## Remove unneeded exec bit for doc
chmod -x doc/ScidvsMac-HowTo.rtfd.tgz
patch -p1 < %{SOURCE3}

for file in engines/toga/readme.txt; do
    mv $file timestamp
    iconv -f ISO-8859-1 -t UTF-8 -o $file timestamp
    touch -r timestamp $file
    rm -f timestamp
done

%build
# use modern compiler on suse

./configure \
        BINDIR=%{_bindir} \
        SHAREDIR=%{_datadir}/%{name}

# BASH_ENV messes with the include path and with GCC 6 (F24+)
# messing with the include path causes stdlib.h to not be
# found.  See https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/37NHYB3UYTO7K53N3H535MUNVCIDGT3O/
#make WARNINGS='-w' LDFLAGS='-lX11' BASH_ENV='' CXXFLAGS="${RPM_OPT_FLAGS}"
make

%install
mkdir -p %{buildroot}/%{_docdir}/%{name}/ezsmtp
mkdir -p %{buildroot}/%{_licensedir}/%{name}/ezsmtp
mv tcl/contrib/ezsmtp/{ChangeLog,ezsmtp.html,koi8-r-body.txt,README.txt,test_examples.txt} %{buildroot}/%{_docdir}/%{name}/ezsmtp
mv tcl/contrib/ezsmtp/license.txt %{buildroot}/%{_licensedir}/%{name}/ezsmtp

make DESTDIR=%{buildroot} install

desktop-file-install \
        --dir %{buildroot}/%{_datadir}/applications \
        %{SOURCE1}

install -m 755 -d %{buildroot}/%{_datadir}/icons/hicolor/128x128/apps/
install -m 644 -p icons/scid.png %{buildroot}%{_datadir}/icons/hicolor/128x128/apps/

install -m 755 -d %{buildroot}/%{_datadir}/%{name}/sounds/
install -m 644 -p sounds/*.wav %{buildroot}/%{_datadir}/%{name}/sounds/

install -m 755 -d %{buildroot}/%{_datadir}/%{name}/images/
install -m 644 -p images/* %{buildroot}/%{_datadir}/%{name}/images/

install -m 755 -d %{buildroot}/%{_datadir}/%{name}/photos/

install -m 755 -d %{buildroot}/%{_datadir}/%{name}/fonts
install -m 644 -p fonts/*.ttf %{buildroot}/%{_datadir}/%{name}/fonts/

install -m 755 -d %{buildroot}/%{_datadir}/%{name}/bitmaps/
install -m 644 -p bitmaps/*.gif %{buildroot}/%{_datadir}/%{name}/bitmaps/

install -m 755 -d %{buildroot}/%{_datadir}/%{name}/bitmaps2/
install -m 644 -p bitmaps2/*.gif %{buildroot}/%{_datadir}/%{name}/bitmaps2/

install -m 755 -d %{buildroot}/%{_datadir}/%{name}/books/
install -m 644 -p books/* %{buildroot}/%{_datadir}/%{name}/books/

install -m 777 -d %{buildroot}/%{_datadir}/%{name}/bases/
install -m 666 -p bases/* %{buildroot}/%{_datadir}/%{name}/bases/

mv COPYING %{buildroot}/%{_licensedir}/%{name}
mkdir %{buildroot}/%{_docdir}/%{name}/{toga,phalanx}
mkdir %{buildroot}/%{_licensedir}/%{name}/{toga,phalanx}

# Rename various executables to prevent RPM conflicts with original SCID
mv %{buildroot}/%{_bindir}/{sc_remote,%{name}_remote}

mv %{buildroot}/%{_bindir}/{scid,%{name}}
mv %{buildroot}/%{_bindir}/{scidpgn,%{name}_pgn}
mv %{buildroot}/%{_bindir}/{tkscid,%{name}_tkscid}

## Fix duplicates
%fdupes %{buildroot}
## Already set as docs
rm -f %{buildroot}%{_datadir}/scid/books/readme.txt

%files
%defattr(-,root,root,-)
%docdir %{_docdir}/%{name}/
%{_docdir}/%{name}/
%{_licensedir}/%{name}/
%{_datadir}/%{name}/
%{_bindir}/*
%{_datadir}/applications/*
%dir %{_datadir}/icons/hicolor/128x128/apps/
%dir %{_datadir}/icons/hicolor/128x128/
%dir %{_datadir}/icons/hicolor/
%dir %{_datadir}/icons/
%attr(0644,root,root) %{_datadir}/icons/hicolor/128x128/apps/scid.png
%attr(0644,root,root) %{_datadir}/%{name}/engines/*/*
%attr(0755,root,root) %{_datadir}/%{name}/bases
%attr(0644,root,root) %{_datadir}/%{name}/bases/*

%post
update-desktop-database &> /dev/null || :

%postun
update-desktop-database &> /dev/null || :

%posttrans
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :


%changelog
openSUSE Build Service is sponsored by