File vivaldi.spec of Package vivaldi

#
# spec file for package vivaldi
#
# Vasco Gervasi <yellowhat46@gmail.com>
#

Name:           vivaldi
Version:        2.5.1525.48
Release:        0
Summary:        A new browser for our friends
License:        SUSE-NonFree
Group:          Productivity/Networking/Web/Browsers
Url:            https://vivaldi.com/
Source:         https://downloads.vivaldi.com/stable/%{name}-stable-%{version}-1.x86_64.rpm
BuildRequires:  desktop-file-utils
BuildRequires:  hicolor-icon-theme
BuildRequires:  update-desktop-files
BuildRequires:  xz
ExclusiveArch:  x86_64

%description
Vivaldi browser is made with power users in mind by people who love the Web.

%prep
rpm2cpio %{SOURCE0} | cpio -i -d

%build
# Nothing to build.

%install
mkdir -p %{buildroot}/%{_libdir}
mv opt/vivaldi %{buildroot}/%{_libdir}/%{name}
# No need for setuid on kernels with user namspace support
chmod -s %{buildroot}/%{_libdir}/%{name}/vivaldi-sandbox
rm %{buildroot}/%{_libdir}/%{name}/libwidevinecdm.so
#rm %{buildroot}/%{_libdir}/%{name}/libwidevinecdmadapter.soi

desktop-file-install --dir %{buildroot}/%{_datadir}/applications usr/share/applications/%{name}-stable.desktop

for icon in %{buildroot}/%{_libdir}/%{name}/product_logo_*.png; do
    size="$(basename ${icon} | sed 's/[^0-9]//g')"
    install -Dp ${icon} %{buildroot}/%{_datadir}/icons/hicolor/${size}x${size}/apps/vivaldi.png
done

mkdir -p %{buildroot}/%{_bindir}
ln -s %{_libdir}/%{name}/vivaldi %{buildroot}/%{_bindir}/%{name}

%post
%desktop_database_post
%icon_theme_cache_post

%postun
%desktop_database_postun
%icon_theme_cache_postun

%files
%{_datadir}/icons/hicolor/
%{_bindir}/%{name}
%{_datadir}/applications/%{name}-stable.desktop
%{_libdir}/%{name}/