##
## firefox.spec -- OpenPKG RPM Package Specification
## Copyright (c) 2000-2005 OpenPKG Foundation e.V.
## Copyright (c) 2000-2005 Ralf S. Engelschall
##
## Permission to use, copy, modify, and distribute this software for
## any purpose with or without fee is hereby granted, provided that
## the above copyright notice and this permission notice appear in all
## copies.
##
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
##
# package information
Name: firefox
Summary: Graphical Web Browser
URL: http://www.mozilla.org/products/firefox/
Vendor: The Mozilla Project
Packager: OpenPKG
Distribution: OpenPKG
Class: PLUS
Group: Web
License: MPL
Version: 1.0.4
Release: 20050701
# package options
%option with_optimize yes
%option with_svg no
# list of sources
Source0: ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/%{version}/source/firefox-%{version}-source.tar.bz2
Source1: firefox.sh
Source2: firefox.pod
Source3: firefox-init.tar.gz
Source4: about.png
Source5: aboutCredits.png
Patch0: firefox.patch
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
BuildPreReq: OpenPKG, openpkg >= 20040130, make, gcc, perl, pkgconfig
PreReq: OpenPKG, openpkg >= 20040130, xsel, wmctrl
BuildPreReq: X11, glib, gtk, png, jpeg, orbit, libiconv
PreReq: X11, glib, gtk, png, jpeg, orbit, libiconv
BuildPreReq: infozip, zlib, openssl, freetype
PreReq: infozip, zlib, openssl, freetype
%if "%{with_svg}" == "yes"
BuildPreReq: cairo, cairo::with_x11 = yes
PreReq: cairo, cairo::with_x11 = yes
%endif
AutoReq: no
AutoReqProv: no
%description
Firefox is a speedy, full featured and extensible Web browser based
on the Mozilla Suite codebase. It uses the Mozilla Gecko engine for
rendering the Web content and XUL for presenting the GUI.
%track
prog firefox = {
version = %{version}
url = ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/
regex = (__VER__)
url = ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/__NEWVER__/source/
regex = firefox-(__VER__)-source\.tar\.bz2
}
%prep
# extract source distribution
%setup -q -n mozilla
# patch source distribution
%patch -p0
# overwrite OEM branding for OpenPKG recognition
cp -f %{SOURCE about.png} browser/base/content/
cp -f %{SOURCE aboutCredits.png} browser/base/content/
# strip down source distribution (save disk space)
find . -type d -name "CVS" -print | xargs rm -rf
find . -type d -name "macbuild" -print | xargs rm -rf
find . -type f -name ".cvsignore" -print | xargs rm -f
find . -type f -name "makefile.win" -print | xargs rm -f
find . -type f -name "MANIFEST" -print | xargs rm -f
rm -rf build/package
%build
# determine X11 paths
x11_libdir=`%{l_rc} --query x11_libdir`
x11_incdir=`%{l_rc} --query x11_incdir`
# determine build flags
CC="%{l_cc}"
CXX="%{l_cxx}"
CFLAGS="%{l_cflags} %{l_cppflags} -I${x11_incdir}"
CXXFLAGS="%{l_cxxflags} -Wno-deprecated %{l_cppflags} -I${x11_incdir}"
CPPFLAGS="%{l_cppflags glib} -I${x11_incdir}"
LDFLAGS="-L`pwd`/dist/bin -L`pwd`/dist/lib -L`pwd`/dist/lib/components"
LDFLAGS="$LDFLAGS %{l_ldflags} -L${x11_libdir}"
GLIB_CONFIG="%{l_prefix}/bin/glib-config"
GTK_CONFIG="%{l_prefix}/bin/gtk-config"
LIBIDL_CONFIG="%{l_prefix}/bin/libIDL-config"
PERL="%{l_prefix}/bin/perl"
MOZILLA_OFFICIAL=1
BUILD_OFFICIAL=1
MOZ_PHOENIX=1
export CC CXX CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
export GLIB_CONFIG GTK_CONFIG LIBIDL_CONFIG
export MOZILLA_OFFICIAL BUILD_OFFICIAL
export MOZ_PHOENIX
# binutils ld(1) doesn't properly link with Solaris dynamic libc(3)
touch config.cache
case "%{l_platform -t}" in
*-sunos* )
# force to use the system link editor
echo "ac_cv_prog_LD=/usr/ccs/bin/ld" >config.cache
LD=/usr/ccs/bin/ld
export LD
# correct hard coded LD variables
%{l_shtool} subst \
-e 's;^\(LD[^=]*\)= *$(CC);\1=/usr/ccs/bin/ld;' \
config/config.mk
# final link of firefox-bin(1) needs explicit libgcc
libgccpath=`gcc -print-search-dirs \
| grep '^install' \
| %{l_shtool} subst -e 's;^install: \(.*\)$;\1;'`
%{l_shtool} subst \
-e "s;\(LDFLAGS += -L\)@l_gccinst@;\1$libgccpath;" \
embedding/browser/gtk/tests/Makefile.in \
browser/app/Makefile.in
;;
esac
# specify custom extensions, leaving out the broken 'typeaheadfind'
custext="cookie,wallet,content-packs,xml-rpc,xmlextras,help,p3p,pref"
custext="${custext},transformiix,venkman,inspector,irc,universalchardet"
custext="${custext},webservices,spellcheck,gnomevfs,negotiateauth"
custext="${custext},xmlterm,datetime,finger,cview,layout-debug,tasks"
# configure source
./configure \
--cache-file=./config.cache \
--prefix=%{l_prefix} \
--libdir=%{l_prefix}/lib/firefox \
--with-default-mozilla-five-home=%{l_prefix}/lib/firefox \
--includedir=%{l_prefix}/include/firefox \
--with-x \
--x-includes=`%{l_rc} --query x11_incdir` \
--x-libraries=`%{l_rc} --query x11_libdir` \
--enable-default-toolkit=gtk \
--enable-toolkit-gtk \
--disable-toolkit-qt \
--disable-toolkit-xlib \
--with-gtk-prefix=%{l_prefix} \
--with-glib-prefix=%{l_prefix} \
--with-libIDL-prefix=%{l_prefix} \
--with-system-jpeg=%{l_prefix} \
--with-system-png=%{l_prefix} \
--with-system-zlib=%{l_prefix} \
--with-ft-prefix=%{l_prefix} \
--with-user-appdir=.firefox \
--enable-extensions="$custext" \
--enable-jsd \
--enable-crypto \
--enable-chrome-format=jar \
%if "%{with_svg}" == "yes"
--enable-svg \
--enable-svg-renderer-cairo \
%else
--disable-svg \
%endif
--enable-static \
--enable-strip \
%if "%{with_optimize}" == "yes"
--enable-optimize="-O2" \
%else
--disable-optimize \
%endif
--disable-mailnews \
--disable-composer \
--disable-xft \
--disable-freetype2 \
--disable-xinerama \
--disable-shared \
--disable-tests \
--disable-ldap \
--disable-accessibility \
--disable-debug \
--disable-dtd-debug \
--disable-pedantic \
--disable-auto-deps \
--disable-md \
--disable-cpp-exceptions \
--disable-cpp-rtti \
--disable-xterm-updates \
--disable-elf-dynstr-gc \
--disable-installer \
--disable-profilesharing \
--enable-single-profile \
--with-pthreads
# build program
%{l_make} %{l_mflags}
# post adjustments to built program
( cd dist/bin
# prepare for multi-user usage
LD_LIBRARY_PATH=.; export LD_LIBRARY_PATH
MOZILLA_FIVE_HOME=.; export MOZILLA_FIVE_HOME
./regxpcom || true
./regchrome || true
touch chrome/user-skins.rdf chrome/user-locales.rdf
# re-adjust paths to reflect final location
%{l_shtool} subst \
-e "s;`pwd`;%{l_prefix}/lib/firefox;" \
components/xpti.dat components/compreg.dat
# strip down installation tree
find . -type d -depth -print | xargs rmdir >/dev/null 2>&1 || true
rm -f mozilla-config mkdepend nsinstall bloaturls.txt TestGtk* LICENSE README
rm -rf res/samples
# workaround run-time startup problems
mkdir .autoreg >/dev/null 2>&1 || true
) || exit $?
# generate manual page for startup convenience wrapper
%{l_prefix}/bin/pod2man \
--section=1 --quotes=none \
--release="Mozilla %{version}" --center="%{packager}" \
%{SOURCE firefox.pod} >firefox.1
%install
rm -rf $RPM_BUILD_ROOT
# generate temporary installation tree
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/bin \
$RPM_BUILD_ROOT%{l_prefix}/lib/firefox \
$RPM_BUILD_ROOT%{l_prefix}/man/man1
# move files into temporary installation tree
( cd dist/bin && %{l_tar} -chf - . ) |\
( cd $RPM_BUILD_ROOT%{l_prefix}/lib/firefox && %{l_tar} -xf - ) || exit $?
# add initialization files
( cd $RPM_BUILD_ROOT%{l_prefix}/lib && \
%{l_tar} -xf %{SOURCE firefox-init.tar.gz} && \
rm -f firefox/README
) || exit $?
# add startup convenience wrapper
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE firefox.sh} $RPM_BUILD_ROOT%{l_prefix}/bin/firefox
%{l_shtool} install -c -m 644 \
firefox.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/
# determine installation files
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
%files -f files
%clean
rm -rf $RPM_BUILD_ROOT