+# TODO:
+# - SECURITY: http://securitytracker.com/alerts/2004/Jul/1010780.html
#
-# There're some problems with "shared" version
-#
-%define ver 6.0
-%define rel 20020510.1
+%bcond_without shared # static or shared version
+%bcond_without distributable # distributable or not
+%bcond_without incall # include all tarballs into src.rpm (but splitted into shared/static)
+%bcond_with snap # snap version
+
+%define ver 7.54
+%define shver %(echo %{ver} | tr -d .)
+%define dirrel 20040803
+# type of release, usually final or beta or Preview-4 for snaps
+%define reltype final
+%define x86_shared_rel %{dirrel}.5
+%define x86_static_rel %{dirrel}.1
+%define sparc_shared_rel %{dirrel}.2
+%define sparc_static_rel %{dirrel}.1
+%define ppc_shared_rel %{dirrel}.2
+%define ppc_static_rel %{dirrel}.1
+%if %{with shared}
+%define type shared
+%ifarch %{ix86}
+%define rel %{x86_shared_rel}
+%endif
+%ifarch sparc64 sparc
+%define rel %{sparc_shared_rel}
+%endif
+%ifarch ppc
+%define rel %{ppc_shared_rel}
+%endif
+%else
+%define type static
+%ifarch %{ix86}
+%define rel %{x86_static_rel}
+%endif
+%ifarch sparc sparc64
+%define rel %{sparc_static_rel}
+%endif
+%ifarch ppc
+%define rel %{ppc_static_rel}
+%endif
+%endif
+
Summary: World fastest web browser
Summary(pl): Najszybsza przegl±darka WWW na ¶wiecie
Name: opera
Version: %{ver}.%{rel}
Release: 1
-License: Restricted, see file LICENSE
+License: Distributable for PLD until 31 Dec 2006 - http://distribute.opera.com/ (otherwise restricted, see file LICENSE)
Group: X11/Applications/Networking
-Source0: ftp://ftp.opera.com/pub/opera/linux/600/final/en/qt_static/%{name}-%{ver}-%{rel}-static-qt.i386.tar.bz2
+%if %{without shared}
+%{!?with_incall:%ifarch %{ix86}}
+%if ! %{with snap}
+Source0: ftp://ftp.opera.com/pub/opera/linux/%{shver}/%{reltype}/en/i386/static/%{name}-%{ver}-%{x86_static_rel}-static-qt.i386-en.tar.bz2
+# Source0-md5: 0a7e933ef593d4b7a897041c9f87bba2
+%else
+Source100: http://snapshot.opera.com/unix/%{ver}-%{reltype}/intel-linux/en/%{name}-%{ver}-%{x86_static_rel}-static-qt.i386-en.tar.bz2
+%endif
+%{!?with_distributable:NoSource: 0}
+%if ! %{with incall}
+%endif
+%ifarch sparc sparc64
+%endif
+%if ! %{with snap}
+Source1: ftp://ftp.opera.com/pub/opera/linux/%{shver}/%{reltype}/en/sparc/static/%{name}-%{ver}-%{sparc_static_rel}-static-qt.sparc-en.tar.bz2
+# Source1-md5: 04976a6ace7a4345ce5e4cf763159939
+%else
+Source101: http://snapshot.opera.com/unix/%{ver}-%{reltype}/sparc-linux/en/%{name}-%{ver}-%{sparc_static_rel}-static-qt.sparc-en.tar.bz2
+%endif
+%{!?with_distributable:NoSource: 1}
+%if ! %{with incall}
+%endif
+%ifarch ppc
+%endif
+%if ! %{with snap}
+Source2: ftp://ftp.opera.com/pub/opera/linux/%{shver}/%{reltype}/en/ppc/static/%{name}-%{ver}-%{ppc_static_rel}-static-qt.ppc-en.tar.bz2
+# Source2-md5: c11a4c78d18bdaa4bd338b4c0dc27f38
+%else
+Source102: http://snapshot.opera.com/unix/%{ver}-%{reltype}/ppc-linux/en/%{name}-%{ver}-%{ppc_static_rel}-static-qt.ppc-en.tar.bz2
+%endif
+%{!?with_distributable:NoSource: 2}
+%{!?with_incall:%endif}
+%else
+%{!?with_incall:%ifarch %{ix86}}
+%if ! %{with snap}
+Source20: ftp://ftp.opera.com/pub/opera/linux/%{shver}/%{reltype}/en/i386/shared/%{name}-%{ver}-%{x86_shared_rel}-shared-qt.i386-en.tar.bz2
+# Source20-md5: 0e407a050f3aa4559011a3cea707cd20
+%else
+Source1020: http://snapshot.opera.com/unix/%{ver}-%{reltype}/intel-linux/en/%{name}-%{ver}-%{x86_shared_rel}-shared-qt.i386-en.tar.bz2
+%endif
+%{!?with_distributable:NoSource: 20}
+%if ! %{with incall}
+%endif
+%ifarch sparc sparc64
+%endif
+%if ! %{with snap}
+Source21: ftp://ftp.opera.com/pub/opera/linux/%{shver}/%{reltype}/en/sparc/shared/gcc-2.95/%{name}-%{ver}-%{sparc_shared_rel}-shared-qt.sparc-en.tar.bz2
+# Source21-md5: d8635013dac0c98c680997fcc9dd66c4
+%else
+Source1021: http://snapshot.opera.com/unix/%{ver}-%{reltype}/sparc-linux/en/%{name}-%{ver}-%{sparc_shared_rel}-shared-qt.sparc-en.tar.bz2
+%endif
+%{!?with_distributable:NoSource: 21}
+%if ! %{with incall}
+%endif
+%ifarch ppc
+%endif
+%if ! %{with snap}
+Source22: ftp://ftp.opera.com/pub/opera/linux/%{shver}/%{reltype}/en/ppc/shared/gcc-2.95/%{name}-%{ver}-%{ppc_shared_rel}-shared-qt.ppc-en.tar.bz2
+# Source22-md5: 516992e68c5a710d795a1ecc791c7f4d
+%else
+Source1022: http://snapshot.opera.com/unix/%{ver}-%{reltype}/ppc-linux/en/%{name}-%{ver}-%{ppc_shared_rel}-shared-qt.ppc-en.tar.bz2
+%endif
+%{!?with_distributable:NoSource: 22}
+%endif
+%{!?with_incall:%endif}
+Source3: ftp://ftp.opera.com/pub/opera/unix/lng/752/pl/ou752_727pl.lng
+# Source3-md5: 48bfd8a0d541698c70e151c81ab61408
+Source4: %{name}.desktop
URL: http://www.opera.com/
-ExclusiveArch: %{ix86}
+ExclusiveArch: %{ix86} ppc sparc sparc64
Requires: freetype >= 2
-Requires: qt
+Requires: openmotif >= 2
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
-NoSource: 0
-%define _prefix /usr/X11R6
-%define _mandir %{_prefix}/man
+
+%define _plugindir %{_libdir}/opera/plugins
+%define _operadocdir %{_docdir}/%{name}-%{ver}.%{rel}
+%define configfile %{_datadir}/opera/config/opera6rc
%description
Opera is world fastest web browser. It supports most of nowaday
extensions of HTML. And it is quite stable. Only disadvantage are
-advertisements on the top of its window. Version static linked with qt.
+advertisements on the top of its window. Version static linked with
+qt.
%description -l pl
Opera jest najszybsz± przegl±dark± WWW na ¶wiecie. Obs³uguje wiêkszo¶æ
dzisiejszych rozszerzeñ HTMLa. Dodatkowo jest w miarê stabilna. Jedyn±
-niedogodno¶ci± s± reklamy ukazuj±ce siê w górze okna. Wersja statycznie
-linkowana z qt.
+niedogodno¶ci± s± reklamy ukazuj±ce siê w górze okna. Wersja
+statycznie skonsolidowana z qt.
%prep
-%setup -q -n %{name}-%{ver}-%{rel}-static-qt.i386
+%ifarch %{ix86}
+%setup -q %{?with_shared:-T -b %{?with_snap:10}20} -n %{name}-%{ver}-%{rel}-%{type}-qt.i386-en
+%endif
+%ifarch sparc sparc64
+%setup -q -T -b %{?with_snap:10}%{?with_shared:2}1 -n %{name}-%{ver}-%{rel}-%{type}-qt.sparc-en
+%endif
+%ifarch ppc
+%setup -q -T -b %{?with_snap:10}%{?with_shared:2}2 -n %{name}-%{ver}-%{rel}-%{type}-qt.ppc-en
+%endif
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT%{_bindir}
-install -d $RPM_BUILD_ROOT%{_datadir}
-install -d $RPM_BUILD_ROOT%{_prefix}/opera
-install -d $RPM_BUILD_ROOT%{_datadir}/opera/{buttons,config,help,images,locale,skin,styles}
-install -d $RPM_BUILD_ROOT%{_pixmapsdir}
-install -d $RPM_BUILD_ROOT%{_libdir}/{%{version},plugins}
-install -d $RPM_BUILD_ROOT%{_mandir}/man1/
-for i in buttons config help images locale skin styles;
-do cp -r $i $RPM_BUILD_ROOT%{_datadir}/opera;
-done
+install -d $RPM_BUILD_ROOT{/etc,%{_mandir}/man1,%{_pixmapsdir},%{_desktopdir}}
+
+cat install.sh | sed 's|/etc|$RPM_BUILD_ROOT%{_sysconfdir}|' > install2.sh
+mv install2.sh install.sh
+
+echo y |\
+sh install.sh \
+ --prefix=$RPM_BUILD_ROOT%{_prefix} \
+ --wrapperdir=$RPM_BUILD_ROOT%{_bindir} \
+ --docdir=$RPM_BUILD_ROOT%{_operadocdir} \
+ --sharedir=$RPM_BUILD_ROOT%{_datadir}/opera \
+ --exec_prefix=$RPM_BUILD_ROOT%{_datadir}/opera/bin \
+ --plugindir=$RPM_BUILD_ROOT%{_plugindir}
-cp man/opera.1 $RPM_BUILD_ROOT%{_mandir}/man1/
+# Polish locale
+install %{SOURCE3} $RPM_BUILD_ROOT%{_datadir}/opera/locale/polish.lng
-cp -r plugins $RPM_BUILD_ROOT%{_libdir}
-cp opera $RPM_BUILD_ROOT%{_libdir}/%{version}
+# man install
+install man/opera.1 $RPM_BUILD_ROOT%{_mandir}/man1
-cp opera6.adr $RPM_BUILD_ROOT%{_datadir}/opera
-cp chartables.bin $RPM_BUILD_ROOT%{_datadir}/opera
-cp unicode.dat $RPM_BUILD_ROOT%{_datadir}/opera
+# wrapper correction
+sed s#$RPM_BUILD_ROOT## > $RPM_BUILD_ROOT%{_bindir}/opera2 $RPM_BUILD_ROOT%{_bindir}/opera
+mv $RPM_BUILD_ROOT%{_bindir}/opera2 $RPM_BUILD_ROOT%{_bindir}/opera
-# niech ktos wymysli jak wygenerowac wrappera z install.sh albo czysto opera bedzie odpalana
-# sh install.sh --jakiesopcje $RPM_BUILD_ROOT%{_bindir}/opera
-cp opera $RPM_BUILD_ROOT%{_bindir}/opera
-cp images/opera.xpm $RPM_BUILD_ROOT%{_pixmapsdir}
+# install in kde etc.
+install images/opera.xpm $RPM_BUILD_ROOT%{_pixmapsdir}
+
+install %{SOURCE4} $RPM_BUILD_ROOT%{_desktopdir}
# symlink który niweluje burkanie siê opery :>
-ln -sf %{_datadir}/opera $RPM_BUILD_ROOT/usr/share/opera
+#ln -sf %{_datadir}/opera/ $RPM_BUILD_ROOT/usr/share/
+#ln -sf %{_libdir}/opera $RPM_BUILD_ROOT/usr/lib/
+
+sed -i -e "s#$RPM_BUILD_ROOT##g" $RPM_BUILD_ROOT%{_datadir}/opera/java/*.policy
+
+# always use wrapper linked with libXm.so.3
+rm -f $RPM_BUILD_ROOT%{_libdir}/%{name}/plugins/operamotifwrapper
+ln -sf operamotifwrapper-3 $RPM_BUILD_ROOT%{_libdir}/%{name}/plugins/operamotifwrapper-2
+ln -sf operamotifwrapper-3 $RPM_BUILD_ROOT%{_libdir}/%{name}/plugins/operamotifwrapper-1
+
+# %{_libdir} is not the best place for it but opera doesn't search for it in better
+# places :/
+install lib/spellcheck.so $RPM_BUILD_ROOT%{_libdir}
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
-%doc LICENSE bugreport
+%doc LICENSE bugreport help
%attr(755,root,root) %{_bindir}/*
-%{_datadir}/opera
+%dir %{_datadir}/opera
+%dir %{_datadir}/opera/bin
+%attr(755,root,root) %{_datadir}/opera/bin/*
+%{_datadir}/opera/config
+%{_datadir}/opera/help
+%{_datadir}/opera/images
+%{_datadir}/opera/java
+%{_datadir}/opera/locale
+%{_datadir}/opera/skin
+%{_datadir}/opera/styles
+%{_datadir}/opera/ini
+%{_datadir}/opera/search.ini
+%{_datadir}/opera/*.html
+%{_datadir}/opera/*.ssr
+%{_datadir}/opera/*.txt
+%ifarch %{ix86}
+%attr(755,root,root) %{_datadir}/opera/chartables.bin
+%endif
+%ifarch ppc
+%attr(755,root,root) %{_datadir}/opera/chartables-be.bin
+%endif
+%attr(755,root,root) %{_datadir}/opera/opera6.adr
+%attr(755,root,root) %{_libdir}/*.so
+%dir %{_libdir}/opera
+%dir %{_plugindir}
+%attr(755,root,root) %{_plugindir}/*
+
%{_pixmapsdir}/opera.xpm
-/usr/share/
+%{_desktopdir}/*.desktop
+
+%{_mandir}/man1/opera.1*