1 # Copyright 1999-2011 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/www-client/icecat/icecat-3.6.16-r3.ebuild,v 1.6 2011/09/04 00:32:00 phajdan.jr Exp $
7 inherit flag-o-matic toolchain-funcs eutils mozconfig-3 makeedit multilib pax-utils fdo-mime autotools mozextension java-pkg-opt-2 python
9 LANGS="af ar as ast be bg bn-BD bn-IN ca cs cy da de el en en-GB en-US eo es-AR
10 es-CL es-ES es-MX et eu fa fi fr fy-NL ga-IE gl gu-IN he hi-IN hr hu id is it
11 ja ka kk kn ko ku lt lv mk ml mr nb-NO nl nn-NO oc or pa-IN pl pt-BR pt-PT rm ro
12 ru si sk sl sq sr sv-SE ta ta-LK te th tr uk vi zh-CN zh-TW"
13 # Malformed install.rdf: ta-LK
15 NOSHORTLANGS="en-GB es-AR es-CL es-MX pt-BR zh-CN zh-TW"
18 MAJ_PV="${PV/_*/}" # Without the _rc and _beta stuff
20 MY_PV="${PV/_rc/rc}" # Handle beta for SRC_URI
21 #XUL_PV="${MAJ_XUL_PV}${MAJ_PV/${DESKTOP_PV}/}" # Major + Minor version no.s
22 XUL_PV="${MAJ_XUL_PV}.20"
24 FIREFOX_P="${FIREFOX_PN}-${PV}"
25 PATCH="${FIREFOX_PN}-3.6-patches-0.4"
27 DESCRIPTION="GNU project's edition of Mozilla Firefox"
28 HOMEPAGE="http://www.gnu.org/software/gnuzilla/"
30 KEYWORDS="amd64 ppc ppc64 x86"
32 LICENSE="|| ( MPL-1.1 GPL-2 LGPL-2.1 )"
33 IUSE="+alsa +ipc gnome java libnotify system-sqlite wifi"
35 SRC_URI="mirror://gnu/gnuzilla/${MY_PV}/${PN}-${MY_PV}.tar.bz2
36 http://dev.gentoo.org/~anarchy/mozilla/patchsets/${PATCH}.tar.bz2
37 http://dev.gentoo.org/~polynomial-c/mozilla/ff3617.diff.xz
38 http://dev.gentoo.org/~polynomial-c/mozilla/ff3618.diff.xz
39 http://dev.gentoo.org/~polynomial-c/mozilla/ff3620.diff.xz"
40 LANGPACK_URI="http://gnuzilla.gnu.org/download/langpacks/${MY_PV}"
42 for X in ${LANGS} ; do
43 if [ "${X}" != "en" ] && [ "${X}" != "en-US" ]; then
45 linguas_${X/-/_}? ( ${LANGPACK_URI}/${X}.xpi -> ${P}-${X}.xpi )"
47 IUSE="${IUSE} linguas_${X/-/_}"
48 # english is handled internally
49 if [ "${#X}" == 5 ] && ! has ${X} ${NOSHORTLANGS}; then
50 if [ "${X}" != "en-US" ]; then
52 linguas_${X%%-*}? ( ${LANGPACK_URI}/${X}.xpi -> ${P}-${X}.xpi )"
54 IUSE="${IUSE} linguas_${X%%-*}"
59 >=sys-devel/binutils-2.16.1
62 >=app-text/hunspell-1.2
63 system-sqlite? ( >=dev-db/sqlite-3.7.4[fts3,secure-delete] )
64 alsa? ( media-libs/alsa-lib )
65 >=x11-libs/cairo-1.8.8[X]
66 gnome? ( >=gnome-base/gnome-vfs-2.16.3
67 >=gnome-base/libgnomeui-2.16.1
68 >=gnome-base/gconf-2.16.0
69 >=gnome-base/libgnome-2.16.0 )
70 wifi? ( net-wireless/wireless-tools )
71 libnotify? ( >=x11-libs/libnotify-0.4 )
72 ~net-libs/xulrunner-${XUL_PV}[ipc=,java=,wifi=,libnotify=,system-sqlite=]"
75 java? ( >=virtual/jdk-1.4 )
76 =dev-lang/python-2*[threads]
79 RDEPEND="${RDEPEND} java? ( >=virtual/jre-1.4 )"
81 # This is a copy of the launcher program installed as part of xulrunner, so has
82 # already been stripped. Bug #332071 for details.
83 QA_PRESTRIPPED="usr/$(get_libdir)/${PN}/${PN}"
87 for LANG in ${LINGUAS}; do
88 if has ${LANG} en en_US; then
89 has en ${linguas} || linguas="${linguas:+"${linguas} "}en"
91 elif has ${LANG} ${LANGS//-/_}; then
92 has ${LANG//_/-} ${linguas} || linguas="${linguas:+"${linguas} "}${LANG//_/-}"
94 elif [[ " ${LANGS} " == *" ${LANG}-"* ]]; then
96 if [[ "${X}" == "${LANG}-"* ]] && \
97 [[ " ${NOSHORTLANGS} " != *" ${X} "* ]]; then
98 has ${X} ${linguas} || linguas="${linguas:+"${linguas} "}${X}"
103 ewarn "Sorry, but ${PN} does not support the ${LANG} LINGUA"
108 # Ensure we always build with C locale.
111 export LC_MESSAGES="C"
114 java-pkg-opt-2_pkg_setup
116 python_set_active_version 2
120 #xz -dc -- "${DISTDIR}/icecat-${MY_PV}.tar.xz" | tar xof - || die "failed to unpack"
121 unpack ${A} #${PATCH}.tar.bz2
124 for X in ${linguas}; do
125 # FIXME: Add support for unpacking xpis to portage
126 [[ ${X} != "en" ]] && xpi_unpack "${P}-${X}.xpi"
131 # Make this a 3.6.20 version
132 epatch "${DISTDIR}"/ff3617.diff.xz \
133 "${DISTDIR}"/ff3618.diff.xz \
134 "${DISTDIR}"/ff3620.diff.xz
136 epatch "${FILESDIR}"/${PN}-3.6.16-curl7217-includes-fix.patch
138 # Integrate rebranding
139 sed -i "s|/firefox|/icecat|" \
140 "${WORKDIR}"/001-firefox_gentoo_install_dirs.patch
142 # Fix preferences location
143 sed -i 's|defaults/pref/|defaults/preferences/|' browser/installer/packages-static || die "sed failed"
146 EPATCH_SUFFIX="patch" \
151 sed -i 's|\$(DIST)/bin/firefox|\$(DIST)/bin/icecat|' browser/app/Makefile.in
160 # We will build our own .mozconfig
163 MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}"
164 MEXTENSIONS="default"
166 ####################################
168 # mozconfig, CFLAGS and CXXFLAGS setup
170 ####################################
175 # It doesn't compile on alpha without this LDFLAGS
176 use alpha && append-ldflags "-Wl,--no-relax"
178 # Specific settings for icecat
179 echo "export MOZ_PHOENIX=1" >> "${S}"/.mozconfig
180 echo "mk_add_options MOZ_PHOENIX=1" "${S}"/.mozconfig
181 mozconfig_annotate '' --with-branding=browser/branding/unofficial
182 mozconfig_annotate '' --disable-official-branding
183 mozconfig_annotate '' --with-user-appdir=.icecat
185 mozconfig_annotate '' --enable-crypto
186 mozconfig_annotate '' --enable-extensions="${MEXTENSIONS}"
187 mozconfig_annotate '' --enable-application=browser
188 mozconfig_annotate '' --disable-mailnews
189 mozconfig_annotate 'broken' --disable-crashreporter
190 mozconfig_annotate '' --enable-image-encoder=all
191 mozconfig_annotate '' --enable-canvas
192 mozconfig_annotate 'gtk' --enable-default-toolkit=cairo-gtk2
193 # Bug 60668: Galeon doesn't build without oji enabled, so enable it
194 # regardless of java setting.
195 mozconfig_annotate '' --enable-oji --enable-mathml
196 mozconfig_annotate 'places' --enable-storage --enable-places
197 mozconfig_annotate '' --enable-safe-browsing
199 # Build mozdevelop permately
200 mozconfig_annotate '' --enable-jsd --enable-xpctools
202 # System-wide install specs
203 mozconfig_annotate '' --disable-installer
204 mozconfig_annotate '' --disable-updater
205 mozconfig_annotate '' --disable-strip
206 mozconfig_annotate '' --disable-install-strip
208 # Use system libraries
209 mozconfig_annotate '' --enable-system-cairo
210 mozconfig_annotate '' --enable-system-hunspell
211 mozconfig_annotate '' --with-system-nspr --with-nspr-prefix="${EPREFIX}"/usr
212 mozconfig_annotate '' --with-system-nss --with-nss-prefix="${EPREFIX}"/usr
213 mozconfig_annotate '' --with-system-bz2
214 mozconfig_annotate '' --with-system-libxul
215 mozconfig_annotate '' --with-libxul-sdk="${EPREFIX}"/usr/$(get_libdir)/xulrunner-devel-${MAJ_XUL_PV}
217 mozconfig_use_enable gnome gnomevfs
218 mozconfig_use_enable gnome gnomeui
219 mozconfig_use_enable ipc # +ipc, upstream default
220 mozconfig_use_enable libnotify
221 mozconfig_use_enable java javaxpcom
222 mozconfig_use_enable wifi necko-wifi
223 mozconfig_use_enable alsa ogg
224 mozconfig_use_enable alsa wave
225 mozconfig_use_enable system-sqlite
227 # Other browser-specific settings
228 mozconfig_annotate '' --with-default-mozilla-five-home=${MOZILLA_FIVE_HOME}
230 # Finalize and report settings
233 if [[ $(gcc-major-version) -lt 4 ]]; then
234 append-cxxflags -fno-stack-protector
237 ####################################
239 # Configure and build
241 ####################################
243 CC="$(tc-getCC)" CXX="$(tc-getCXX)" LD="$(tc-getLD)" PYTHON="$(PYTHON)" econf
247 # Should the build use multiprocessing? Not enabled by default, as it tends to break
248 [ "${WANT_MP}" = "true" ] && jobs=${MAKEOPTS} || jobs="-j1"
253 MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}"
255 emake DESTDIR="${D}" install || die "emake install failed"
258 for X in ${linguas}; do
259 [[ ${X} != "en" ]] && xpi_install "${WORKDIR}"/"${P}-${X}"
262 # Install icon and .desktop for menu entry
263 newicon "${S}"/browser/branding/unofficial/default48.png icecat-icon.png
264 newmenu "${FILESDIR}"/icon/icecat.desktop ${PN}-${DESKTOP_PV}.desktop
266 # Add StartupNotify=true bug 237317
267 if use startup-notification ; then
268 echo "StartupNotify=true" >> "${ED}"/usr/share/applications/${PN}-${DESKTOP_PV}.desktop
271 pax-mark m "${ED}"/${MOZILLA_FIVE_HOME}/${PN}
273 # Enable very specific settings not inherited from xulrunner
274 cp "${FILESDIR}"/firefox-default-prefs.js \
275 "${ED}/${MOZILLA_FIVE_HOME}/defaults/preferences/all-gentoo.js" || \
276 die "failed to cp icecat-default-prefs.js"
278 dosym ../nsbrowser/plugins "${MOZILLA_FIVE_HOME}"/plugins \
279 || die "failed to symlink"
283 ewarn "All the packages built against ${PN} won't compile,"
284 ewarn "any package that fails to build warrants a bug report."
287 # Update mimedb for the new .desktop file
288 fdo-mime_desktop_database_update