From efaac387ea54fd27e9d18c0e1a78624c3bbe22e8 Mon Sep 17 00:00:00 2001 From: "Jory A. Pratt" Date: Thu, 26 Nov 2015 18:07:22 -0600 Subject: www-client/firefox - Fix misc crash issues via cairo, add musl support --- www-client/firefox/Manifest | 2 +- www-client/firefox/files/gentoo-default-prefs.js-2 | 21 ++ www-client/firefox/firefox-42.0-r2.ebuild | 415 +++++++++++++++++++++ www-client/firefox/firefox-42.0.ebuild | 404 -------------------- 4 files changed, 437 insertions(+), 405 deletions(-) create mode 100644 www-client/firefox/files/gentoo-default-prefs.js-2 create mode 100644 www-client/firefox/firefox-42.0-r2.ebuild delete mode 100644 www-client/firefox/firefox-42.0.ebuild (limited to 'www-client') diff --git a/www-client/firefox/Manifest b/www-client/firefox/Manifest index 51b89d1bd7b4..669aa7ff4353 100644 --- a/www-client/firefox/Manifest +++ b/www-client/firefox/Manifest @@ -297,7 +297,7 @@ DIST firefox-42.0-nl.xpi 451272 SHA256 a2470132d8b8a80b71471527a4c2468e7cd9e2440 DIST firefox-42.0-nn-NO.xpi 447406 SHA256 4bff7cf5b4178a6d85da579ad1356af88d332d9b48cfbfaa067d51c8f190dd27 SHA512 0b6c8cc62dedbafe0d7e2010463d676908eb36f27045f0c8caa88ce9cf7315e919578d0b7b66fd523014ee5abf3f5162927e6af411eaf151ed35d3afcf67d303 WHIRLPOOL 1baef82c6956dd36a56f2021c1847ed90d8ad5f83e3bed6a7d5141ad4901b238650a5e01af266a5b54a56f447039c5fd07a1587a1efa253018da2996344dc85b DIST firefox-42.0-or.xpi 533314 SHA256 c3f211d325a7bac64c71b239ccc95918153f5d5ae987b29031245bf7475eb329 SHA512 f4a2fc595163a15ad787c39cac8f26a6802f51549dfbf74955bd659298dcd59298fd55d567ca751e6c98cdc87ef683b0627b3f44d025197ad4c14f5a127bfa87 WHIRLPOOL 895f9d419a92ceddb74fe884948006158886da1ef06a4f53ced6172a30a28edfeac37440a4b28b34444fb6da6e582b2e644e2f290c3bb218cd1ba22eb3ba5b58 DIST firefox-42.0-pa-IN.xpi 507205 SHA256 af2e3dec61be29064b9a72846fd1148f0ff02e7e2290a3ed60077e932cdb614a SHA512 615c5940db69e973199fcf8d914bf6b099edd4b79f58aa3226f76eda9b0fd6e045e0936f278afb5f69c4dec0ffb88297281a26540a94d1a772701ad7ae89dc36 WHIRLPOOL bdd4a03fbafdf21fec296cf65b5576cf7fbdc3e2c6e2318739033acfe3ebbf9e0553d95e80f5b63067a66a35f2957824a0fbaac6054659838765e665275915b1 -DIST firefox-42.0-patches-02.tar.xz 6424 SHA256 6c8a89c75ea4a359bf720f011e1bb856b653cd6676767b33ccb9d2f807a089e3 SHA512 d40266c98aa5bfeed243e3bd42f9146bc73492bd20bd07ac4941df83793a7e3a832220b65fc8c9eeb5f3a00089087251a2b758df5fc0d3dd3403468ec0b9eb53 WHIRLPOOL 93356507e31a5dca653a5fcc844c24acc1de6b2a01f3dbd7227c1e23eda4e8799a59cf1a50bb49b721249cb82c744d49f4671bfb7188275101c6de955afdb149 +DIST firefox-42.0-patches-0.3.tar.xz 13360 SHA256 8f1b592454695a27cd8ab6a234705d73363af0a5ecc5e64c30072def05fd5fc8 SHA512 4aa1ab7b8482b2d6af35cc293443678eb3c33a6eb2577fc0553ec94b3c3a3cbd7c322d50c004ac646296491fe1f67f5d199635750b0c50cc4f0742af704a9cac WHIRLPOOL e755b9fd4da821e8d0490e138531dcc55e9c9dd6ebbbf33771fffda9fe932df79c1d26dc8ad6b6dc9e8a444ee47659f7ef90846dc076299793db4726be06b94e DIST firefox-42.0-pl.xpi 403227 SHA256 34498568481fc7d720742e2add62e0ea55c6150bf90abc3040186ca5d26881f2 SHA512 9faccaeb287eb5ba36d8303046bc36e6716d39766669821956e789fc8dfe830cb9985f0fc06f1566ff68498cfac6d0c1ff8622c404e79b2389b011d4e30fbeb4 WHIRLPOOL 29cbacd46f7fe86f8a62d1123baf8564de11aa8825ac04d66ef0f17fa838fb6b40cfd50fe0b232c6c451e2240b58f7fc50d7b99287876549151ae5cd55056133 DIST firefox-42.0-pt-BR.xpi 468096 SHA256 b0c9a80cd76142fd9886fd70a141dc0d8e4203e8fbdb72b649c84ee3b0d373bf SHA512 7518e2fa20857a71156980c5e4e3884f89f6bf737596a667ef4d2168b7b0549bcd712a50c0a90123e858d5d63baf4cad8e769300c18e9d55c44837f1bcdb463c WHIRLPOOL 64387553add0cc66c9b518acc2b5c5d97b4dfb050d709972cc1d895eaf8c20d942c523ac44d927a44b45f6808e89427b5bad186226a64f3bdffb92270520968c DIST firefox-42.0-pt-PT.xpi 448920 SHA256 63b5e59bd240b67fe683618b9be9d824ae8f77133d8345889b32ba0930d77687 SHA512 d64c8a4d4eb6d541f20f288b332fea15d09d89153ac2e110942bcc8a753fc758ab643b52096fd77424c1f0a86fd517d1a3998f37b106976fe9b7abf0b033e74a WHIRLPOOL 93a1643c66bd92c00f1100a935404dc95d90b0d08fde99cf008815cd7d447a3b2308e5d37f38ad19f5eafaaba2343c2249259e8f668dad07ab3ec90cbf344441 diff --git a/www-client/firefox/files/gentoo-default-prefs.js-2 b/www-client/firefox/files/gentoo-default-prefs.js-2 new file mode 100644 index 000000000000..ad8cbb5dd4e8 --- /dev/null +++ b/www-client/firefox/files/gentoo-default-prefs.js-2 @@ -0,0 +1,21 @@ +pref("app.update.enabled", false); +pref("app.update.autoInstallEnabled", false); +pref("browser.display.use_system_colors", true); +pref("browser.link.open_external", 3); +pref("general.smoothScroll", true); +pref("general.autoScroll", false); +pref("browser.tabs.tabMinWidth", 15); +pref("browser.backspace_action", 0); +pref("browser.urlbar.hideGoButton", true); +pref("accessibility.typeaheadfind", true); +pref("browser.shell.checkDefaultBrowser", false); +pref("browser.EULA.override", true); +pref("general.useragent.vendor", "Gentoo"); +pref("intl.locale.matchOS", true); +pref("general.useragent.locale", "chrome://global/locale/intl.properties"); +pref("extensions.autoDisableScopes", 0); +pref("layout.css.dpi", 0); +pref("layers.acceleration.force-enabled", true); +pref("webgl.force-enabled", true); + + diff --git a/www-client/firefox/firefox-42.0-r2.ebuild b/www-client/firefox/firefox-42.0-r2.ebuild new file mode 100644 index 000000000000..4f7f2cd03f7d --- /dev/null +++ b/www-client/firefox/firefox-42.0-r2.ebuild @@ -0,0 +1,415 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI="5" +VIRTUALX_REQUIRED="pgo" +WANT_AUTOCONF="2.1" +MOZ_ESR="" + +# This list can be updated with scripts/get_langs.sh from the mozilla overlay +# No official support as of fetch time +# csb +MOZ_LANGS=( af ar as ast be bg bn-BD bn-IN br bs ca cs cy da de el en +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 gu-IN he hi-IN hr hu hy-AM id is it ja kk km kn ko lt lv mai mk ml mr +nb-NO nl nn-NO or pa-IN pl pt-BR pt-PT rm ro ru si sk sl son sq sr sv-SE ta te +th tr uk vi xh zh-CN zh-TW ) + +# Convert the ebuild version to the upstream mozilla version, used by mozlinguas +MOZ_PV="${PV/_alpha/a}" # Handle alpha for SRC_URI +MOZ_PV="${MOZ_PV/_beta/b}" # Handle beta for SRC_URI +MOZ_PV="${MOZ_PV/_rc/rc}" # Handle rc for SRC_URI + +if [[ ${MOZ_ESR} == 1 ]]; then + # ESR releases have slightly version numbers + MOZ_PV="${MOZ_PV}esr" +fi + +# Patch version +PATCH="${PN}-42.0-patches-0.3" +MOZ_HTTP_URI="http://archive.mozilla.org/pub/${PN}/releases" + +MOZCONFIG_OPTIONAL_GTK3=1 +MOZCONFIG_OPTIONAL_WIFI=1 +MOZCONFIG_OPTIONAL_JIT="enabled" + +inherit check-reqs flag-o-matic toolchain-funcs eutils gnome2-utils mozconfig-v6.42 multilib pax-utils fdo-mime autotools virtualx mozlinguas + +DESCRIPTION="Firefox Web Browser" +HOMEPAGE="http://www.mozilla.com/firefox" + +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux" + +SLOT="0" +LICENSE="MPL-2.0 GPL-2 LGPL-2.1" +IUSE="bindist egl hardened +minimal neon pgo selinux +gmp-autoupdate test" +RESTRICT="!bindist? ( bindist )" + +# More URIs appended below... +SRC_URI="${SRC_URI} + https://dev.gentoo.org/~anarchy/mozilla/patchsets/${PATCH}.tar.xz + https://dev.gentoo.org/~axs/mozilla/patchsets/${PATCH}.tar.xz + https://dev.gentoo.org/~polynomial-c/mozilla/patchsets/${PATCH}.tar.xz" + +ASM_DEPEND=">=dev-lang/yasm-1.1" + +# Mesa 7.10 needed for WebGL + bugfixes +RDEPEND=" + >=dev-libs/nss-3.20.1 + >=dev-libs/nspr-4.10.10-r1 + selinux? ( sec-policy/selinux-mozilla )" + +DEPEND="${RDEPEND} + pgo? ( + >=sys-devel/gcc-4.5 ) + amd64? ( ${ASM_DEPEND} + virtual/opengl ) + x86? ( ${ASM_DEPEND} + virtual/opengl )" + +# No source releases for alpha|beta +if [[ ${PV} =~ alpha ]]; then + CHANGESET="8a3042764de7" + SRC_URI="${SRC_URI} + https://dev.gentoo.org/~nirbheek/mozilla/firefox/firefox-${MOZ_PV}_${CHANGESET}.source.tar.xz" + S="${WORKDIR}/mozilla-aurora-${CHANGESET}" +else + S="${WORKDIR}/firefox-${MOZ_PV}" + SRC_URI="${SRC_URI} + ${MOZ_HTTP_URI}/${MOZ_PV}/source/firefox-${MOZ_PV}.source.tar.xz" +fi +#elif [[ ${PV} =~ beta ]]; then +# S="${WORKDIR}/mozilla-beta" +# SRC_URI="${SRC_URI} +# ${MOZ_HTTP_URI}/${MOZ_PV}/source/firefox-${MOZ_PV}.source.tar.xz" +#else +# SRC_URI="${SRC_URI} +# ${MOZ_HTTP_URI}/${MOZ_PV}/source/firefox-${MOZ_PV}.source.tar.xz" +# if [[ ${MOZ_ESR} == 1 ]]; then +# S="${WORKDIR}/mozilla-esr${PV%%.*}" +# else +# S="${WORKDIR}/mozilla-release" +# fi +#fi + +QA_PRESTRIPPED="usr/$(get_libdir)/${PN}/firefox" + +BUILD_OBJ_DIR="${S}/ff" + +pkg_setup() { + moz_pkgsetup + + # Avoid PGO profiling problems due to enviroment leakage + # These should *always* be cleaned up anyway + unset DBUS_SESSION_BUS_ADDRESS \ + DISPLAY \ + ORBIT_SOCKETDIR \ + SESSION_MANAGER \ + XDG_SESSION_COOKIE \ + XAUTHORITY + + if ! use bindist; then + einfo + elog "You are enabling official branding. You may not redistribute this build" + elog "to any users on your network or the internet. Doing so puts yourself into" + elog "a legal problem with Mozilla Foundation" + elog "You can disable it by emerging ${PN} _with_ the bindist USE-flag" + fi + + if use pgo; then + einfo + ewarn "You will do a double build for profile guided optimization." + ewarn "This will result in your build taking at least twice as long as before." + fi +} + +pkg_pretend() { + # Ensure we have enough disk space to compile + if use pgo || use debug || use test ; then + CHECKREQS_DISK_BUILD="8G" + else + CHECKREQS_DISK_BUILD="4G" + fi + check-reqs_pkg_setup +} + +src_unpack() { + unpack ${A} + + # Unpack language packs + mozlinguas_src_unpack +} + +src_prepare() { + # Apply our patches + EPATCH_SUFFIX="patch" \ + EPATCH_FORCE="yes" \ + epatch "${WORKDIR}/firefox" + + # Allow user to apply any additional patches without modifing ebuild + epatch_user + + # Enable gnomebreakpad + if use debug ; then + sed -i -e "s:GNOME_DISABLE_CRASH_DIALOG=1:GNOME_DISABLE_CRASH_DIALOG=0:g" \ + "${S}"/build/unix/run-mozilla.sh || die "sed failed!" + fi + + # Ensure that our plugins dir is enabled as default + sed -i -e "s:/usr/lib/mozilla/plugins:/usr/lib/nsbrowser/plugins:" \ + "${S}"/xpcom/io/nsAppFileLocationProvider.cpp || die "sed failed to replace plugin path for 32bit!" + sed -i -e "s:/usr/lib64/mozilla/plugins:/usr/lib64/nsbrowser/plugins:" \ + "${S}"/xpcom/io/nsAppFileLocationProvider.cpp || die "sed failed to replace plugin path for 64bit!" + + # Fix sandbox violations during make clean, bug 372817 + sed -e "s:\(/no-such-file\):${T}\1:g" \ + -i "${S}"/config/rules.mk \ + -i "${S}"/nsprpub/configure{.in,} \ + || die + + # Don't exit with error when some libs are missing which we have in + # system. + sed '/^MOZ_PKG_FATAL_WARNINGS/s@= 1@= 0@' \ + -i "${S}"/browser/installer/Makefile.in || die + + # Don't error out when there's no files to be removed: + sed 's@\(xargs rm\)$@\1 -f@' \ + -i "${S}"/toolkit/mozapps/installer/packager.mk || die + + # Keep codebase the same even if not using official branding + sed '/^MOZ_DEV_EDITION=1/d' \ + -i "${S}"/browser/branding/aurora/configure.sh || die + + eautoreconf + + # Must run autoconf in js/src + cd "${S}"/js/src || die + eautoconf + + # Need to update jemalloc's configure + cd "${S}"/memory/jemalloc/src || die + WANT_AUTOCONF= eautoconf +} + +src_configure() { + MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}" + MEXTENSIONS="default" + # Google API keys (see http://www.chromium.org/developers/how-tos/api-keys) + # Note: These are for Gentoo Linux use ONLY. For your own distribution, please + # get your own set of keys. + _google_api_key=AIzaSyDEAOvatFo0eTgsV_ZlEzx0ObmepsMzfAc + + #################################### + # + # mozconfig, CFLAGS and CXXFLAGS setup + # + #################################### + + mozconfig_init + mozconfig_config + + # We want rpath support to prevent unneeded hacks on different libc variants + append-ldflags -Wl,-rpath="${MOZILLA_FIVE_HOME}" + + # It doesn't compile on alpha without this LDFLAGS + use alpha && append-ldflags "-Wl,--no-relax" + + # Add full relro support for hardened + use hardened && append-ldflags "-Wl,-z,relro,-z,now" + + if use neon ; then + mozconfig_annotate '' --with-fpu=neon + mozconfig_annotate '' --with-thumb=yes + mozconfig_annotate '' --with-thumb-interwork=no + fi + + if [[ ${CHOST} == armv* ]] ; then + mozconfig_annotate '' --with-float-abi=hard + mozconfig_annotate '' --enable-skia + + if ! use system-libvpx ; then + sed -i -e "s|softfp|hard|" \ + "${S}"/media/libvpx/moz.build + fi + fi + + use egl && mozconfig_annotate 'Enable EGL as GL provider' --with-gl-provider=EGL + + # Setup api key for location services + echo -n "${_google_api_key}" > "${S}"/google-api-key + mozconfig_annotate '' --with-google-api-keyfile="${S}/google-api-key" + + mozconfig_annotate '' --enable-extensions="${MEXTENSIONS}" + mozconfig_annotate '' --disable-mailnews + + # Other ff-specific settings + mozconfig_annotate '' --with-default-mozilla-five-home=${MOZILLA_FIVE_HOME} + + # Allow for a proper pgo build + if use pgo; then + echo "mk_add_options PROFILE_GEN_SCRIPT='\$(PYTHON) \$(OBJDIR)/_profile/pgo/profileserver.py'" >> "${S}"/.mozconfig + fi + + echo "mk_add_options MOZ_OBJDIR=${BUILD_OBJ_DIR}" >> "${S}"/.mozconfig + + # Finalize and report settings + mozconfig_final + + if [[ $(gcc-major-version) -lt 4 ]]; then + append-cxxflags -fno-stack-protector + fi + + # workaround for funky/broken upstream configure... + emake -f client.mk configure +} + +src_compile() { + if use pgo; then + addpredict /root + addpredict /etc/gconf + # Reset and cleanup environment variables used by GNOME/XDG + gnome2_environment_reset + + # Firefox tries to use dri stuff when it's run, see bug 380283 + shopt -s nullglob + cards=$(echo -n /dev/dri/card* | sed 's/ /:/g') + if test -z "${cards}"; then + cards=$(echo -n /dev/ati/card* /dev/nvidiactl* | sed 's/ /:/g') + if test -n "${cards}"; then + # Binary drivers seem to cause access violations anyway, so + # let's use indirect rendering so that the device files aren't + # touched at all. See bug 394715. + export LIBGL_ALWAYS_INDIRECT=1 + fi + fi + shopt -u nullglob + addpredict "${cards}" + + CC="$(tc-getCC)" CXX="$(tc-getCXX)" LD="$(tc-getLD)" \ + MOZ_MAKE_FLAGS="${MAKEOPTS}" SHELL="${SHELL:-${EPREFIX%/}/bin/bash}" \ + Xemake -f client.mk profiledbuild || die "Xemake failed" + else + CC="$(tc-getCC)" CXX="$(tc-getCXX)" LD="$(tc-getLD)" \ + MOZ_MAKE_FLAGS="${MAKEOPTS}" SHELL="${SHELL:-${EPREFIX%/}/bin/bash}" \ + emake -f client.mk realbuild + fi + +} + +src_install() { + MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}" + DICTPATH="\"${EPREFIX}/usr/share/myspell\"" + + cd "${BUILD_OBJ_DIR}" || die + + # Pax mark xpcshell for hardened support, only used for startupcache creation. + pax-mark m "${BUILD_OBJ_DIR}"/dist/bin/xpcshell + + # Add our default prefs for firefox + cp "${FILESDIR}"/gentoo-default-prefs.js-2 \ + "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" \ + || die + + # Set default path to search for dictionaries. + echo "pref(\"spellchecker.dictionary_path\", ${DICTPATH});" \ + >> "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" \ + || die + + echo "pref(\"extensions.autoDisableScopes\", 3);" >> \ + "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" \ + || die + + local plugin + use gmp-autoupdate || for plugin in \ + gmp-gmpopenh264 ; do + echo "pref(\"media.${plugin}.autoupdate\", false);" >> \ + "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" \ + || die + done + + MOZ_MAKE_FLAGS="${MAKEOPTS}" \ + emake DESTDIR="${D}" install + + # Install language packs + mozlinguas_src_install + + local size sizes icon_path icon name + if use bindist; then + sizes="16 32 48" + icon_path="${S}/browser/branding/aurora" + # Firefox's new rapid release cycle means no more codenames + # Let's just stick with this one... + icon="aurora" + name="Aurora" + + # Override preferences to set the MOZ_DEV_EDITION defaults, since we + # don't define MOZ_DEV_EDITION to avoid profile debaucles. + # (source: browser/app/profile/firefox.js) + cat >>"${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" <> "${ED}/usr/share/applications/${PN}.desktop" \ + || die + fi + + # Required in order to use plugins and even run firefox on hardened. + if use jit; then + pax-mark m "${ED}"${MOZILLA_FIVE_HOME}/{firefox,firefox-bin,plugin-container} + else + pax-mark m "${ED}"${MOZILLA_FIVE_HOME}/plugin-container + fi + + if use minimal; then + rm -r "${ED}"/usr/include "${ED}${MOZILLA_FIVE_HOME}"/{idl,include,lib,sdk} \ + || die "Failed to remove sdk and headers" + fi + + # very ugly hack to make firefox not sigbus on sparc + # FIXME: is this still needed?? + use sparc && { sed -e 's/Firefox/FirefoxGentoo/g' \ + -i "${ED}/${MOZILLA_FIVE_HOME}/application.ini" \ + || die "sparc sed failed"; } +} + +pkg_preinst() { + gnome2_icon_savelist +} + +pkg_postinst() { + # Update mimedb for the new .desktop file + fdo-mime_desktop_database_update + gnome2_icon_cache_update +} + +pkg_postrm() { + gnome2_icon_cache_update +} diff --git a/www-client/firefox/firefox-42.0.ebuild b/www-client/firefox/firefox-42.0.ebuild deleted file mode 100644 index dcbba2489966..000000000000 --- a/www-client/firefox/firefox-42.0.ebuild +++ /dev/null @@ -1,404 +0,0 @@ -# Copyright 1999-2015 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -EAPI="5" -VIRTUALX_REQUIRED="pgo" -WANT_AUTOCONF="2.1" -MOZ_ESR="" - -# This list can be updated with scripts/get_langs.sh from the mozilla overlay -# No official support as of fetch time -# csb -MOZ_LANGS=( af ar as ast be bg bn-BD bn-IN br bs ca cs cy da de el en -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 gu-IN he hi-IN hr hu hy-AM id is it ja kk km kn ko lt lv mai mk ml mr -nb-NO nl nn-NO or pa-IN pl pt-BR pt-PT rm ro ru si sk sl son sq sr sv-SE ta te -th tr uk vi xh zh-CN zh-TW ) - -# Convert the ebuild version to the upstream mozilla version, used by mozlinguas -MOZ_PV="${PV/_alpha/a}" # Handle alpha for SRC_URI -MOZ_PV="${MOZ_PV/_beta/b}" # Handle beta for SRC_URI -MOZ_PV="${MOZ_PV/_rc/rc}" # Handle rc for SRC_URI - -if [[ ${MOZ_ESR} == 1 ]]; then - # ESR releases have slightly version numbers - MOZ_PV="${MOZ_PV}esr" -fi - -# Patch version -PATCH="${PN}-42.0-patches-02" -MOZ_HTTP_URI="http://archive.mozilla.org/pub/${PN}/releases" - -MOZCONFIG_OPTIONAL_GTK3=1 -MOZCONFIG_OPTIONAL_WIFI=1 -MOZCONFIG_OPTIONAL_JIT="enabled" - -inherit check-reqs flag-o-matic toolchain-funcs eutils gnome2-utils mozconfig-v6.42 multilib pax-utils fdo-mime autotools virtualx mozlinguas - -DESCRIPTION="Firefox Web Browser" -HOMEPAGE="http://www.mozilla.com/firefox" - -KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux" - -SLOT="0" -LICENSE="MPL-2.0 GPL-2 LGPL-2.1" -IUSE="bindist egl hardened +minimal neon pgo selinux +gmp-autoupdate test" -RESTRICT="!bindist? ( bindist )" - -# More URIs appended below... -SRC_URI="${SRC_URI} - https://dev.gentoo.org/~anarchy/mozilla/patchsets/${PATCH}.tar.xz - https://dev.gentoo.org/~axs/mozilla/patchsets/${PATCH}.tar.xz - https://dev.gentoo.org/~polynomial-c/mozilla/patchsets/${PATCH}.tar.xz" - -ASM_DEPEND=">=dev-lang/yasm-1.1" - -# Mesa 7.10 needed for WebGL + bugfixes -RDEPEND=" - >=dev-libs/nss-3.20.1 - >=dev-libs/nspr-4.10.10 - selinux? ( sec-policy/selinux-mozilla )" - -DEPEND="${RDEPEND} - pgo? ( - >=sys-devel/gcc-4.5 ) - amd64? ( ${ASM_DEPEND} - virtual/opengl ) - x86? ( ${ASM_DEPEND} - virtual/opengl )" - -# No source releases for alpha -if [[ ${PV} =~ alpha ]]; then - CHANGESET="8a3042764de7" - SRC_URI="${SRC_URI} - https://dev.gentoo.org/~nirbheek/mozilla/firefox/firefox-${MOZ_PV}_${CHANGESET}.source.tar.xz" - S="${WORKDIR}/mozilla-aurora-${CHANGESET}" -else - S="${WORKDIR}/firefox-${MOZ_PV}" - SRC_URI="${SRC_URI} - ${MOZ_HTTP_URI}/${MOZ_PV}/source/firefox-${MOZ_PV}.source.tar.xz" -fi - -QA_PRESTRIPPED="usr/$(get_libdir)/${PN}/firefox" - -BUILD_OBJ_DIR="${S}/ff" - -pkg_setup() { - moz_pkgsetup - - # Avoid PGO profiling problems due to enviroment leakage - # These should *always* be cleaned up anyway - unset DBUS_SESSION_BUS_ADDRESS \ - DISPLAY \ - ORBIT_SOCKETDIR \ - SESSION_MANAGER \ - XDG_SESSION_COOKIE \ - XAUTHORITY - - if ! use bindist; then - einfo - elog "You are enabling official branding. You may not redistribute this build" - elog "to any users on your network or the internet. Doing so puts yourself into" - elog "a legal problem with Mozilla Foundation" - elog "You can disable it by emerging ${PN} _with_ the bindist USE-flag" - fi - - if use pgo; then - einfo - ewarn "You will do a double build for profile guided optimization." - ewarn "This will result in your build taking at least twice as long as before." - fi -} - -pkg_pretend() { - # Ensure we have enough disk space to compile - if use pgo || use debug || use test ; then - CHECKREQS_DISK_BUILD="8G" - else - CHECKREQS_DISK_BUILD="4G" - fi - check-reqs_pkg_setup -} - -src_unpack() { - unpack ${A} - - # Unpack language packs - mozlinguas_src_unpack -} - -src_prepare() { - # Apply our patches - EPATCH_SUFFIX="patch" \ - EPATCH_FORCE="yes" \ - epatch "${WORKDIR}/firefox" - - # Allow user to apply any additional patches without modifing ebuild - epatch_user - - # Enable gnomebreakpad - if use debug ; then - sed -i -e "s:GNOME_DISABLE_CRASH_DIALOG=1:GNOME_DISABLE_CRASH_DIALOG=0:g" \ - "${S}"/build/unix/run-mozilla.sh || die "sed failed!" - fi - - # Ensure that our plugins dir is enabled as default - sed -i -e "s:/usr/lib/mozilla/plugins:/usr/lib/nsbrowser/plugins:" \ - "${S}"/xpcom/io/nsAppFileLocationProvider.cpp || die "sed failed to replace plugin path for 32bit!" - sed -i -e "s:/usr/lib64/mozilla/plugins:/usr/lib64/nsbrowser/plugins:" \ - "${S}"/xpcom/io/nsAppFileLocationProvider.cpp || die "sed failed to replace plugin path for 64bit!" - - # Fix sandbox violations during make clean, bug 372817 - sed -e "s:\(/no-such-file\):${T}\1:g" \ - -i "${S}"/config/rules.mk \ - -i "${S}"/nsprpub/configure{.in,} \ - || die - - # Don't exit with error when some libs are missing which we have in - # system. - sed '/^MOZ_PKG_FATAL_WARNINGS/s@= 1@= 0@' \ - -i "${S}"/browser/installer/Makefile.in || die - - # Don't error out when there's no files to be removed: - sed 's@\(xargs rm\)$@\1 -f@' \ - -i "${S}"/toolkit/mozapps/installer/packager.mk || die - - # Keep codebase the same even if not using official branding - sed '/^MOZ_DEV_EDITION=1/d' \ - -i "${S}"/browser/branding/aurora/configure.sh || die - - eautoreconf - - # Must run autoconf in js/src - cd "${S}"/js/src || die - eautoconf - - # Need to update jemalloc's configure - cd "${S}"/memory/jemalloc/src || die - WANT_AUTOCONF= eautoconf -} - -src_configure() { - MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}" - MEXTENSIONS="default" - # Google API keys (see http://www.chromium.org/developers/how-tos/api-keys) - # Note: These are for Gentoo Linux use ONLY. For your own distribution, please - # get your own set of keys. - _google_api_key=AIzaSyDEAOvatFo0eTgsV_ZlEzx0ObmepsMzfAc - - #################################### - # - # mozconfig, CFLAGS and CXXFLAGS setup - # - #################################### - - mozconfig_init - mozconfig_config - - # It doesn't compile on alpha without this LDFLAGS - use alpha && append-ldflags "-Wl,--no-relax" - - # Add full relro support for hardened - use hardened && append-ldflags "-Wl,-z,relro,-z,now" - - if use neon ; then - mozconfig_annotate '' --with-fpu=neon - mozconfig_annotate '' --with-thumb=yes - mozconfig_annotate '' --with-thumb-interwork=no - fi - - if [[ ${CHOST} == armv* ]] ; then - mozconfig_annotate '' --with-float-abi=hard - mozconfig_annotate '' --enable-skia - - if ! use system-libvpx ; then - sed -i -e "s|softfp|hard|" \ - "${S}"/media/libvpx/moz.build - fi - fi - - use egl && mozconfig_annotate 'Enable EGL as GL provider' --with-gl-provider=EGL - - # Setup api key for location services - echo -n "${_google_api_key}" > "${S}"/google-api-key - mozconfig_annotate '' --with-google-api-keyfile="${S}/google-api-key" - - mozconfig_annotate '' --enable-extensions="${MEXTENSIONS}" - mozconfig_annotate '' --disable-mailnews - - # Other ff-specific settings - mozconfig_annotate '' --with-default-mozilla-five-home=${MOZILLA_FIVE_HOME} - - # Allow for a proper pgo build - if use pgo; then - echo "mk_add_options PROFILE_GEN_SCRIPT='\$(PYTHON) \$(OBJDIR)/_profile/pgo/profileserver.py'" >> "${S}"/.mozconfig - fi - - echo "mk_add_options MOZ_OBJDIR=${BUILD_OBJ_DIR}" >> "${S}"/.mozconfig - - # Finalize and report settings - mozconfig_final - - if [[ $(gcc-major-version) -lt 4 ]]; then - append-cxxflags -fno-stack-protector - fi - - # workaround for funky/broken upstream configure... - emake -f client.mk configure -} - -src_compile() { - if use pgo; then - addpredict /root - addpredict /etc/gconf - # Reset and cleanup environment variables used by GNOME/XDG - gnome2_environment_reset - - # Firefox tries to use dri stuff when it's run, see bug 380283 - shopt -s nullglob - cards=$(echo -n /dev/dri/card* | sed 's/ /:/g') - if test -z "${cards}"; then - cards=$(echo -n /dev/ati/card* /dev/nvidiactl* | sed 's/ /:/g') - if test -n "${cards}"; then - # Binary drivers seem to cause access violations anyway, so - # let's use indirect rendering so that the device files aren't - # touched at all. See bug 394715. - export LIBGL_ALWAYS_INDIRECT=1 - fi - fi - shopt -u nullglob - addpredict "${cards}" - - CC="$(tc-getCC)" CXX="$(tc-getCXX)" LD="$(tc-getLD)" \ - MOZ_MAKE_FLAGS="${MAKEOPTS}" SHELL="${SHELL:-${EPREFIX%/}/bin/bash}" \ - Xemake -f client.mk profiledbuild || die "Xemake failed" - else - CC="$(tc-getCC)" CXX="$(tc-getCXX)" LD="$(tc-getLD)" \ - MOZ_MAKE_FLAGS="${MAKEOPTS}" SHELL="${SHELL:-${EPREFIX%/}/bin/bash}" \ - emake -f client.mk realbuild - fi - -} - -src_install() { - MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}" - DICTPATH="\"${EPREFIX}/usr/share/myspell\"" - - cd "${BUILD_OBJ_DIR}" || die - - # Pax mark xpcshell for hardened support, only used for startupcache creation. - pax-mark m "${BUILD_OBJ_DIR}"/dist/bin/xpcshell - - # Add our default prefs for firefox - cp "${FILESDIR}"/gentoo-default-prefs.js-1 \ - "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" \ - || die - - # Set default path to search for dictionaries. - echo "pref(\"spellchecker.dictionary_path\", ${DICTPATH});" \ - >> "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" \ - || die - - echo "pref(\"extensions.autoDisableScopes\", 3);" >> \ - "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" \ - || die - - local plugin - use gmp-autoupdate || for plugin in \ - gmp-gmpopenh264 ; do - echo "pref(\"media.${plugin}.autoupdate\", false);" >> \ - "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" \ - || die - done - - MOZ_MAKE_FLAGS="${MAKEOPTS}" \ - emake DESTDIR="${D}" install - - # Install language packs - mozlinguas_src_install - - local size sizes icon_path icon name - if use bindist; then - sizes="16 32 48" - icon_path="${S}/browser/branding/aurora" - # Firefox's new rapid release cycle means no more codenames - # Let's just stick with this one... - icon="aurora" - name="Aurora" - - # Override preferences to set the MOZ_DEV_EDITION defaults, since we - # don't define MOZ_DEV_EDITION to avoid profile debaucles. - # (source: browser/app/profile/firefox.js) - cat >>"${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" <> "${ED}/usr/share/applications/${PN}.desktop" \ - || die - fi - - # Required in order to use plugins and even run firefox on hardened. - if use jit; then - pax-mark m "${ED}"${MOZILLA_FIVE_HOME}/{firefox,firefox-bin,plugin-container} - else - pax-mark m "${ED}"${MOZILLA_FIVE_HOME}/plugin-container - fi - - if use minimal; then - rm -r "${ED}"/usr/include "${ED}${MOZILLA_FIVE_HOME}"/{idl,include,lib,sdk} \ - || die "Failed to remove sdk and headers" - fi - - # very ugly hack to make firefox not sigbus on sparc - # FIXME: is this still needed?? - use sparc && { sed -e 's/Firefox/FirefoxGentoo/g' \ - -i "${ED}/${MOZILLA_FIVE_HOME}/application.ini" \ - || die "sparc sed failed"; } - - # revdep-rebuild entry - insinto /etc/revdep-rebuild - echo "SEARCH_DIRS_MASK=${MOZILLA_FIVE_HOME}" >> ${T}/10firefox - doins "${T}"/10${PN} || die -} - -pkg_preinst() { - gnome2_icon_savelist -} - -pkg_postinst() { - # Update mimedb for the new .desktop file - fdo-mime_desktop_database_update - gnome2_icon_cache_update -} - -pkg_postrm() { - gnome2_icon_cache_update -} -- cgit v1.2.3-65-gdbad