File bomi.spec of Package bomi

#
# spec file for package bomi
#
# Copyright (c) 2016 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:           bomi
Version:        0.9.11
Release:        0
Summary:        Powerful and easy-to-use multimedia player
# MPL.txt is for libchardet which is in a separate package.
License:        GPL-2.0+ and BSD-3-Clause
Group:          Productivity/Multimedia/Sound/Players
ExclusiveArch:  x86_64
Url:            https://bomi-player.github.io/
Source:         https://github.com/xylosper/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
# PATCH-FIX-UPSTREAM bomi-compilation-fix.patch sor.alexei@meowr.ru -- Fix bomi compilation.
Patch0:         %{name}-compilation-fix.patch
# PATCH-FIX-UPSTREAM bomi-mpv-ffmpeg-3.0.patch sor.alexei@meowr.ru -- Fix MPV build with FFmpeg 3.0.
Patch1:         %{name}-mpv-fix-ffmpeg-3.0.patch
Patch2:         bomi-builddate.patch
BuildRequires:  fdupes
BuildRequires:  hicolor-icon-theme
BuildRequires:  libqt5-linguist
BuildRequires:  pkgconfig
# waf is written in Python 2.x.
BuildRequires:  python
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(Qt5Core) >= 5.2
BuildRequires:  pkgconfig(Qt5DBus) >= 5.2
BuildRequires:  pkgconfig(Qt5Gui) >= 5.2
BuildRequires:  pkgconfig(Qt5Network) >= 5.2
BuildRequires:  pkgconfig(Qt5Quick) >= 5.2
BuildRequires:  pkgconfig(Qt5Sql) >= 5.2
BuildRequires:  pkgconfig(Qt5Svg) >= 5.2
BuildRequires:  pkgconfig(Qt5Widgets) >= 5.2
BuildRequires:  pkgconfig(Qt5X11Extras) >= 5.2
BuildRequires:  pkgconfig(Qt5Xml) >= 5.2
BuildRequires:  pkgconfig(alsa)
BuildRequires:  pkgconfig(bzip2)
BuildRequires:  pkgconfig(chardet)
BuildRequires:  pkgconfig(dvdnav)
BuildRequires:  pkgconfig(dvdread)
BuildRequires:  pkgconfig(glib-2.0)
BuildRequires:  pkgconfig(gobject-2.0)
BuildRequires:  pkgconfig(jack)
BuildRequires:  pkgconfig(libass) >= 0.12.1
BuildRequires:  pkgconfig(libavcodec) = 57.107.100
BuildRequires:  pkgconfig(libavfilter) = 6.107.100
BuildRequires:  pkgconfig(libavformat) = 57.83.100
BuildRequires:  pkgconfig(libavutil) = 55.78.100
BuildRequires:  pkgconfig(libbluray)
BuildRequires:  pkgconfig(libcdio)
BuildRequires:  pkgconfig(libcdio_cdda)
BuildRequires:  pkgconfig(libcdio_paranoia)
BuildRequires:  pkgconfig(libpulse)
BuildRequires:  pkgconfig(libswresample) = 2.9.100
BuildRequires:  pkgconfig(libswscale) = 4.8.100
BuildRequires:  pkgconfig(libsystemd)
BuildRequires:  pkgconfig(libva)
BuildRequires:  pkgconfig(libva-glx)
BuildRequires:  pkgconfig(libva-x11)
BuildRequires:  pkgconfig(smbclient)
BuildRequires:  pkgconfig(vdpau)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xcb)
BuildRequires:  pkgconfig(xcb-icccm)
BuildRequires:  pkgconfig(xcb-randr)
BuildRequires:  pkgconfig(xcb-screensaver)
BuildRequires:  pkgconfig(xcb-xtest)
Requires:       libqt5-qtquickcontrols
# Streaming support for Dailymotion, YouTube, etc.
Recommends:     youtube-dl
%if 0%{?suse_version} > 1320
BuildRequires:  gcc-c++
%endif
%if 0%{?suse_version} == 1315
# SLE12SP5Backports
BuildRequires:  gcc8-c++
%endif

%description
bomi is a themable Qt-based multimedia player based on the MPV
video backend which is aimed for easy usage but also provides
various powerful features and convenience functions.

%prep
%autosetup -p1

%build
CFLAGS='%{optflags} -Wno-deprecated-declarations'
CXXFLAGS='%{optflags} -Wno-deprecated-declarations'
test -x "$(type -p gcc)"   && CC="$_"
test -x "$(type -p gcc-5)" && CC="$_"
test -x "$(type -p gcc-6)" && CC="$_"
test -x "$(type -p gcc-7)" && CC="$_"
test -x "$(type -p gcc-8)" && CC="$_"
test -x "$(type -p gcc-9)" && CC="$_"
mkdir dummy
pushd $_
tee svg_dummy.pro <<_EOF_
SOURCES       = main.cpp 
QT += svg
QMAKE_CFLAGS += \$(EXTRA_CFLAGS)
QMAKE_CXXFLAGS += \$(EXTRA_CXXFLAGS)
TEMPLATE = app  
target.path += %{_libexecdir}/%{name}/bin
INSTALLS += target
_EOF_
tee main.cpp <<_EOF_
#include <QtSvg>
int main(void)
{
	QSvgGenerator svg;
	return 0;
}
_EOF_
qmake-qt5
make EXTRA_CXXFLAGS="${CXXFLAGS}"
readelf -Wa svg_dummy | grep NEED
popd
./configure \
  --release                             \
  --cc=${CC}                            \
  %{?jobs:--parallel=%{jobs}}           \
  --prefix=%{_prefix}                   \
  --actiondir=%{_datadir}/solid/actions
%make_build EXTRA_CXXFLAGS="${CXXFLAGS}"

%install
pushd dummy
make \
	STRIP=true \
	INSTALL_ROOT='%{buildroot}' \
	install
popd
%make_install
%fdupes %{buildroot}%{_datadir}

%post
%desktop_database_post
%icon_theme_cache_post

%postun
%desktop_database_postun
%icon_theme_cache_postun

%files
%doc CHANGES.txt CREDITS.txt README.md
%license COPYING.txt GPL.txt
%{_bindir}/%{name}
%{_libexecdir}/%{name}
%{_datadir}/%{name}/
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.*
%{_mandir}/man?/%{name}.?%{?ext_man}
%dir %{_datadir}/solid/
%dir %{_datadir}/solid/actions/
%{_datadir}/solid/actions/*
%{_datadir}/bash-completion/completions/%{name}

%changelog