File freeciv.spec of Package freeciv

#
# spec file for package freeciv
#
# 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:           freeciv
Version:        2.6.0
Release:        0
Summary:        Free Civilization Clone
License:        GPL-2.0-or-later
Group:          Amusements/Games/Strategy/Turn Based
URL:            http://www.freeciv.org
Source0:        http://files.freeciv.org/stable/%{name}-%{version}.tar.xz
Source1:        freeciv-gtk3.desktop
Source3:        freeciv.png
Source4:        freeciv-manual
Source5:        freeciv-manual.desktop
Source6:        freeciv-manual.png
Patch99:        fix-wand-detection.patch
BuildRequires:  pkgconfig
BuildRequires:  SDL_mixer-devel
BuildRequires:  audiofile-devel
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  curl-devel >= 7.9.7
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  gtk3-devel
BuildRequires:  pkgconfig(bzip2)
BuildRequires:  pkgconfig(liblzma)
BuildRequires:  libggz2-devel
BuildRequires:  libtool
BuildRequires:  readline-devel
BuildRequires:  lua53-devel
BuildRequires:  mysql-devel
BuildRequires:  pkgconfig(MagickWand)
BuildRequires:  pkgconfig(SDL2_mixer)
BuildRequires:  pkgconfig(sqlite3)
BuildRequires:  update-desktop-files
BuildRequires:  python-base
Requires:       freeciv_client-%{version}
requires:       lib%{name}0 = %{version}
%if 0%{?suse_version} >= 1320
Source2:        freeciv-qt.desktop
%endif
%if 0%{?suse_version} >= 1320
BuildRequires:  libqt5-qtbase-common-devel
BuildRequires:  libqt5-qtbase-devel
%endif

%description
A clone of the well known game Civilization by Microprose.

Every player is the leader of an imaginary nation. The aim of the game
can be to create a prospering civilization with commerce and knowledge
exchange or (more often) the extinction of all other civilizations.

To start a new game, first start the server 'civserver,' then start the
client 'civclient'. Have fun!

%if 0%{?suse_version} >= 1320
%package qt
Summary:        Qt client for freeciv
Group:          Amusements/Games/Strategy/Turn Based
Requires:       freeciv = %{version}
Provides:       freeciv_client-%{version}
requires:       lib%{name}0 = %{version}

%description qt
Freeciv executable using Qt library
%endif

%package gtk3
Summary:        Gtk3 client for freeciv
Group:          Amusements/Games/Strategy/Turn Based
Requires:       freeciv = %{version}
Provides:       freeciv_client-%{version}
Obsoletes:      freeciv-gtk2
requires:       lib%{name}0 = %{version}

%description gtk3
Freeciv executable using Gtk3 library

%package -n lib%{name}0
Summary:        Gtk3 client for freeciv
Group:          Amusements/Games/Strategy/Turn Based

%description -n lib%{name}0
Freeciv executable using Gtk3 library

%package -n lib%{name}-devel
Summary:        Gtk3 client for freeciv
Group:          Amusements/Games/Strategy/Turn Based
requires:       lib%{name}0 = %{version}

%description -n lib%{name}-devel
Freeciv executable using Gtk3 library

%prep
%setup -q
%patch99
echo "X-SuSE-translate=false" >> bootstrap/freeciv-server.desktop.in
echo "X-SuSE-translate=false" >> bootstrap/freeciv-modpack.desktop.in
echo "X-SuSE-translate=false" >> bootstrap/freeciv-ruledit.desktop.in

%build
%if 0%{?suse_version} >= 1320
export MOCCMD="moc-qt5"
%endif
autoreconf -fi
%configure \
%if 0%{?suse_version} >= 1320
  --enable-client=gtk3,qt \
%else
  --enable-client=gtk3 \
%endif
  --with-readline \
  --disable-static \
  --with-libbz2 \
  --with-liblzma \
  --enable-ipv6=yes \
  --enable-aimodules=yes \
  --enable-sdl-mixer \
  --enable-ruledit \
  --enable-shared \
  --enable-sys-lua \
  --enable-mapimg=magickwand \
  --enable-fcdb=sqlite3 \
  --docdir=%{_docdir}/freeciv \
  --disable-sys-tolua-cmd
make %{?_smp_mflags}

