File opera.spec of Package opera

# spec file for package opera
# 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

%global __provides_exclude_from ^%{_libdir}/opera/.*\\.so.*$
#*,* and* are currently bundled.
%global __requires_exclude ^lib(ffmpeg|freetype|GLESv2)\\.so.*$
Name:           opera
Version:        111.0.5168.25
Release:        0
Summary:        Proprietary web browser
License:        NonFree
Group:          Productivity/Networking/Web/Browsers
Source1:        %{name}
Source2:        com.opera.opera.appdata.xml
Source3:        eula.html
BuildRequires:  fdupes
BuildRequires:  hicolor-icon-theme
BuildRequires:  update-desktop-files
BuildRequires:  xz
Recommends:     ffmpeg
ExclusiveArch:  x86_64

Opera is a proprietary, fast, and user-friendly web browser.
It includes web developer tools, news aggregation, and the ability
to compress data via Opera Turbo on congested networks.

rpm2cpio %{SOURCE0} | cpio -i -d

cp -f %{SOURCE2} com.opera.opera.appdata.xml
cp -f %{SOURCE3} eula.html

chmod -s .%{_libdir}/%{name}/%{name}_sandbox
sed -i 's/^\(TargetEnvironment\)/X-\1/' .%{_datadir}/applications/%{name}.desktop

sed \
  -e 's|__LIBDIR__|%{_libdir}|g' \
  -e 's|__SYSCONFDIR__|%{_sysconfdir}|g' \
  %{SOURCE1} > %{name}.sh
cat > %{name}.conf << EOF
# Default settings for opera. This file is sourced by /usr/bin/opera.

# Options to pass to opera.

# Nothing to build.

mkdir -p %{buildroot}%{_libdir}/
cp -a .%{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}
install -Dpm 0755 %{name}.sh %{buildroot}%{_bindir}/%{name}

install -Dpm 0644 .%{_datadir}/applications/%{name}.desktop \
cp -a .%{_datadir}/icons/ %{buildroot}%{_datadir}/

install -Dpm 0755 %{name}.sh %{buildroot}%{_bindir}/%{name}
install -Dpm 0644 %{name}.conf %{buildroot}%{_sysconfdir}/default/%{name}

%if 0%{?suse_version} >= 1500
install -Dpm 0644 com.opera.opera.appdata.xml \
install -Dpm 0644 com.opera.opera.appdata.xml \

# Remove non-executable-script /usr/lib64/opera/ -- we do not want to create a repo
rm  %{buildroot}%{_libdir}/%{name}/

%fdupes %{buildroot}%{_libdir}/

%license eula.html
%config(noreplace) %{_sysconfdir}/default/%{name}
%if 0%{?suse_version} >= 1500
%dir %{_datadir}/metainfo/
%dir %{_datadir}/appdata/

openSUSE Build Service is sponsored by