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-r4.ebuild,v 1.1 2011/08/31 09:37:47 polynomial-c 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}.21"
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 http://dev.gentoo.org/~polynomial-c/mozilla/ff3621.diff.xz"
41 LANGPACK_URI="http://gnuzilla.gnu.org/download/langpacks/${MY_PV}"
43 for X in ${LANGS} ; do
44 if [ "${X}" != "en" ] && [ "${X}" != "en-US" ]; then
46 linguas_${X/-/_}? ( ${LANGPACK_URI}/${X}.xpi -> ${P}-${X}.xpi )"
48 IUSE="${IUSE} linguas_${X/-/_}"
49 # english is handled internally
50 if [ "${#X}" == 5 ] && ! has ${X} ${NOSHORTLANGS}; then
51 if [ "${X}" != "en-US" ]; then
53 linguas_${X%%-*}? ( ${LANGPACK_URI}/${X}.xpi -> ${P}-${X}.xpi )"
55 IUSE="${IUSE} linguas_${X%%-*}"
60 >=sys-devel/binutils-2.16.1
63 >=app-text/hunspell-1.2
64 system-sqlite? ( >=dev-db/sqlite-3.7.4[fts3,secure-delete] )
65 alsa? ( media-libs/alsa-lib )
66 >=x11-libs/cairo-1.8.8[X]
67 gnome? ( >=gnome-base/gnome-vfs-2.16.3
68 >=gnome-base/libgnomeui-2.16.1
69 >=gnome-base/gconf-2.16.0
70 >=gnome-base/libgnome-2.16.0 )
71 wifi? ( net-wireless/wireless-tools )
72 libnotify? ( >=x11-libs/libnotify-0.4 )
73 ~net-libs/xulrunner-${XUL_PV}[ipc=,java=,wifi=,libnotify=,system-sqlite=]"
76 java? ( >=virtual/jdk-1.4 )
77 =dev-lang/python-2*[threads]
80 RDEPEND="${RDEPEND} java? ( >=virtual/jre-1.4 )"
82 # This is a copy of the launcher program installed as part of xulrunner, so has
83 # already been stripped. Bug #332071 for details.
84 QA_PRESTRIPPED="usr/$(get_libdir)/${PN}/${PN}"
88 for LANG in ${LINGUAS}; do
89 if has ${LANG} en en_US; then
90 has en ${linguas} || linguas="${linguas:+"${linguas} "}en"
92 elif has ${LANG} ${LANGS//-/_}; then
93 has ${LANG//_/-} ${linguas} || linguas="${linguas:+"${linguas} "}${LANG//_/-}"
95 elif [[ " ${LANGS} " == *" ${LANG}-"* ]]; then
97 if [[ "${X}" == "${LANG}-"* ]] && \
98 [[ " ${NOSHORTLANGS} " != *" ${X} "* ]]; then
99 has ${X} ${linguas} || linguas="${linguas:+"${linguas} "}${X}"
104 ewarn "Sorry, but ${PN} does not support the ${LANG} LINGUA"
109 # Ensure we always build with C locale.
112 export LC_MESSAGES="C"
115 java-pkg-opt-2_pkg_setup
117 python_set_active_version 2
121 #xz -dc -- "${DISTDIR}/icecat-${MY_PV}.tar.xz" | tar xof - || die "failed to unpack"
122 unpack ${A} #${PATCH}.tar.bz2
125 for X in ${linguas}; do
126 # FIXME: Add support for unpacking xpis to portage
127 [[ ${X} != "en" ]] && xpi_unpack "${P}-${X}.xpi"
132 # Make this a 3.6.21 version
133 epatch "${DISTDIR}"/ff3617.diff.xz \
134 "${DISTDIR}"/ff3618.diff.xz \
135 "${DISTDIR}"/ff3620.diff.xz \
136 "${DISTDIR}"/ff3621.diff.xz
138 epatch "${FILESDIR}"/${PN}-3.6.16-curl7217-includes-fix.patch
140 # Integrate rebranding
141 sed -i "s|/firefox|/icecat|" \
142 "${WORKDIR}"/001-firefox_gentoo_install_dirs.patch
144 # Fix preferences location
145 sed -i 's|defaults/pref/|defaults/preferences/|' browser/installer/packages-static || die "sed failed"
148 EPATCH_SUFFIX="patch" \
153 sed -i 's|\$(DIST)/bin/firefox|\$(DIST)/bin/icecat|' browser/app/Makefile.in
162 # We will build our own .mozconfig
165 MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}"
166 MEXTENSIONS="default"
168 ####################################
170 # mozconfig, CFLAGS and CXXFLAGS setup
172 ####################################
177 # It doesn't compile on alpha without this LDFLAGS
178 use alpha && append-ldflags "-Wl,--no-relax"
180 # Specific settings for icecat
181 echo "export MOZ_PHOENIX=1" >> "${S}"/.mozconfig
182 echo "mk_add_options MOZ_PHOENIX=1" "${S}"/.mozconfig
183 mozconfig_annotate '' --with-branding=browser/branding/unofficial
184 mozconfig_annotate '' --disable-official-branding
185 mozconfig_annotate '' --with-user-appdir=.icecat
187 mozconfig_annotate '' --enable-crypto
188 mozconfig_annotate '' --enable-extensions="${MEXTENSIONS}"
189 mozconfig_annotate '' --enable-application=browser
190 mozconfig_annotate '' --disable-mailnews
191 mozconfig_annotate 'broken' --disable-crashreporter
192 mozconfig_annotate '' --enable-image-encoder=all
193 mozconfig_annotate '' --enable-canvas
194 mozconfig_annotate 'gtk' --enable-default-toolkit=cairo-gtk2
195 # Bug 60668: Galeon doesn't build without oji enabled, so enable it
196 # regardless of java setting.
197 mozconfig_annotate '' --enable-oji --enable-mathml
198 mozconfig_annotate 'places' --enable-storage --enable-places
199 mozconfig_annotate '' --enable-safe-browsing
201 # Build mozdevelop permately
202 mozconfig_annotate '' --enable-jsd --enable-xpctools
204 # System-wide install specs
205 mozconfig_annotate '' --disable-installer
206 mozconfig_annotate '' --disable-updater
207 mozconfig_annotate '' --disable-strip
208 mozconfig_annotate '' --disable-install-strip
210 # Use system libraries
211 mozconfig_annotate '' --enable-system-cairo
212 mozconfig_annotate '' --enable-system-hunspell
213 mozconfig_annotate '' --with-system-nspr --with-nspr-prefix="${EPREFIX}"/usr
214 mozconfig_annotate '' --with-system-nss --with-nss-prefix="${EPREFIX}"/usr
215 mozconfig_annotate '' --with-system-bz2
216 mozconfig_annotate '' --with-system-libxul
217 mozconfig_annotate '' --with-libxul-sdk="${EPREFIX}"/usr/$(get_libdir)/xulrunner-devel-${MAJ_XUL_PV}
219 mozconfig_use_enable gnome gnomevfs
220 mozconfig_use_enable gnome gnomeui
221 mozconfig_use_enable ipc # +ipc, upstream default
222 mozconfig_use_enable libnotify
223 mozconfig_use_enable java javaxpcom
224 mozconfig_use_enable wifi necko-wifi
225 mozconfig_use_enable alsa ogg
226 mozconfig_use_enable alsa wave
227 mozconfig_use_enable system-sqlite
229 # Other browser-specific settings
230 mozconfig_annotate '' --with-default-mozilla-five-home=${MOZILLA_FIVE_HOME}
232 # Finalize and report settings
235 if [[ $(gcc-major-version) -lt 4 ]]; then
236 append-cxxflags -fno-stack-protector
239 ####################################
241 # Configure and build
243 ####################################
245 CC="$(tc-getCC)" CXX="$(tc-getCXX)" LD="$(tc-getLD)" PYTHON="$(PYTHON)" econf
249 # Should the build use multiprocessing? Not enabled by default, as it tends to break
250 [ "${WANT_MP}" = "true" ] && jobs=${MAKEOPTS} || jobs="-j1"
255 MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}"
257 emake DESTDIR="${D}" install || die "emake install failed"
260 for X in ${linguas}; do
261 [[ ${X} != "en" ]] && xpi_install "${WORKDIR}"/"${P}-${X}"
264 # Install icon and .desktop for menu entry
265 newicon "${S}"/browser/branding/unofficial/default48.png icecat-icon.png
266 newmenu "${FILESDIR}"/icon/icecat.desktop ${PN}-${DESKTOP_PV}.desktop
268 # Add StartupNotify=true bug 237317
269 if use startup-notification ; then
270 echo "StartupNotify=true" >> "${ED}"/usr/share/applications/${PN}-${DESKTOP_PV}.desktop
273 pax-mark m "${ED}"/${MOZILLA_FIVE_HOME}/${PN}
275 # Enable very specific settings not inherited from xulrunner
276 cp "${FILESDIR}"/firefox-default-prefs.js \
277 "${ED}/${MOZILLA_FIVE_HOME}/defaults/preferences/all-gentoo.js" || \
278 die "failed to cp icecat-default-prefs.js"
280 dosym ../nsbrowser/plugins "${MOZILLA_FIVE_HOME}"/plugins \
281 || die "failed to symlink"
285 ewarn "All the packages built against ${PN} won't compile,"
286 ewarn "any package that fails to build warrants a bug report."
289 # Update mimedb for the new .desktop file
290 fdo-mime_desktop_database_update