File vivaldi.spec of Package vivaldi

#
# spec file for package vivaldi
#
# Copyright (c) 2024 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/
#


Name:           vivaldi
Version:        7.6.3797.58
Release:        0
Summary:        Chromium based browser in the spirit of the original Opera
License:        SUSE-NonFree
URL:            https://vivaldi.com/
Source0:        https://downloads.vivaldi.com/stable/%{name}-stable-%{version}-1.x86_64.rpm
Source1:        %{name}.rpmlintrc
BuildRequires:  fdupes
BuildRequires:  desktop-file-utils
BuildRequires:  hicolor-icon-theme
BuildRequires:  update-desktop-files
ExclusiveArch:  x86_64

%description
Vivaldi is a Chromium based browser designed in the spirit of the original Opera browser.

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

%build
# Precompiled binary

%install
mkdir -p %{buildroot}/%{_libdir}
mv opt/%{name} %{buildroot}/%{_libdir}/%{name}
chmod +x %{buildroot}/%{_libdir}/%{name}/lib/libffmpeg.so
# No need for setuid on kernels with user namspace support
chmod -s %{buildroot}/%{_libdir}/%{name}/vivaldi-sandbox
rm -f %{buildroot}/%{_libdir}/%{name}/libwidevinecdm.so
rm -f %{buildroot}/%{_libdir}/%{name}/libwidevinecdmadapter.so
rm -f %{buildroot}/%{_libdir}/%{name}/WidevineCdm
# use system fonts for browser UI
sed -i "s/^[ space ]*font-family:.*system-ui,.*sans-serif;$/  font-family: system-ui, sans-serif;/" %{buildroot}/%{_libdir}/%{name}/resources/vivaldi/style/common.css

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

%fdupes %{buildroot}/%{_prefix}

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

%post
%desktop_database_post
%icon_theme_cache_post

%postun
%desktop_database_postun
%icon_theme_cache_postun

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

%changelog

openSUSE Build Service is sponsored by