File openrct2.spec of Package openrct2

#
# spec file for package openrct2
#
# 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/
#


%define lib_suffix %{nil}
%ifarch x86_64
  %define lib_suffix 64
%endif

Name:           openrct2
Version:        0.2.1
Release:        0
Summary:        An open source re-implementation of Roller Coaster Tycoon 2
License:        GPL-3.0
Group:          Amusements/Games/Strategy/Other
Url:            http://openrct2.website/
Source0:        https://github.com/OpenRCT2/OpenRCT2/archive/v%{version}/OpenRCT2-%{version}.tar.gz
Source1:        https://github.com/OpenRCT2/title-sequences/releases/download/v0.1.2/title-sequence-v0.1.2.zip
Source2:        https://github.com/OpenRCT2/objects/releases/download/v1.0.6/objects.zip
BuildRequires:  cmake >= 3.8
%if 0%{?suse_version} > 1325
BuildRequires:  gcc-c++ >= 6
%else
BuildRequires:  gcc6-c++
%endif
BuildRequires:  glibc-devel
BuildRequires:  hicolor-icon-theme
BuildRequires:  pkgconfig
BuildRequires:  shared-mime-info
BuildRequires:  unzip
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(fontconfig)
BuildRequires:  pkgconfig(gl)
BuildRequires:  pkgconfig(icu-uc) >= 59.0
BuildRequires:  pkgconfig(jansson) >= 2.5
BuildRequires:  pkgconfig(libcurl)
BuildRequires:  pkgconfig(libpng16)
BuildRequires:  pkgconfig(libzip) >= 1.0
BuildRequires:  pkgconfig(openssl) >= 1.0.0
BuildRequires:  pkgconfig(sdl2)
BuildRequires:  pkgconfig(speexdsp)
BuildRequires:  pkgconfig(zlib)
Recommends:     zenity
# TODO: or KDialog
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
An open source clone of RollerCoaster Tycoon 2
that depends on the original game assets. On first
game start it will create a ~/.config/OpenRCT2/config.ini file
where the game_path = "" setting has to be set to a directory
into which the original game has been installed to.

%prep
%setup -q -n OpenRCT2-%{version}

# Remove build time references so build-compare can do its work
sed -i "s/__DATE__/\"openSUSE\"/" src/openrct2/Version.h
sed -i "s/__TIME__/\"Build Service\"/" src/openrct2/Version.h

%build
# cmake macro doesn't work https://github.com/OpenRCT2/OpenRCT2/issues/5910
mkdir build
cd build
cmake -DDOWNLOAD_TITLE_SEQUENCES=OFF -DDOWNLOAD_OBJECTS=OFF \
%if 0%{?suse_version} < 1325
      -DCMAKE_C_COMPILER=/usr/bin/gcc-6 -DCMAKE_CXX_COMPILER=/usr/bin/g++-6 \
%endif
      -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} -DBUILD_SHARED_LIBS=ON \
      -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
make all g2

%install
%cmake_install

mkdir -p %{buildroot}%{_datadir}/%{name}/title
pushd %{buildroot}%{_datadir}/%{name}/title
  unzip %{SOURCE1}
popd

# We do that in the correct docdir in the files section.
rm -rf %{buildroot}%{_datadir}/doc

%post
%desktop_database_post
%icon_theme_cache_post
%mime_database_post

%postun
%desktop_database_postun
%icon_theme_cache_postun
%mime_database_postun

%files
%defattr(-, root, root)
%doc licence.txt distribution/changelog.txt distribution/readme.txt
%{_bindir}/openrct2
%{_bindir}/openrct2-cli
%{_libdir}/libopenrct2.so
%{_mandir}/man6/openrct2.*
%{_datadir}/openrct2/
%{_datadir}/icons/hicolor/*/apps/*
%{_datadir}/applications/*.desktop
%dir %{_datadir}/metainfo/
%{_datadir}/metainfo/openrct2.appdata.xml
%{_datadir}/mime/packages/openrct2.xml

%changelog
openSUSE Build Service is sponsored by