File gamehub.spec of Package gamehub

#
# spec file for package gamehub
#
# Copyright (c) 2019 Matt Lewandowsky <matt@dunno.wtf>
#
# 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/

# norootforbuild

%define appname		com.github.tkashkin.gamehub

Name:			gamehub
Version:		1
Release:		0
Summary:		All your games in one place
License:		GPL-3.0-or-later
Group:			Amusements/Games/Other
Url:			https://tkashkin.tk/projects/gamehub
Source0:		%{name}-%{version}.tar.xz
Source99:		%{name}-rpmlintrc
# See build below for reason behind obsinfo file
Source100:		%{name}.obsinfo
Icon:			%{name}.gif

BuildRequires:		cmake
BuildRequires:		libmanette-devel
BuildRequires:		meson
BuildRequires:		vala
BuildRequires:		pkgconfig(gdk-3.0)
BuildRequires:		pkgconfig(gee-0.8)
BuildRequires:		pkgconfig(glib-2.0)
BuildRequires:		pkgconfig(granite)
BuildRequires:		pkgconfig(gtk+-3.0)
BuildRequires:		pkgconfig(json-glib-1.0)
BuildRequires:		pkgconfig(libsoup-2.4)
BuildRequires:		pkgconfig(libxml-2.0)
BuildRequires:		pkgconfig(sqlite3)
BuildRequires:		pkgconfig(polkit-gobject-1)
BuildRequires:		pkgconfig(webkit2gtk-4.0)
BuildRequires:		pkgconfig(x11)
BuildRequires:		pkgconfig(xtst)

# libunity is optional
%if 0%{?suse_version} >= 150100
BuildRequires:		libunity-devel
%endif

Recommends:		%{name}-lang = %{version}

Recommends:		file-roller
Recommends:		dosbox
Recommends:		innoextract
Recommends:		scummvm
Recommends:		wine
# Steam's only a suggestion since it's not in an OSS repo.
Suggests:		steam
# Should other things be suggested? MAME and other emulators, maybe?

%if %{defined suse_version}
BuildRequires:		update-desktop-files
Requires(post):		update-desktop-files
Requires(postun):	update-desktop-files
%endif

%if %{defined fedora} || %{defined centos_version} || %{defined rhel_version} || %{defined scientificlinux_version} || %{defined mageia}
BuildRequires:		desktop-file-utils
Requires(post):		desktop-file-utils
Requires(postun):	desktop-file-utils
%endif

%if 0%{?centos_version} >= 700 || 0%{?rhel_version} >= 700 || 0%{?scientificlinux_version} >= 700
Requires(post):		gtk-update-icon-cache
Requires(postun):	gtk-update-icon-cache
%endif

%if 0%{?centos_version} < 700 || 0%{?rhel_version} < 700 || 0%{?scientificlinux_version} < 700
Requires(post):		gtk2
Requires(postun):	gtk2
%endif


%description
GameHub supports non-native games as well as native games for Linux.

GameHub supports multiple game sources and services:

* Steam
* GOG
* Humble Bundle
* Humble Trove

Locally installed games can also be added to GameHub.

It supports multiple compatibility layers for non-native games:

* Wine / Proton
* DOSBox
* RetroArch
* ScummVM

It also allows to add custom emulators.

GameHub supports WineWrap — a set of preconfigured wrappers for supported games.

%lang_package

%prep
%setup -q
cp %{SOURCE100} .

%build
# Upstream requested keeping debug symbols as well as adding more useful
# information to cause the binary to emit non-blank values for debugging.
# https://github.com/tkashkin/GameHub/issues/156#issuecomment-481709822
BRANCH="$(echo %{version} | awk '{gsub(/([[:digit:]]|\.)/,""); print}')"
COMMIT="$(awk '/commit/ {print $2}' %{name}.obsinfo)"
HASH="$(echo ${COMMIT} | cut -c1-7)"
VER="$(echo %{version} | awk '{gsub(/([[:alpha:]])/,""); print}')"
%meson --buildtype=debug -Dgit_branch="${BRANCH}" -Dgit_commit="${COMMIT}" -Dgit_commit_short="${HASH}"

# Disable optimization per known issues:
# https://github.com/tkashkin/GameHub/issues/162
# https://github.com/tkashkin/GameHub/issues/112
unset CFLAGS
unset CXXFLAGS
unset FCFLAGS
unset FFLAGS
%meson_build

%install
%meson_install
# At this time, the @2 versions are identical to the regular
rm -rf "%{buildroot}/%{_datadir}/icons/hicolor/32x32@2/"
rm -rf "%{buildroot}/%{_datadir}/icons/hicolor/48x48@2/"
rm -rf "%{buildroot}/%{_datadir}/icons/hicolor/64x64@2/"
rm -rf "%{buildroot}/%{_datadir}/icons/hicolor/128x128@2/"
%find_lang %{appname}

%if %{defined suse_version} && 0%{?suse_version} < 1330
%post
%desktop_database_post

%postun
%desktop_database_postun

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

%posttrans
/usr/bin/gtk-update-icon-cache %{_datadir}/pixmaps &>/dev/null || :

%postun
/usr/bin/update-desktop-database &> /dev/null || :
/usr/bin/gtk-update-icon-cache %{_datadir}/pixmaps &>/dev/null || :
%endif

%files
%license COPYING
%doc README.md
%docdir %{_datadir}/%{appname}
%dir %{_datadir}/icons/hicolor/*
%dir %{_datadir}/icons/hicolor/*/apps
%{_datadir}/%{appname}
%{_datadir}/applications/%{appname}.desktop
%{_datadir}/glib-2.0/schemas/%{appname}.gschema.xml
%{_datadir}/icons/hicolor/*/apps/%{appname}.svg
%{_datadir}/metainfo/%{appname}.appdata.xml
%{_datadir}/polkit-1/actions/%{appname}.policy
%attr(0755,root,root) %{_bindir}/%{name}
%attr(0755,root,root) %{_bindir}/%{appname}
%attr(0755,root,root) %{_bindir}/%{appname}-overlayfs-helper

%files lang -f %{appname}.lang

%changelog

openSUSE Build Service is sponsored by