| 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/firefox/firefox-13.0.ebuild,v 1.6 2012/07/04 19:17:28 anarchy Exp $
|
| 4 |
|
| 5 |
EAPI="3"
|
| 6 |
VIRTUALX_REQUIRED="pgo"
|
| 7 |
WANT_AUTOCONF="2.1"
|
| 8 |
MOZ_ESR=""
|
| 9 |
|
| 10 |
# This list can be updated with scripts/get_langs.sh from the mozilla overlay
|
| 11 |
MOZ_LANGS=(af ak ar as ast be bg bn-BD bn-IN br bs ca cs csb cy da de el en
|
| 12 |
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
|
| 13 |
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
|
| 14 |
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
|
| 15 |
te th tr uk vi zh-CN zh-TW zu)
|
| 16 |
|
| 17 |
# Convert the ebuild version to the upstream mozilla version, used by mozlinguas
|
| 18 |
MOZ_PV="${PV/_alpha/a}" # Handle alpha for SRC_URI
|
| 19 |
MOZ_PV="${MOZ_PV/_beta/b}" # Handle beta for SRC_URI
|
| 20 |
MOZ_PV="${MOZ_PV/_rc/rc}" # Handle rc for SRC_URI
|
| 21 |
|
| 22 |
if [[ ${MOZ_ESR} == 1 ]]; then
|
| 23 |
# ESR releases have slightly version numbers
|
| 24 |
MOZ_PV="${MOZ_PV}esr"
|
| 25 |
fi
|
| 26 |
|
| 27 |
# Changeset for alpha snapshot
|
| 28 |
CHANGESET="e56ecd8b3a68"
|
| 29 |
# Patch version
|
| 30 |
PATCH="${PN}-13.0-patches-0.2"
|
| 31 |
# Upstream ftp release URI that's used by mozlinguas.eclass
|
| 32 |
# We don't use the http mirror because it deletes old tarballs.
|
| 33 |
MOZ_FTP_URI="ftp://ftp.mozilla.org/pub/${PN}/releases/"
|
| 34 |
|
| 35 |
inherit check-reqs flag-o-matic toolchain-funcs eutils gnome2-utils mozconfig-3 multilib pax-utils fdo-mime autotools python virtualx nsplugins mozlinguas
|
| 36 |
|
| 37 |
DESCRIPTION="Firefox Web Browser"
|
| 38 |
HOMEPAGE="http://www.mozilla.com/firefox"
|
| 39 |
|
| 40 |
KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux"
|
| 41 |
SLOT="0"
|
| 42 |
LICENSE="MPL-2.0 GPL-2 LGPL-2.1"
|
| 43 |
IUSE="bindist +crashreporter +ipc +jit +minimal pgo selinux system-sqlite +webm"
|
| 44 |
|
| 45 |
# More URIs appended below...
|
| 46 |
SRC_URI="${SRC_URI}
|
| 47 |
http://dev.gentoo.org/~anarchy/mozilla/patchsets/${PATCH}.tar.xz"
|
| 48 |
|
| 49 |
ASM_DEPEND=">=dev-lang/yasm-1.1"
|
| 50 |
|
| 51 |
# Mesa 7.10 needed for WebGL + bugfixes
|
| 52 |
RDEPEND="
|
| 53 |
>=sys-devel/binutils-2.16.1
|
| 54 |
>=dev-libs/nss-3.13.5
|
| 55 |
>=dev-libs/nspr-4.9.1
|
| 56 |
>=dev-libs/glib-2.26:2
|
| 57 |
>=media-libs/mesa-7.10
|
| 58 |
>=media-libs/libpng-1.5.9[apng]
|
| 59 |
virtual/libffi
|
| 60 |
system-sqlite? ( >=dev-db/sqlite-3.7.10[fts3,secure-delete,threadsafe,unlock-notify,debug=] )
|
| 61 |
webm? ( >=media-libs/libvpx-1.0.0
|
| 62 |
media-libs/alsa-lib )
|
| 63 |
crashreporter? ( net-misc/curl )
|
| 64 |
selinux? ( sec-policy/selinux-mozilla )"
|
| 65 |
# We don't use PYTHON_DEPEND/PYTHON_USE_WITH for some silly reason
|
| 66 |
DEPEND="${RDEPEND}
|
| 67 |
virtual/pkgconfig
|
| 68 |
pgo? (
|
| 69 |
=dev-lang/python-2*[sqlite]
|
| 70 |
>=sys-devel/gcc-4.5 )
|
| 71 |
webm? ( x86? ( ${ASM_DEPEND} )
|
| 72 |
amd64? ( ${ASM_DEPEND} )
|
| 73 |
virtual/opengl )"
|
| 74 |
|
| 75 |
# No source releases for alpha|beta
|
| 76 |
if [[ ${PV} =~ alpha ]]; then
|
| 77 |
SRC_URI="${SRC_URI}
|
| 78 |
http://dev.gentoo.org/~anarchy/mozilla/firefox/firefox-${MOZ_PV}_${CHANGESET}.source.tar.bz2"
|
| 79 |
S="${WORKDIR}/mozilla-central"
|
| 80 |
elif [[ ${PV} =~ beta ]]; then
|
| 81 |
S="${WORKDIR}/mozilla-beta"
|
| 82 |
SRC_URI="${SRC_URI}
|
| 83 |
${MOZ_FTP_URI}/${MOZ_PV}/source/firefox-${MOZ_PV}.source.tar.bz2"
|
| 84 |
else
|
| 85 |
SRC_URI="${SRC_URI}
|
| 86 |
${MOZ_FTP_URI}/${MOZ_PV}/source/firefox-${MOZ_PV}.source.tar.bz2"
|
| 87 |
if [[ ${MOZ_ESR} == 1 ]]; then
|
| 88 |
S="${WORKDIR}/mozilla-esr${PV%%.*}"
|
| 89 |
else
|
| 90 |
S="${WORKDIR}/mozilla-release"
|
| 91 |
fi
|
| 92 |
fi
|
| 93 |
|
| 94 |
QA_PRESTRIPPED="usr/$(get_libdir)/${PN}/firefox"
|
| 95 |
|
| 96 |
pkg_setup() {
|
| 97 |
moz_pkgsetup
|
| 98 |
|
| 99 |
# Avoid PGO profiling problems due to enviroment leakage
|
| 100 |
# These should *always* be cleaned up anyway
|
| 101 |
unset DBUS_SESSION_BUS_ADDRESS \
|
| 102 |
DISPLAY \
|
| 103 |
ORBIT_SOCKETDIR \
|
| 104 |
SESSION_MANAGER \
|
| 105 |
XDG_SESSION_COOKIE \
|
| 106 |
XAUTHORITY
|
| 107 |
|
| 108 |
if ! use bindist; then
|
| 109 |
einfo
|
| 110 |
elog "You are enabling official branding. You may not redistribute this build"
|
| 111 |
elog "to any users on your network or the internet. Doing so puts yourself into"
|
| 112 |
elog "a legal problem with Mozilla Foundation"
|
| 113 |
elog "You can disable it by emerging ${PN} _with_ the bindist USE-flag"
|
| 114 |
fi
|
| 115 |
|
| 116 |
if use pgo; then
|
| 117 |
einfo
|
| 118 |
ewarn "You will do a double build for profile guided optimization."
|
| 119 |
ewarn "This will result in your build taking at least twice as long as before."
|
| 120 |
fi
|
| 121 |
|
| 122 |
# Ensure we have enough disk space to compile
|
| 123 |
if use pgo || use debug || use test ; then
|
| 124 |
CHECKREQS_DISK_BUILD="8G"
|
| 125 |
else
|
| 126 |
CHECKREQS_DISK_BUILD="4G"
|
| 127 |
fi
|
| 128 |
check-reqs_pkg_setup
|
| 129 |
}
|
| 130 |
|
| 131 |
src_unpack() {
|
| 132 |
unpack ${A}
|
| 133 |
|
| 134 |
# Unpack language packs
|
| 135 |
mozlinguas_src_unpack
|
| 136 |
}
|
| 137 |
|
| 138 |
src_prepare() {
|
| 139 |
# Apply our patches
|
| 140 |
EPATCH_SUFFIX="patch" \
|
| 141 |
EPATCH_FORCE="yes" \
|
| 142 |
epatch "${WORKDIR}/firefox"
|
| 143 |
|
| 144 |
# Allow user to apply any additional patches without modifing ebuild
|
| 145 |
epatch_user
|
| 146 |
|
| 147 |
# Enable gnomebreakpad
|
| 148 |
if use debug ; then
|
| 149 |
sed -i -e "s:GNOME_DISABLE_CRASH_DIALOG=1:GNOME_DISABLE_CRASH_DIALOG=0:g" \
|
| 150 |
"${S}"/build/unix/run-mozilla.sh || die "sed failed!"
|
| 151 |
fi
|
| 152 |
|
| 153 |
# Disable gnomevfs extension
|
| 154 |
sed -i -e "s:gnomevfs::" "${S}/"browser/confvars.sh \
|
| 155 |
-e "s:gnomevfs::" "${S}/"xulrunner/confvars.sh \
|
| 156 |
|| die "Failed to remove gnomevfs extension"
|
| 157 |
|
| 158 |
# Ensure that are plugins dir is enabled as default
|
| 159 |
sed -i -e "s:/usr/lib/mozilla/plugins:/usr/$(get_libdir)/nsbrowser/plugins:" \
|
| 160 |
"${S}"/xpcom/io/nsAppFileLocationProvider.cpp || die "sed failed to replace plugin path!"
|
| 161 |
|
| 162 |
# Fix sandbox violations during make clean, bug 372817
|
| 163 |
sed -e "s:\(/no-such-file\):${T}\1:g" \
|
| 164 |
-i "${S}"/config/rules.mk \
|
| 165 |
-i "${S}"/js/src/config/rules.mk \
|
| 166 |
-i "${S}"/nsprpub/configure{.in,} \
|
| 167 |
|| die
|
| 168 |
|
| 169 |
#Fix compilation with curl-7.21.7 bug 376027
|
| 170 |
sed -e '/#include <curl\/types.h>/d' \
|
| 171 |
-i "${S}"/toolkit/crashreporter/google-breakpad/src/common/linux/http_upload.cc \
|
| 172 |
-i "${S}"/toolkit/crashreporter/google-breakpad/src/common/linux/libcurl_wrapper.cc \
|
| 173 |
-i "${S}"/config/system-headers \
|
| 174 |
-i "${S}"/js/src/config/system-headers || die "Sed failed"
|
| 175 |
|
| 176 |
eautoreconf
|
| 177 |
}
|
| 178 |
|
| 179 |
src_configure() {
|
| 180 |
MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}"
|
| 181 |
MEXTENSIONS="default"
|
| 182 |
|
| 183 |
####################################
|
| 184 |
#
|
| 185 |
# mozconfig, CFLAGS and CXXFLAGS setup
|
| 186 |
#
|
| 187 |
####################################
|
| 188 |
|
| 189 |
mozconfig_init
|
| 190 |
mozconfig_config
|
| 191 |
|
| 192 |
# It doesn't compile on alpha without this LDFLAGS
|
| 193 |
use alpha && append-ldflags "-Wl,--no-relax"
|
| 194 |
|
| 195 |
mozconfig_annotate '' --prefix="${EPREFIX}"/usr
|
| 196 |
mozconfig_annotate '' --libdir="${EPREFIX}"/usr/$(get_libdir)
|
| 197 |
mozconfig_annotate '' --enable-extensions="${MEXTENSIONS}"
|
| 198 |
mozconfig_annotate '' --disable-gconf
|
| 199 |
mozconfig_annotate '' --disable-mailnews
|
| 200 |
mozconfig_annotate '' --enable-canvas
|
| 201 |
mozconfig_annotate '' --enable-safe-browsing
|
| 202 |
mozconfig_annotate '' --with-system-png
|
| 203 |
mozconfig_annotate '' --enable-system-ffi
|
| 204 |
|
| 205 |
# Other ff-specific settings
|
| 206 |
mozconfig_annotate '' --with-default-mozilla-five-home=${MOZILLA_FIVE_HOME}
|
| 207 |
mozconfig_annotate '' --target="${CTARGET:-${CHOST}}"
|
| 208 |
|
| 209 |
mozconfig_use_enable system-sqlite
|
| 210 |
# Both methodjit and tracejit conflict with PaX
|
| 211 |
mozconfig_use_enable jit methodjit
|
| 212 |
mozconfig_use_enable jit tracejit
|
| 213 |
|
| 214 |
# Allow for a proper pgo build
|
| 215 |
if use pgo; then
|
| 216 |
echo "mk_add_options PROFILE_GEN_SCRIPT='\$(PYTHON) \$(OBJDIR)/_profile/pgo/profileserver.py'" >> "${S}"/.mozconfig
|
| 217 |
fi
|
| 218 |
|
| 219 |
# Finalize and report settings
|
| 220 |
mozconfig_final
|
| 221 |
|
| 222 |
if [[ $(gcc-major-version) -lt 4 ]]; then
|
| 223 |
append-cxxflags -fno-stack-protector
|
| 224 |
elif [[ $(gcc-major-version) -gt 4 || $(gcc-minor-version) -gt 3 ]]; then
|
| 225 |
if use amd64 || use x86; then
|
| 226 |
append-flags -mno-avx
|
| 227 |
fi
|
| 228 |
fi
|
| 229 |
}
|
| 230 |
|
| 231 |
src_compile() {
|
| 232 |
if use pgo; then
|
| 233 |
addpredict /root
|
| 234 |
addpredict /etc/gconf
|
| 235 |
# Reset and cleanup environment variables used by GNOME/XDG
|
| 236 |
gnome2_environment_reset
|
| 237 |
|
| 238 |
# Firefox tries to use dri stuff when it's run, see bug 380283
|
| 239 |
shopt -s nullglob
|
| 240 |
cards=$(echo -n /dev/dri/card* | sed 's/ /:/g')
|
| 241 |
if test -n "${cards}"; then
|
| 242 |
# FOSS drivers are fine
|
| 243 |
addpredict "${cards}"
|
| 244 |
else
|
| 245 |
cards=$(echo -n /dev/ati/card* /dev/nvidiactl* | sed 's/ /:/g')
|
| 246 |
if test -n "${cards}"; then
|
| 247 |
# Binary drivers seem to cause access violations anyway, so
|
| 248 |
# let's use indirect rendering so that the device files aren't
|
| 249 |
# touched at all. See bug 394715.
|
| 250 |
export LIBGL_ALWAYS_INDIRECT=1
|
| 251 |
fi
|
| 252 |
fi
|
| 253 |
shopt -u nullglob
|
| 254 |
|
| 255 |
CC="$(tc-getCC)" CXX="$(tc-getCXX)" LD="$(tc-getLD)" \
|
| 256 |
MOZ_MAKE_FLAGS="${MAKEOPTS}" \
|
| 257 |
Xemake -f client.mk profiledbuild || die "Xemake failed"
|
| 258 |
else
|
| 259 |
CC="$(tc-getCC)" CXX="$(tc-getCXX)" LD="$(tc-getLD)" \
|
| 260 |
MOZ_MAKE_FLAGS="${MAKEOPTS}" \
|
| 261 |
emake -f client.mk || die "emake failed"
|
| 262 |
fi
|
| 263 |
|
| 264 |
}
|
| 265 |
|
| 266 |
src_install() {
|
| 267 |
MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}"
|
| 268 |
|
| 269 |
# MOZ_BUILD_ROOT, and hence OBJ_DIR change depending on arch, compiler, pgo, etc.
|
| 270 |
local obj_dir="$(echo */config.log)"
|
| 271 |
obj_dir="${obj_dir%/*}"
|
| 272 |
cd "${S}/${obj_dir}"
|
| 273 |
|
| 274 |
# Without methodjit and tracejit there's no conflict with PaX
|
| 275 |
if use jit; then
|
| 276 |
# Pax mark xpcshell for hardened support, only used for startupcache creation.
|
| 277 |
pax-mark m "${S}/${obj_dir}"/dist/bin/xpcshell
|
| 278 |
fi
|
| 279 |
|
| 280 |
# Add our default prefs for firefox + xulrunner
|
| 281 |
cp "${FILESDIR}"/gentoo-default-prefs.js-1 \
|
| 282 |
"${S}/${obj_dir}/dist/bin/defaults/pref/all-gentoo.js" || die
|
| 283 |
|
| 284 |
MOZ_MAKE_FLAGS="${MAKEOPTS}" \
|
| 285 |
emake DESTDIR="${D}" install || die "emake install failed"
|
| 286 |
|
| 287 |
# Install language packs
|
| 288 |
mozlinguas_src_install
|
| 289 |
|
| 290 |
local size sizes icon_path icon name
|
| 291 |
if use bindist; then
|
| 292 |
sizes="16 32 48"
|
| 293 |
icon_path="${S}/browser/branding/aurora"
|
| 294 |
# Firefox's new rapid release cycle means no more codenames
|
| 295 |
# Let's just stick with this one...
|
| 296 |
icon="aurora"
|
| 297 |
name="Aurora"
|
| 298 |
else
|
| 299 |
sizes="16 22 24 32 256"
|
| 300 |
icon_path="${S}/browser/branding/official"
|
| 301 |
icon="${PN}"
|
| 302 |
name="Mozilla Firefox"
|
| 303 |
fi
|
| 304 |
|
| 305 |
# Install icons and .desktop for menu entry
|
| 306 |
for size in ${sizes}; do
|
| 307 |
insinto "/usr/share/icons/hicolor/${size}x${size}/apps"
|
| 308 |
newins "${icon_path}/default${size}.png" "${icon}.png" || die
|
| 309 |
done
|
| 310 |
# The 128x128 icon has a different name
|
| 311 |
insinto "/usr/share/icons/hicolor/128x128/apps"
|
| 312 |
newins "${icon_path}/mozicon128.png" "${icon}.png" || die
|
| 313 |
# Install a 48x48 icon into /usr/share/pixmaps for legacy DEs
|
| 314 |
newicon "${icon_path}/content/icon48.png" "${icon}.png" || die
|
| 315 |
newmenu "${FILESDIR}/icon/${PN}.desktop" "${PN}.desktop" || die
|
| 316 |
sed -i -e "s:@NAME@:${name}:" -e "s:@ICON@:${icon}:" \
|
| 317 |
"${ED}/usr/share/applications/${PN}.desktop" || die
|
| 318 |
|
| 319 |
# Add StartupNotify=true bug 237317
|
| 320 |
if use startup-notification ; then
|
| 321 |
echo "StartupNotify=true" >> "${ED}/usr/share/applications/${PN}.desktop"
|
| 322 |
fi
|
| 323 |
|
| 324 |
# Without methodjit and tracejit there's no conflict with PaX
|
| 325 |
if use jit; then
|
| 326 |
# Required in order to use plugins and even run firefox on hardened.
|
| 327 |
pax-mark m "${ED}"${MOZILLA_FIVE_HOME}/{firefox,firefox-bin}
|
| 328 |
fi
|
| 329 |
|
| 330 |
# Plugin-container needs to be pax-marked for hardened to ensure plugins such as flash
|
| 331 |
# continue to work as expected.
|
| 332 |
pax-mark m "${ED}"${MOZILLA_FIVE_HOME}/plugin-container
|
| 333 |
|
| 334 |
# Plugins dir
|
| 335 |
share_plugins_dir
|
| 336 |
|
| 337 |
if use minimal; then
|
| 338 |
rm -rf "${ED}"/usr/include "${ED}${MOZILLA_FIVE_HOME}"/{idl,include,lib,sdk} || \
|
| 339 |
die "Failed to remove sdk and headers"
|
| 340 |
fi
|
| 341 |
|
| 342 |
# very ugly hack to make firefox not sigbus on sparc
|
| 343 |
# FIXME: is this still needed??
|
| 344 |
use sparc && { sed -e 's/Firefox/FirefoxGentoo/g' \
|
| 345 |
-i "${ED}/${MOZILLA_FIVE_HOME}/application.ini" || \
|
| 346 |
die "sparc sed failed"; }
|
| 347 |
}
|
| 348 |
|
| 349 |
pkg_preinst() {
|
| 350 |
gnome2_icon_savelist
|
| 351 |
}
|
| 352 |
|
| 353 |
pkg_postinst() {
|
| 354 |
# Update mimedb for the new .desktop file
|
| 355 |
fdo-mime_desktop_database_update
|
| 356 |
gnome2_icon_cache_update
|
| 357 |
}
|
| 358 |
|
| 359 |
pkg_postrm() {
|
| 360 |
gnome2_icon_cache_update
|
| 361 |
}
|