File opera.spec of Package opera.import4853

#
# spec file for package opera
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#


%define tag32b   i386.linux
%define tag64b   x86_64.linux
%define buildnum 1074

Name:           opera
Version:        11.50
Release:        0.<RELEASE2>
License:        NON-OSI-COMPLIANT(royalties)
Summary:        Opera Web Browser (%{version} build %{buildnum})
Url:            http://www.opera.com/
Group:          Productivity/Networking/Web/Browsers
Source0:        %{name}-%{version}-%{buildnum}.%{tag32b}.tar.bz2
Source1:        %{name}-%{version}-%{buildnum}.%{tag64b}.tar.bz2
NoSource:       0
NoSource:       1
BuildRequires:  fdupes
BuildRequires:  update-desktop-files
Recommends:     %{name}-gtk = %{version}
Recommends:     %{name}-kde4 = %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
ExclusiveArch:  %{ix86} x86_64

%description
Opera is user-friendly, secure, and exceptionally fast. The browser is
small, yet full-featured and functions well on systems with limited
resources. Opera supports all common Web standards and implements them
according to the official recommendations.

%package gtk
License:        NON-OSI-COMPLIANT(royalties)
Summary:        Opera GTK engine
Group:          Productivity/Networking/Web/Browsers
Requires:       opera = %{version}

%description gtk
Opera engine for GTK integration.

%package kde4
License:        NON-OSI-COMPLIANT(royalties)
Summary:        Opera KDE4 engine
Group:          Productivity/Networking/Web/Browsers
Requires:       opera = %{version}

%description kde4
Opera engine for KDE4 integration.

%prep
%setup -q -T -c -n %{name}-%{version} -a 0 -a 1

%build
# check for supported architectures
%ifnarch %{ix86} x86_64
echo 'Only x86 and x86_64 architectures are supported'
exit 1
%endif

%install
# change into right directory
%ifarch %{ix86}
cd %{name}-%{version}-%{buildnum}.%{tag32b}
%endif
%ifarch x86_64
cd %{name}-%{version}-%{buildnum}.%{tag64b}
%endif

# replace variables manually, install script is unusable
gunzip share/man/man1/*
sed -i 's:@@{SUFFIX}::g' share/man/man1/*
sed -i 's:@@{USUFFIX}::g' share/man/man1/*
sed -i 's:@@{PREFIX}:/usr:g' share/man/man1/*
sed -i 's:@@{_SUFFIX}::g' share/applications/*.desktop
sed -i 's:@@{SUFFIX}::g' share/applications/*.desktop
sed -i 's:@@{PREFIX}/bin/::g' share/applications/*.desktop
sed -i 's:@@{SUFFIX}::g' share/mime/packages/*.xml

# fix file handlers
sed -i 's:kfmclient exec:xdg-open:' share/opera/defaults/filehandler.ini
cat >> share/opera/defaults/filehandler.ini <<EOT
[File Types]
text/x-suse-ymp=7,/sbin/YaST2 OneClickInstallUI,,,ymp,|
text/x-suse-ymu=3,/sbin/YaST2 OneClickInstallUrlHandler,,,ymu,|
EOT

# copy files
mkdir -p %{buildroot}%{_bindir}
cp -a lib %{buildroot}%{_prefix}
cp -a share %{buildroot}%{_prefix}

# install wrappers

cat > %{buildroot}%{_bindir}/opera <<EOT
#!/bin/sh
export OPERA_DIR=%{_datadir}/opera
export OPERA_PERSONALDIR="\$HOME/.opera"
exec /usr/lib/opera/opera "\$@"
EOT

cat > %{buildroot}%{_bindir}/opera-widget-manager <<EOT
#!/bin/sh
exec /usr/bin/opera --widgetmanager "\$@"
EOT

chmod 0755 %{buildroot}%{_bindir}/opera
chmod 0755 %{buildroot}%{_bindir}/opera-widget-manager

%suse_update_desktop_file opera-browser
%suse_update_desktop_file opera-widget-installer
%suse_update_desktop_file opera-widget-manager
%fdupes %{buildroot}%{_datadir}

%files
%defattr(-,root,root)
%doc %{_mandir}/man1/opera*
%{_bindir}/opera*
%{_prefix}/lib/opera
%{_datadir}/opera
%dir %{_datadir}/doc/opera
%doc %{_datadir}/doc/opera/*
%{_datadir}/mime/packages/*
%{_datadir}/applications/*.desktop
%dir %{_datadir}/icons/hicolor
%dir %{_datadir}/icons/hicolor/*
%dir %{_datadir}/icons/hicolor/*/apps
%dir %{_datadir}/icons/hicolor/*/mimetypes
%{_datadir}/icons/hicolor/*/apps/*.png
%{_datadir}/icons/hicolor/*/mimetypes/*.png
%{_datadir}/icons/hicolor/scalable/apps/*.svg
%{_datadir}/icons/hicolor/scalable/mimetypes/*.svg
%exclude %{_prefix}/lib/opera/liboperagtk.so
%exclude %{_prefix}/lib/opera/liboperakde4.so

%files gtk
%defattr(-,root,root)
%{_prefix}/lib/opera/liboperagtk.so

%files kde4
%defattr(-,root,root)
%{_prefix}/lib/opera/liboperakde4.so

%changelog