-# Note that this is NOT a relocatable package
-%define ver 0.4
-%define rel 1
-%define prefix /usr
-
-Summary: Galeon
-Name: galeon
-Version: %ver
-Release: %rel
-Copyright: GPL
-Group: Applications/Internet
-Source: galeon-%{PACKAGE_VERSION}.tar.gz
-URL: http://galeon.sourceforge.net
-BuildRoot: /tmp/galeon-%{PACKAGE_VERSION}-root
-Packager: Marco Pesenti Gritti <mpeseng@tin.it>
-Autoreq: 0
-Requires: gnome-libs >= 1.0.0
-Requires: ORBit >= 0.4.0
-
-Docdir: %{prefix}/doc
+
+%define minmozver 0.9.9
+
+Summary: Galeon - gecko-based GNOME web browser
+Summary(pl): Galeon - przegl±darka WWW dla GNOME
+Summary(pt_BR): O galeon é um browser para o gnome baseado no mozilla
+Name: galeon
+Version: 1.2.1
+Release: 1
+Epoch: 2
+License: GPL
+Group: X11/Applications/Networking
+Source0: http://prdownloads.sourceforge.net/galeon/%{name}-%{version}.tar.gz
+Patch0: %{name}-mozilla_five_home.patch
+Patch1: %{name}-am_fix.patch
+URL: http://galeon.sourceforge.net/
+BuildRequires: GConf-devel >= 1.0.4-1
+BuildRequires: ORBit-devel >= 0.5.0
+BuildRequires: bison
+BuildRequires: gdk-pixbuf-devel >= 0.10.
+BuildRequires: gettext-devel
+BuildRequires: gnome-core-devel >= 1.2.0
+BuildRequires: gnome-libs-devel >= 1.2.0
+BuildRequires: gnome-vfs-devel >= 0.5
+BuildRequires: intltool
+BuildRequires: libglade-devel
+BuildRequires: libstdc++-devel
+BuildRequires: libxml-devel >= 1.8.7
+BuildRequires: mozilla-embedded-devel >= %{minmozver}
+BuildRequires: oaf-devel >= 0.6.2
+BuildRequires: openssl-devel
+Requires: GConf >= 1.0.4-1
+Requires: mozilla-embedded = %(rpm -q --qf '%{VERSION}' --whatprovides mozilla-embedded)
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+# can be provided by mozilla or mozilla-embedded
+%define _noautoreqdep libgtkembedmoz.so libplds4.so libplc4.so libnspr4.so libgtksuperwin.so libxpcom.so
+
+%define _prefix /usr/X11R6
+%define _mandir %{_prefix}/man
+%define _sysconfdir /etc/X11/GNOME
%description
-Gnome browser based on Gecko (Mozilla rendering engine)
+Gnome browser based on Gecko (Mozilla rendering engine).
+
+%description -l pl
+Galeon jest przegl±dark± WWW bazuj±c± na Gecko (mechanizmie
+interpretacji stron Mozilli).
+
+%description -l pt_BR
+O galeon é um browser para o gnome baseado no mozilla.
+
%prep
-%setup
+%setup -q
+%patch0 -p1
+%patch1 -p1
%build
-if [ ! -f configure ]; then
- CFLAGS="$RPM_OPT_FLAGS" ./autogen.sh --prefix=%{prefix} \
- --with-gnome --without-debug --sysconfdir=/etc
-else
- CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix} \
- --with-gnome --without-debug --sysconfdir=/etc
-fi
-
-if [ "$SMP" != "" ]; then
- (make "MAKE=make -k -j $SMP"; exit 0)
- make
-else
- make
-fi
+rm -f missing
+xml-i18n-toolize --copy --force
+gettextize --copy --force
+aclocal -I %{_aclocaldir}/gnome
+autoconf
+automake -a -c -f
+%configure \
+ --with-mozilla-libs=%{_libdir} \
+ --with-mozilla-includes=%{_includedir}/mozilla \
+ --with-mozilla-home=%{_libdir}/mozilla \
+ --enable-nls \
+ --disable-included-gettext \
+ --disable-install-schemas \
+ --disable-werror \
+ --enable-gconf-source=%{_sysconfdir}/gconf/schemas
+
+%{__make}
%install
rm -rf $RPM_BUILD_ROOT
-make prefix=$RPM_BUILD_ROOT%{prefix} sysconfdir=$RPM_BUILD_ROOT/etc install
+%{__make} install \
+ DESTDIR=$RPM_BUILD_ROOT \
+ Networkdir=%{_applnkdir}/Network/WWW
+
+mv -f $RPM_BUILD_ROOT%{_bindir}/galeon-bin $RPM_BUILD_ROOT%{_bindir}/galeon
+
+gzip -9nf AUTHORS ChangeLog NEWS README
+
+%find_lang %{name} --with-gnome
+
+%post
+umask 022
+rm -f %{_libdir}/mozilla/component.reg
+MOZILLA_FIVE_HOME=%{_libdir}/mozilla regxpcom
+gconftool --shutdown
+GCONF_CONFIG_SOURCE=xml::%{_sysconfdir}/gconf/gconf.xml.defaults gconftool --makefile-install-rule %{_sysconfdir}/gconf/schemas/galeon.schemas 2>dev/null >/dev/null
%clean
rm -rf $RPM_BUILD_ROOT
-%files
-%defattr(-, root, root)
-
-%doc AUTHORS COPYING ChangeLog NEWS README
-%{prefix}/bin/*
-%{prefix}/share/*
+%files -f %{name}.lang
+%defattr(644,root,root,755)
+%doc *.gz
+%attr(755,root,root) %{_bindir}/*
+%{_applnkdir}/Network/WWW/*
+%{_libdir}/%{name}
+%{_datadir}/galeon
+%{_datadir}/gnome/help/galeon-manual
+%{_datadir}/gnome/ui/*.xml
+%{_datadir}/oaf/*
+%{_datadir}/omf/*
+%{_datadir}/sounds/galeon
+%{_pixmapsdir}/*
+%{_sysconfdir}/gconf/schemas/*
+%{_sysconfdir}/sound/events/*
+%{_mandir}/man1/*