File stremio.spec of Package stremio
#
# spec file for package stremio
#
# Copyright (c) 2022 SUSE LLC
#
# 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/
#
%define BUILD_DIR build
%define INSTALL_DIR %{_libdir}/%{name}
%define ICON_BIN smartcode-stremio.svg
%define NON_TRAY smartcode-stremio
%define TRAY smartcode-stremio-tray
%define DESKTOP smartcode-stremio.desktop
%define SERVER_JS server.js
%define STREMIO_BIN %{BUILD_DIR}/%{name}
Name: stremio
Version: 4.4.142
Release: 1.0
Summary: A modern media center.
License: GPL-3.0
URL: https://github.com/Stremio/stremio-shell
Source: %{name}-%{version}.tar.gz
BuildRequires: pkgconf
BuildRequires: pkgconfig(mpv) pkgconfig(caca) pkgconfig(ncurses) libQtQuick5 libQt5WebView5
BuildRequires: pkgconfig(SDL2_gfx) qt6-creator messagelib-devel cmake make libQt6DBus6 pkgconfig(Qt6DBus)
BuildRequires: pkgconfig(Qt5WebEngine) libqt5-qtbase-devel rsvg-convert wget
BuildRequires: pkgconfig(libopenssl) rpmdevtools nodejs-common
BuildRequires: libQt5WebChannel5-imports libqt5-qtwebengine
BuildRequires: libqt5-qtquickcontrols libqt5-qtquickcontrols2 libQt5QuickControls2-5
Requires: nodejs-common
%description
A modern media center that's a one-stop solution for your video entertainment. You discover, watch and organize video content from easy to install addons.
%prep
%setup -q -n %{name}-shell
%build
mkdir -p %{BUILD_DIR}
cd %{BUILD_DIR} && cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%{buildroot} ..
cd ..
make -j -C %{BUILD_DIR}
%install
rm -rf %{buildroot}
make -C %{BUILD_DIR} install
install -Dm 644 %{SERVER_JS} %{buildroot}%{INSTALL_DIR}/%{SERVER_JS}
mkdir -p %{buildroot}%{_datadir}/applications
install -Dm 644 %{DESKTOP} %{buildroot}%{_datadir}/applications
mkdir -p icons
cd icons && printf 16,22,24,32,64,128 | xargs -I^ -d, sh -c 'rsvg-convert ../images/stremio.svg -w ^ -o smartcode-stremio_^.png && rsvg-convert ../images/stremio_tray_white.svg -w ^ -o smartcode-stremio-tray_^.png'
cd ..
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/{128x128,64x64,32x32,16x16,22x22,24x24}/apps
cp icons/%{TRAY}_128.png %{buildroot}%{_datadir}/icons/hicolor/128x128/apps/%{TRAY}.png
cp icons/%{NON_TRAY}_128.png %{buildroot}%{_datadir}/icons/hicolor/128x128/apps/%{NON_TRAY}.png
cp icons/%{TRAY}_64.png %{buildroot}%{_datadir}/icons/hicolor/64x64/apps/%{TRAY}.png
cp icons/%{NON_TRAY}_64.png %{buildroot}%{_datadir}/icons/hicolor/64x64/apps/%{NON_TRAY}.png
cp icons/%{TRAY}_32.png %{buildroot}%{_datadir}/icons/hicolor/32x32/apps/%{TRAY}.png
cp icons/%{NON_TRAY}_32.png %{buildroot}%{_datadir}/icons/hicolor/32x32/apps/%{NON_TRAY}.png
cp icons/%{TRAY}_16.png %{buildroot}%{_datadir}/icons/hicolor/16x16/apps/%{TRAY}.png
cp icons/%{NON_TRAY}_16.png %{buildroot}%{_datadir}/icons/hicolor/16x16/apps/%{NON_TRAY}.png
cp icons/%{TRAY}_22.png %{buildroot}%{_datadir}/icons/hicolor/22x22/apps/%{TRAY}.png
cp icons/%{NON_TRAY}_22.png %{buildroot}%{_datadir}/icons/hicolor/22x22/apps/%{NON_TRAY}.png
cp icons/%{TRAY}_24.png %{buildroot}%{_datadir}/icons/hicolor/24x24/apps/%{TRAY}.png
cp icons/%{NON_TRAY}_24.png %{buildroot}%{_datadir}/icons/hicolor/24x24/apps/%{NON_TRAY}.png
ln -s $(sh -c "which node") %{buildroot}%{INSTALL_DIR}/node
mkdir -p %{buildroot}%{_bindir}
mv %{buildroot}/opt/%{name}/%{name} %{buildroot}%{INSTALL_DIR}
ln -s %{INSTALL_DIR}/%{name} %{buildroot}%{_bindir}/%{name}
rmdir %{buildroot}/opt/%{name}
%files
%defattr(-,root,root)
%license LICENSE.md
%doc README.md
%{_libdir}/%{name}
%{_datadir}/applications/%{DESKTOP}
%{_datadir}/icons/hicolor/128x128/apps/*
%{_datadir}/icons/hicolor/64x64/apps/*
%{_datadir}/icons/hicolor/32x32/apps/*
%{_datadir}/icons/hicolor/16x16/apps/*
%{_datadir}/icons/hicolor/22x22/apps/*
%{_datadir}/icons/hicolor/24x24/apps/*
%{_bindir}/*
%changelog