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 pkgname stremio
%define pkgver 4.4.168-qt6
%define pkgrel 1
%define pkgext .tar.gz
%define BUILD_DIR build
%define INSTALL_DIR %{_libdir}/%{name}
%define ICON_BIN stremio.svg
%define NON_TRAY stremio
%define TRAY stremio-tray
%define DESKTOP stremio.desktop
%define SERVER_JS server.js
%define STREMIO_ASAR stremio.asar
%define STREMIO_BIN %{BUILD_DIR}/%{name}
Name: stremio
Version: 4.4.168
Release: 0
Summary: A modern media center that's a one-stop solution
License: GPL-3.0
URL: https://www.stremio.com
Source0: https://github.com/Stremio/stremio-shell/archive/refs/tags/v%{version}.tar.gz#/%{pkgname}-%{pkgver}%{pkgext}
Source1: server.js
Source2: stremio.asar
BuildRequires: cmake
BuildRequires: make
BuildRequires: qconf
BuildRequires: pkgconfig
BuildRequires: libboost_headers-devel
BuildRequires: mpv-devel
BuildRequires: libcaca-devel
BuildRequires: ncurses6-devel
BuildRequires: libQt5WebView5
BuildRequires: SDL2-devel
BuildRequires: messagelib-devel
BuildRequires: libopenssl-devel
BuildRequires: rpmdevtools
BuildRequires: libQt5Core-devel
BuildRequires: libQt5Network-devel
BuildRequires: libQt5Widgets-devel
BuildRequires: libQt5QuickControls2-devel
BuildRequires: libqt5-qtwebengine-devel
BuildRequires: libQt5DBus-devel
BuildRequires: libQt5OpenGL-devel
BuildRequires: qt6-base-devel
BuildRequires: qt6-webenginecore-devel
BuildRequires: qt6-webview-devel
BuildRequires: qt6-webchannel-imports
BuildRequires: qt6-quickcontrols2-devel
BuildRequires: qt6-opengl-devel
BuildRequires: libQt6Xml6
BuildRequires: nodejs-common
BuildRequires: nodejs
BuildRequires: npm-default
BuildRequires: rsvg-convert
BuildRequires: fdupes
Requires: nodejs
%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
%autosetup -n %{pkgname}-%{pkgver}
chmod 0644 %{SOURCE0} %{SOURCE1} %{SOURCE2} README.md LICENSE.md
%check
%build
%cmake -DCMAKE_BUILD_TYPE=Release
%cmake_build
%install
%cmake_install
install -Dm 644 %{SOURCE1} %{buildroot}/%{INSTALL_DIR}/server.js
install -Dm 644 %{SOURCE2} %{buildroot}/%{INSTALL_DIR}/stremio.asar
mkdir -p %{buildroot}%{_datadir}/applications
install -Dm 644 %{DESKTOP} %{buildroot}%{_datadir}/applications/%{name}.desktop
sed -i 's#Icon=/opt/stremio/stremio.svg#Icon=stremio#' %{buildroot}%{_datadir}/applications/stremio.desktop
mkdir -p %{buildroot}%{_datadir}/metainfo
cp flatpak/assets/com.stremio.Stremio.appdata.xml %{_builddir}
install -Dm 644 %{_builddir}/com.stremio.Stremio.appdata.xml %{buildroot}%{_datadir}/metainfo/com.stremio.Stremio.appdata.xml
mkdir -p icons
for size in 16 22 24 32 64 128; do
rsvg-convert images/stremio_tray_black.svg -w $size -o icons/stremio_tray_black_${size}.png
rsvg-convert images/stremio_tray_white.svg -w $size -o icons/stremio_tray_white_${size}.png
rsvg-convert images/stremio.svg -w $size -o icons/stremio_${size}.png
done
for size in 16 22 24 32 64 128; do
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/${size}x${size}/apps
install -m 644 icons/stremio_${size}.png %{buildroot}%{_datadir}/icons/hicolor/${size}x${size}/apps/%{name}.png
install -m 644 icons/stremio_tray_black_${size}.png %{buildroot}%{_datadir}/icons/hicolor/${size}x${size}/apps/%{name}-tray-black.png
install -m 644 icons/stremio_tray_white_${size}.png %{buildroot}%{_datadir}/icons/hicolor/${size}x${size}/apps/%{name}-tray-white.png
done
ln -s /usr/bin/node %{buildroot}%{INSTALL_DIR}/node
mkdir -p %{buildroot}%{_bindir}
mv %{buildroot}/usr/opt/%{name}/%{name} %{buildroot}%{INSTALL_DIR}
ln -s %{INSTALL_DIR}/%{name} %{buildroot}%{_bindir}/%{name}
rmdir %{buildroot}/usr/opt/%{name}
strip --strip-unneeded %{buildroot}%{INSTALL_DIR}/%{name} || :
%files
%defattr(-,root,root)
%license LICENSE.md
%doc README.md
%{INSTALL_DIR}/
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.png
%{_datadir}/icons/hicolor/*/apps/%{name}-tray-black.png
%{_datadir}/icons/hicolor/*/apps/%{name}-tray-white.png
%{_datadir}/metainfo/com.stremio.Stremio.appdata.xml
%changelog