File qmc2.spec of Package qmc2
#
# spec file for package qmc2
#
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2017 Asterios Dramis <asterios.dramis@gmail.com>.
#
# 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 https://bugs.opensuse.org/
#
Name: qmc2
Version: 0.195
Release: 0
Summary: MAME Catalog / Launcher II
License: GPL-2.0-only
Group: Amusements/Games/Other
URL: https://qmc2.batcom-it.net/
Source0: http://downloads.sourceforge.net/qmc2/%{name}-%{version}.tar.bz2
# PATCH-FEATURE-OPENSUSE qmc2.ini.template.patch asterios.dramis@gmail.com -- Adapt qmc2.ini to openSUSE mame package
Patch0: qmc2.ini.template.patch
Patch1: qmc2-qt5-fixes.patch
# PATCH-FIX-OPENSUSE qmc2-qt5.15.patch asterios.dramis@gmail.com - Fix compilation with qt-5.15 (patch taken from Archlinux)
Patch2: qmc2-qt5.15.patch
BuildRequires: fdupes
BuildRequires: libqt5-linguist
BuildRequires: openSUSE-release
BuildRequires: pkgconfig
BuildRequires: rsync
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Multimedia)
BuildRequires: pkgconfig(Qt5OpenGL)
BuildRequires: pkgconfig(Qt5Script)
BuildRequires: pkgconfig(Qt5Sql)
BuildRequires: pkgconfig(Qt5Svg)
BuildRequires: pkgconfig(Qt5WebKit)
BuildRequires: pkgconfig(Qt5WebKitWidgets)
BuildRequires: pkgconfig(Qt5Xml)
BuildRequires: pkgconfig(Qt5XmlPatterns)
BuildRequires: pkgconfig(libarchive)
BuildRequires: pkgconfig(sdl2)
BuildRequires: pkgconfig(zlib)
Recommends: mame-tools
%if 0%{?suse_version} > 1210
BuildRequires: desktop-file-utils
%else
BuildRequires: update-desktop-files
%endif
%description
QMC2 is a Qt based multi-platform GUI front end MAME.
QMC2 – M.A.M.E. Catalog / Launcher II is the successor of one of the first UNIX
M.A.M.E. GUI front ends available on this planet called QMamecat (derived from
MAMECAT, which was text-only).
%package arcade
Summary: MAME Catalog / Launcher II - Arcade Mode
Requires: %{name} = %{version}
Requires: %{name}-sdlmame = %{version}
Recommends: mame
%description arcade
QMC2 is a Qt based multi-platform GUI front end MAME.
This package contains an "arcade" QML based graphical mode for MAME emulator.
%package sdlmame
Summary: MAME Catalog / Launcher II
Requires: %{name} = %{version}
Recommends: mame
# qmc2-sdlmess was last used at version 0.49
Provides: qmc2-sdlmess = %{version}
Obsoletes: qmc2-sdlmess < %{version}
# qmc2-sdlume was last used at version 0.49
Provides: qmc2-sdlume = %{version}
Obsoletes: qmc2-sdlume < %{version}
%description sdlmame
QMC2 is a Qt based multi-platform GUI front end MAME.
This package supports the MAME emulator.
%prep
%setup -qcT
# For compilation with arcade mode
tar -jxf %{SOURCE0}
mv %{name} arcade
cd arcade
%patch0
%patch1 -p1
%patch2 -p1
cd ..
# For compilation with qchdman
tar -jxf %{SOURCE0}
mv %{name} qchdman
cd qchdman
%patch0
%patch1 -p1
%patch2 -p1
cd ..
# For compilation with MAME support
tar -jxf %{SOURCE0}
mv %{name} sdlmame
cd sdlmame
%patch0
%patch1 -p1
%patch2 -p1
cd ..
# For compilation of man pages
tar -jxf %{SOURCE0}
mv %{name} man
cd man
%patch0
%patch1 -p1
%patch2 -p1
cd ..
%build
COMMON_FLAGS="\
QMAKE=%{_bindir}/qmake-qt5 \
PREFIX=%{_prefix} \
SYSCONFDIR=%{_sysconfdir} \
SDL=2 \
DISTCFG=1 \
LIBARCHIVE=1 \
SYSTEM_ZLIB=1 \
"
cd arcade
%make_build CC_FLAGS="%{optflags}" CXX_FLAGS="%{optflags}" $COMMON_FLAGS arcade
cd ..
cd qchdman
%make_build CC_FLAGS="%{optflags}" CXX_FLAGS="%{optflags}" $COMMON_FLAGS qchdman
cd ..
cd sdlmame
%make_build CC_FLAGS="%{optflags}" CXX_FLAGS="%{optflags}" $COMMON_FLAGS all
cd ..
cd man
%make_build CC_FLAGS="%{optflags}" CXX_FLAGS="%{optflags}" $COMMON_FLAGS man
cd ..
%install
COMMON_FLAGS="\
QMAKE=%{_bindir}/qmake \
PREFIX=%{_prefix} \
SYSCONFDIR=%{_sysconfdir} \
SDL=2 \
DISTCFG=1 \
LIBARCHIVE=1 \
SYSTEM_ZLIB=1 \
"
cd arcade
mkdir -p %{buildroot}%{_bindir}
make arcade-install DESTDIR=%{buildroot} CC_FLAGS="%{optflags}" CXX_FLAGS="%{optflags}" $COMMON_FLAGS
cd ..
cd qchdman
mkdir -p %{buildroot}%{_bindir}
make qchdman-install DESTDIR=%{buildroot} CC_FLAGS="%{optflags}" CXX_FLAGS="%{optflags}" $COMMON_FLAGS
cd ..
cd sdlmame
make install DESTDIR=%{buildroot} CC_FLAGS="%{optflags}" CXX_FLAGS="%{optflags}" $COMMON_FLAGS all
cd ..
cd man
mkdir -p %{buildroot}%{_bindir}
make man-install DESTDIR=%{buildroot} MAN_DIR=%{_mandir} CC_FLAGS="%{optflags}" CXX_FLAGS="%{optflags}" $COMMON_FLAGS
cd ..
# Remove qmc2 (not needed, qmc2-arcade and qmc2-sdlmame are used)
rm -f %{buildroot}%{_bindir}/qmc2
# Remove docs (they are installed in %%{_defaultdocdir})
rm -rf %{buildroot}%{_datadir}/qmc2/doc/*
# Manually install the doc files in order to fix "files-duplicate" rpmlint warning
install -dp -m 0755 %{buildroot}%{_defaultdocdir}/%{name}
cp -a sdlmame/data/doc/html/ %{buildroot}%{_defaultdocdir}/%{name}/
# Add a link in qmc datadir pointing to %%{_defaultdocdir} to fix docs display
ln -s %{_defaultdocdir}/%{name}/html %{buildroot}%{_datadir}/qmc2/doc/html
%if 0%{?suse_version} > 1210
desktop-file-edit --set-name="Qchdman" --remove-category=Emulator --add-category=Qt --add-category=Simulation %{buildroot}%{_datadir}/applications/qchdman.desktop
desktop-file-edit --remove-category=Emulator --add-category=Qt --add-category=Simulation %{buildroot}%{_datadir}/applications/qmc2-arcade.desktop
desktop-file-edit --remove-category=Emulator --add-category=Qt --add-category=Simulation %{buildroot}%{_datadir}/applications/qmc2-sdlmame.desktop
%else
%suse_update_desktop_file -N "Qchdman" -r %{buildroot}%{_datadir}/applications/qchdman.desktop Qt Game Simulation
%suse_update_desktop_file -r %{buildroot}%{_datadir}/applications/qmc2-arcade.desktop Qt Game Simulation
%suse_update_desktop_file -r %{buildroot}%{_datadir}/applications/qmc2-sdlmame.desktop Qt Game Simulation
%endif
%fdupes -s %{buildroot}
%files
%dir %{_sysconfdir}/qmc2
%config(noreplace) %{_sysconfdir}/qmc2/qmc2.ini
%{_bindir}/qchdman
%doc %{_defaultdocdir}/%{name}/
%{_datadir}/applications/qchdman.desktop
%{_datadir}/qmc2/
%{_mandir}/man6/qchdman.6%{?ext_man}
%{_mandir}/man6/qmc2.6%{?ext_man}
%{_mandir}/man6/qmc2-main-gui.6%{?ext_man}
%files arcade
%{_bindir}/qmc2-arcade
%{_datadir}/applications/qmc2-arcade.desktop
%{_mandir}/man6/qmc2-arcade.6%{?ext_man}
%files sdlmame
%{_bindir}/qmc2-sdlmame
%{_datadir}/applications/qmc2-sdlmame.desktop
%{_mandir}/man6/qmc2-sdlmame.6%{?ext_man}
%changelog