1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/www-client/icecat/icecat-10.0-r2.ebuild,v 1.2 2012/03/01 15:11:32 ago Exp $
6 VIRTUALX_REQUIRED="pgo"
9 # This list can be updated with scripts/get_langs.sh from the mozilla overlay
10 MOZ_LANGS=(af ak ar as ast be bg bn-BD bn-IN br bs ca cs csb cy da de el en
11 en-GB en-US en-ZA eo es-AR es-CL es-ES es-MX et eu fa fi fr fy-NL ga-IE gd gl
12 gu-IN he hi-IN hr hu hy-AM id is it ja kk kn ko ku lg lt lv mai mk ml mr nb-NO
13 nl nn-NO nso or pa-IN pl pt-BR pt-PT rm ro ru si sk sl son sq sr sv-SE ta ta-LK
14 te th tr uk vi zh-CN zh-TW zu)
16 # Convert the ebuild version to the upstream mozilla version, used by mozlinguas
17 MOZ_PV="${PV/_alpha/a}" # Handle alpha for SRC_URI
18 MOZ_PV="${MOZ_PV/_beta/b}" # Handle beta for SRC_URI
19 MOZ_PV="${MOZ_PV/_rc/rc}" # Handle rc for SRC_URI
22 PATCH="firefox-10.0-patches-0.6"
23 # Upstream ftp release URI that's used by mozlinguas.eclass
24 # We don't use the http mirror because it deletes old tarballs.
25 MOZ_FTP_URI="ftp://ftp.mozilla.org/pub/firefox/releases"
26 MOZ_LANGPACK_PREFIX="10.0.1/linux-i686/xpi/"
28 inherit check-reqs flag-o-matic toolchain-funcs eutils gnome2-utils mozconfig-3 multilib pax-utils fdo-mime autotools python virtualx nsplugins mozlinguas
30 DESCRIPTION="GNU project's edition of Mozilla Firefox"
31 HOMEPAGE="http://www.gnu.org/software/gnuzilla/"
33 KEYWORDS="amd64 ~ppc ~ppc64 ~x86"
35 LICENSE="|| ( MPL-1.1 GPL-2 LGPL-2.1 )"
36 IUSE="+crashreporter +ipc pgo selinux system-sqlite +webm"
38 # More URIs appended below...
40 mirror://gnu/gnuzilla/${MOZ_PV}/${PN}-${MOZ_PV}.tar.xz
41 http://dev.gentoo.org/~anarchy/mozilla/patchsets/${PATCH}.tar.xz
42 http://dev.gentoo.org/~polynomial-c/mozilla/ff1001.diff"
44 ASM_DEPEND=">=dev-lang/yasm-1.1"
46 # Mesa 7.10 needed for WebGL + bugfixes
48 >=sys-devel/binutils-2.16.1
51 >=dev-libs/glib-2.26:2
52 >=media-libs/mesa-7.10
53 media-libs/libpng[apng]
55 system-sqlite? ( >=dev-db/sqlite-3.7.7.1[fts3,secure-delete,threadsafe,unlock-notify,debug=] )
56 webm? ( >=media-libs/libvpx-1.0.0
58 crashreporter? ( net-misc/curl )
59 selinux? ( sec-policy/selinux-mozilla )"
60 # We don't use PYTHON_DEPEND/PYTHON_USE_WITH for some silly reason
64 =dev-lang/python-2*[sqlite]
66 webm? ( x86? ( ${ASM_DEPEND} )
67 amd64? ( ${ASM_DEPEND} ) )"
69 QA_PRESTRIPPED="usr/$(get_libdir)/${PN}/${PN}"
74 # Avoid PGO profiling problems due to enviroment leakage
75 # These should *always* be cleaned up anyway
76 unset DBUS_SESSION_BUS_ADDRESS \
85 ewarn "You will do a double build for profile guided optimization."
86 ewarn "This will result in your build taking at least twice as long as before."
89 # Ensure we have enough disk space to compile
90 if use pgo || use debug || use test ; then
91 CHECKREQS_DISK_BUILD="8G"
93 CHECKREQS_DISK_BUILD="4G"
101 # Unpack language packs
102 mozlinguas_src_unpack
106 # Make this a 10.0.1 release
107 epatch "${DISTDIR}"/ff1001.diff
109 # Fix preferences location
110 sed -i 's|defaults/pref/|defaults/preferences/|' browser/installer/packages-static || die "sed failed"
112 EPATCH_EXCLUDE="2000-firefox_gentoo_install_dirs.patch" \
113 EPATCH_SUFFIX="patch" \
115 epatch "${WORKDIR}/firefox"
117 epatch "${FILESDIR}"/2000-icecat-6_gentoo_install_dirs.patch
119 # Allow user to apply any additional patches without modifing ebuild
123 sed -i 's|\$(DIST)/bin/firefox|\$(DIST)/bin/icecat|' browser/app/Makefile.in
125 # Enable gnomebreakpad
127 sed -i -e "s:GNOME_DISABLE_CRASH_DIALOG=1:GNOME_DISABLE_CRASH_DIALOG=0:g" \
128 "${S}"/build/unix/run-mozilla.sh || die "sed failed!"
131 # Disable gnomevfs extension
132 sed -i -e "s:gnomevfs::" "${S}/"browser/confvars.sh \
133 -e "s:gnomevfs::" "${S}/"xulrunner/confvars.sh \
134 || die "Failed to remove gnomevfs extension"
136 # Ensure that are plugins dir is enabled as default
137 sed -i -e "s:/usr/lib/mozilla/plugins:/usr/$(get_libdir)/nsbrowser/plugins:" \
138 "${S}"/xpcom/io/nsAppFileLocationProvider.cpp || die "sed failed to replace plugin path!"
140 # Fix sandbox violations during make clean, bug 372817
141 sed -e "s:\(/no-such-file\):${T}\1:g" \
142 -i "${S}"/config/rules.mk \
143 -i "${S}"/js/src/config/rules.mk \
144 -i "${S}"/nsprpub/configure{.in,} \
147 #Fix compilation with curl-7.21.7 bug 376027
148 sed -e '/#include <curl\/types.h>/d' \
149 -i "${S}"/toolkit/crashreporter/google-breakpad/src/common/linux/http_upload.cc \
150 -i "${S}"/toolkit/crashreporter/google-breakpad/src/common/linux/libcurl_wrapper.cc \
151 -i "${S}"/config/system-headers \
152 -i "${S}"/js/src/config/system-headers || die "Sed failed"
158 # We will build our own .mozconfig
161 MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}"
162 MEXTENSIONS="default"
164 ####################################
166 # mozconfig, CFLAGS and CXXFLAGS setup
168 ####################################
173 # It doesn't compile on alpha without this LDFLAGS
174 use alpha && append-ldflags "-Wl,--no-relax"
176 # Specific settings for icecat
177 echo "export MOZ_PHOENIX=1" >> "${S}"/.mozconfig
178 echo "mk_add_options MOZ_PHOENIX=1" "${S}"/.mozconfig
179 mozconfig_annotate '' --with-branding=browser/branding/unofficial
180 mozconfig_annotate '' --disable-official-branding
181 mozconfig_annotate '' --with-user-appdir=.icecat
183 mozconfig_annotate '' --prefix="${EPREFIX}"/usr
184 mozconfig_annotate '' --libdir="${EPREFIX}"/usr/$(get_libdir)
185 mozconfig_annotate '' --enable-extensions="${MEXTENSIONS}"
186 mozconfig_annotate '' --disable-gconf
187 mozconfig_annotate '' --disable-mailnews
188 mozconfig_annotate '' --enable-canvas
189 mozconfig_annotate '' --enable-safe-browsing
190 mozconfig_annotate '' --with-system-png
191 mozconfig_annotate '' --enable-system-ffi
193 # Other browser-specific settings
194 mozconfig_annotate '' --with-default-mozilla-five-home=${MOZILLA_FIVE_HOME}
195 mozconfig_annotate '' --target="${CTARGET:-${CHOST}}"
197 mozconfig_use_enable system-sqlite
199 # Allow for a proper pgo build
201 echo "mk_add_options PROFILE_GEN_SCRIPT='\$(PYTHON) \$(OBJDIR)/_profile/pgo/profileserver.py'" >> "${S}"/.mozconfig
204 # Finalize and report settings
207 if [[ $(gcc-major-version) -lt 4 ]]; then
208 append-cxxflags -fno-stack-protector
209 elif [[ $(gcc-major-version) -gt 4 || $(gcc-minor-version) -gt 3 ]]; then
210 if use amd64 || use x86; then
211 append-flags -mno-avx
219 addpredict /etc/gconf
220 # Reset and cleanup environment variables used by GNOME/XDG
221 gnome2_environment_reset
223 # icecat tries to use dri stuff when it's run, see bug 380283
225 cards=$(echo -n /dev/dri/card* | sed 's/ /:/g')
226 if test -n "${cards}"; then
227 # FOSS drivers are fine
228 addpredict "${cards}"
230 cards=$(echo -n /dev/ati/card* /dev/nvidiactl* | sed 's/ /:/g')
231 if test -n "${cards}"; then
232 # Binary drivers seem to cause access violations anyway, so
233 # let's use indirect rendering so that the device files aren't
234 # touched at all. See bug 394715.
235 export LIBGL_ALWAYS_INDIRECT=1
240 CC="$(tc-getCC)" CXX="$(tc-getCXX)" LD="$(tc-getLD)" \
241 MOZ_MAKE_FLAGS="${MAKEOPTS}" \
242 Xemake -f client.mk profiledbuild || die "Xemake failed"
244 CC="$(tc-getCC)" CXX="$(tc-getCXX)" LD="$(tc-getLD)" \
245 MOZ_MAKE_FLAGS="${MAKEOPTS}" \
246 emake -f client.mk || die "emake failed"
252 MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}"
254 # MOZ_BUILD_ROOT, and hence OBJ_DIR change depending on arch, compiler, pgo, etc.
255 local obj_dir="$(echo */config.log)"
256 obj_dir="${obj_dir%/*}"
259 # Pax mark xpcshell for hardened support, only used for startupcache creation.
260 pax-mark m "${S}/${obj_dir}"/dist/bin/xpcshell
262 # Add our default prefs for firefox + xulrunner
263 cp "${FILESDIR}"/gentoo-default-prefs.js-1 \
264 "${S}/${obj_dir}/dist/bin/defaults/pref/all-gentoo.js" || die
266 MOZ_MAKE_FLAGS="${MAKEOPTS}" \
267 emake DESTDIR="${D}" install || die "emake install failed"
269 # Install language packs
270 mozlinguas_src_install
272 local size sizes icon_path icon name
275 icon_path="${S}/browser/branding/unofficial"
277 # Install icons and .desktop for menu entry
278 for size in ${sizes}; do
279 insinto "/usr/share/icons/hicolor/${size}x${size}/apps"
280 newins "${icon_path}/default${size}.png" "${PN}.png" || die
282 # The 128x128 icon has a different name
283 insinto "/usr/share/icons/hicolor/128x128/apps"
284 newins "${icon_path}/mozicon128.png" "${PN}.png" || die
285 # Install a 48x48 icon into /usr/share/pixmaps for legacy DEs
286 newicon "${icon_path}/content/icon48.png" "${PN}.png" || die
287 newmenu "${FILESDIR}/icon/${PN}.desktop" "${PN}.desktop" || die
288 sed -e "/^Icon/s:${PN}-icon:${PN}:" -i \
289 "${ED}/usr/share/applications/${PN}.desktop" || die
291 # Add StartupNotify=true bug 237317
292 if use startup-notification ; then
293 echo "StartupNotify=true" >> "${ED}/usr/share/applications/${PN}.desktop"
296 # Required in order to use plugins and even run firefox on hardened.
297 pax-mark m "${ED}"${MOZILLA_FIVE_HOME}/{${PN}{,-bin},plugin-container}
308 # Update mimedb for the new .desktop file
309 fdo-mime_desktop_database_update
310 gnome2_icon_cache_update
314 gnome2_icon_cache_update