%install
%make_install
install -m 755 $RPM_SOURCE_DIR/freeciv-manual %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_datadir}/pixmaps/
install -m 644 $RPM_SOURCE_DIR/*.png %{buildroot}%{_datadir}/pixmaps
rm %{buildroot}%{_datadir}/applications/%{name}.desktop
%suse_update_desktop_file -i %{name}-gtk3 Game StrategyGame
%if 0%{?suse_version} >= 1320
%suse_update_desktop_file -i %{name}-qt Game StrategyGame
%endif
%suse_update_desktop_file -i freeciv-manual Game StrategyGame
%if 0%{?sles_version} == 11
rm -rf %{buildroot}/%{_datadir}/locale/no
%endif
#% suse_update_desktop_file -i freeciv-ruledit Game StrategyGame

%find_lang %{name}-core
%find_lang %{name}-nations
%find_lang %{name}-ruledit
%fdupes %{buildroot}/%{_datadir}/

%post -n lib%{name}0 -p /sbin/ldconfig
%postun -n lib%{name}0 -p /sbin/ldconfig

%files -f %{name}-core.lang -f %{name}-nations.lang -f %{name}-ruledit.lang
%doc %{_docdir}/freeciv
%exclude %{_docdir}/freeciv/INSTALL*
%exclude %{_libdir}/*.la
%{_mandir}/man6/freeciv-*.6%{?ext_man}
%dir %{_sysconfdir}/%{name}
%config %{_sysconfdir}/%{name}/database.lua
%{_bindir}/freeciv-server
%{_bindir}/freeciv-manual
%{_bindir}/freeciv-ruledit
%{_bindir}/freeciv-ruleup
%{_datadir}/applications/freeciv-manual.desktop
%{_datadir}/applications/freeciv-server.desktop
%{_datadir}/applications/freeciv-ruledit.desktop
%{_datadir}/freeciv/
%{_datadir}/icons/hicolor/128x128/apps/freeciv-client.png
%{_datadir}/icons/hicolor/128x128/apps/freeciv-server.png
%{_datadir}/icons/hicolor/128x128/apps/freeciv-modpack.png
%{_datadir}/icons/hicolor/16x16/apps/freeciv-client.png
%{_datadir}/icons/hicolor/16x16/apps/freeciv-server.png
%{_datadir}/icons/hicolor/16x16/apps/freeciv-modpack.png
%{_datadir}/icons/hicolor/32x32/apps/freeciv-client.png
%{_datadir}/icons/hicolor/32x32/apps/freeciv-server.png
%{_datadir}/icons/hicolor/32x32/apps/freeciv-modpack.png
%{_datadir}/icons/hicolor/48x48/apps/freeciv-client.png
%{_datadir}/icons/hicolor/48x48/apps/freeciv-server.png
%{_datadir}/icons/hicolor/48x48/apps/freeciv-modpack.png
%{_datadir}/icons/hicolor/64x64/apps/freeciv-client.png
%{_datadir}/icons/hicolor/64x64/apps/freeciv-server.png
%{_datadir}/icons/hicolor/64x64/apps/freeciv-modpack.png
%{_datadir}/pixmaps/freeciv-client.png
%{_datadir}/pixmaps/freeciv-manual.png
%{_datadir}/pixmaps/%{name}.png
%dir %{_datadir}/appdata
%{_datadir}/appdata/freeciv-server.appdata.xml
%{_datadir}/appdata/freeciv-ruledit.appdata.xml

%files gtk3
%{_bindir}/freeciv-gtk3
%{_bindir}/freeciv-mp-gtk3
%{_datadir}/applications/%{name}-gtk3.desktop
%{_datadir}/appdata/freeciv-gtk3.appdata.xml
%{_datadir}/applications/freeciv-mp-gtk3.desktop
%{_datadir}/appdata/freeciv-mp-gtk3.appdata.xml

%if 0%{?suse_version} >= 1320
%files qt
%{_bindir}/freeciv-qt
%{_datadir}/applications/%{name}-qt.desktop
%{_datadir}/appdata/freeciv-qt.appdata.xml
%endif

%files -n lib%{name}0
%{_libdir}/lib%{name}.so.*
%{_libdir}/lib%{name}-srv.so.*

%files -n lib%{name}-devel
%{_libdir}/lib%{name}.so
%{_libdir}/lib%{name}-srv.so

%changelog