Line 0
Link Here
|
0 |
- |
1 |
# Copyright 1999-2014 Gentoo Foundation |
|
|
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# $Header: /var/cvsroot/gentoo-x86/www-client/firefox/firefox-34.0.5-r1.ebuild,v 1.2 2014/12/05 23:06:43 axs Exp $ |
4 |
|
5 |
EAPI="5" |
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 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 |
13 |
gl gu-IN he hi-IN hr hu hy-AM id is it ja kk km kn ko lt lv mai mk ml mr |
14 |
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 |
15 |
th tr uk vi xh zh-CN zh-TW ) |
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 |
# Patch version |
28 |
PATCH="${PN}-34.0-patches-0.1" |
29 |
# Upstream ftp release URI that's used by mozlinguas.eclass |
30 |
# We don't use the http mirror because it deletes old tarballs. |
31 |
MOZ_FTP_URI="ftp://ftp.mozilla.org/pub/${PN}/releases/" |
32 |
MOZ_HTTP_URI="http://ftp.mozilla.org/pub/${PN}/releases/" |
33 |
|
34 |
MOZCONFIG_OPTIONAL_WIFI=1 |
35 |
MOZCONFIG_OPTIONAL_JIT="enabled" |
36 |
|
37 |
inherit check-reqs flag-o-matic toolchain-funcs eutils gnome2-utils mozconfig-v5.34 multilib pax-utils fdo-mime autotools virtualx mozlinguas |
38 |
|
39 |
DESCRIPTION="Firefox Web Browser" |
40 |
HOMEPAGE="http://www.mozilla.com/firefox" |
41 |
|
42 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux" |
43 |
SLOT="0" |
44 |
LICENSE="MPL-2.0 GPL-2 LGPL-2.1" |
45 |
IUSE="bindist hardened +minimal pgo selinux +gmp-autoupdate test" |
46 |
|
47 |
# More URIs appended below... |
48 |
SRC_URI="${SRC_URI} |
49 |
http://dev.gentoo.org/~anarchy/mozilla/patchsets/${PATCH}.tar.xz |
50 |
http://dev.gentoo.org/~axs/distfiles/${PATCH}.tar.xz" |
51 |
|
52 |
ASM_DEPEND=">=dev-lang/yasm-1.1" |
53 |
|
54 |
# Mesa 7.10 needed for WebGL + bugfixes |
55 |
RDEPEND=" |
56 |
>=dev-libs/nss-3.17.2 |
57 |
>=dev-libs/nspr-4.10.7 |
58 |
selinux? ( sec-policy/selinux-mozilla )" |
59 |
|
60 |
DEPEND="${RDEPEND} |
61 |
pgo? ( |
62 |
>=sys-devel/gcc-4.5 ) |
63 |
amd64? ( ${ASM_DEPEND} |
64 |
virtual/opengl ) |
65 |
x86? ( ${ASM_DEPEND} |
66 |
virtual/opengl )" |
67 |
|
68 |
# No source releases for alpha|beta |
69 |
if [[ ${PV} =~ alpha ]]; then |
70 |
CHANGESET="8a3042764de7" |
71 |
SRC_URI="${SRC_URI} |
72 |
http://dev.gentoo.org/~nirbheek/mozilla/firefox/firefox-${MOZ_PV}_${CHANGESET}.source.tar.bz2" |
73 |
S="${WORKDIR}/mozilla-aurora-${CHANGESET}" |
74 |
elif [[ ${PV} =~ beta ]]; then |
75 |
S="${WORKDIR}/mozilla-beta" |
76 |
SRC_URI="${SRC_URI} |
77 |
${MOZ_FTP_URI}/${MOZ_PV}/source/firefox-${MOZ_PV}.source.tar.bz2 |
78 |
${MOZ_HTTP_URI}/${MOZ_PV}/source/firefox-${MOZ_PV}.source.tar.bz2" |
79 |
else |
80 |
SRC_URI="${SRC_URI} |
81 |
${MOZ_FTP_URI}/${MOZ_PV}/source/firefox-${MOZ_PV}.source.tar.bz2 |
82 |
${MOZ_HTTP_URI}/${MOZ_PV}/source/firefox-${MOZ_PV}.source.tar.bz2" |
83 |
if [[ ${MOZ_ESR} == 1 ]]; then |
84 |
S="${WORKDIR}/mozilla-esr${PV%%.*}" |
85 |
else |
86 |
S="${WORKDIR}/mozilla-release" |
87 |
fi |
88 |
fi |
89 |
|
90 |
QA_PRESTRIPPED="usr/$(get_libdir)/${PN}/firefox" |
91 |
|
92 |
BUILD_OBJ_DIR="${S}/ff" |
93 |
|
94 |
pkg_setup() { |
95 |
moz_pkgsetup |
96 |
|
97 |
# Avoid PGO profiling problems due to enviroment leakage |
98 |
# These should *always* be cleaned up anyway |
99 |
unset DBUS_SESSION_BUS_ADDRESS \ |
100 |
DISPLAY \ |
101 |
ORBIT_SOCKETDIR \ |
102 |
SESSION_MANAGER \ |
103 |
XDG_SESSION_COOKIE \ |
104 |
XAUTHORITY |
105 |
|
106 |
if ! use bindist; then |
107 |
einfo |
108 |
elog "You are enabling official branding. You may not redistribute this build" |
109 |
elog "to any users on your network or the internet. Doing so puts yourself into" |
110 |
elog "a legal problem with Mozilla Foundation" |
111 |
elog "You can disable it by emerging ${PN} _with_ the bindist USE-flag" |
112 |
fi |
113 |
|
114 |
if use pgo; then |
115 |
einfo |
116 |
ewarn "You will do a double build for profile guided optimization." |
117 |
ewarn "This will result in your build taking at least twice as long as before." |
118 |
fi |
119 |
} |
120 |
|
121 |
pkg_pretend() { |
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 |
if use jit && [[ -n ${PROFILE_IS_HARDENED} ]]; then |
131 |
ewarn "You are emerging this package on a hardened profile with USE=jit enabled." |
132 |
ewarn "This is horribly insecure as it disables all PAGEEXEC restrictions." |
133 |
ewarn "Please ensure you know what you are doing. If you don't, please consider" |
134 |
ewarn "emerging the package with USE=-jit" |
135 |
fi |
136 |
} |
137 |
|
138 |
src_unpack() { |
139 |
unpack ${A} |
140 |
|
141 |
# Unpack language packs |
142 |
mozlinguas_src_unpack |
143 |
} |
144 |
|
145 |
src_prepare() { |
146 |
# Apply our patches |
147 |
EPATCH_SUFFIX="patch" \ |
148 |
EPATCH_FORCE="yes" \ |
149 |
epatch "${WORKDIR}/firefox" |
150 |
|
151 |
# Avoid using basename https://bugzilla.mozilla.org/show_bug.cgi?id=1041962 |
152 |
epatch "${FILESDIR}"/avoid-basename-musl.patch |
153 |
# <fts.h> unavailable on Android and musl, portions from |
154 |
# http://git.alpinelinux.org/cgit/aports/tree/main/firefox/fix-ipc.patch |
155 |
epatch "${FILESDIR}"/avoid-fts-on-nonglibc-musl.patch |
156 |
# getcontext() unavailable on musl, safe to omit |
157 |
epatch "${FILESDIR}"/avoid-getcontext-musl.patch |
158 |
# the glibc check should be non-Android Linux |
159 |
epatch "${FILESDIR}"/define-gettid-unconditonally-musl.patch |
160 |
# <a.out.h> unavailable on musl, yet somehow the build system still defines |
161 |
# HAVE_A_OUT_H - unconditionally disable for now, better to fix configure. |
162 |
# Portions from |
163 |
# http://git.alpinelinux.org/cgit/aports/tree/main/firefox/fix-toolkit.patch |
164 |
epatch "${FILESDIR}"/dont-include-aouth-musl.patch |
165 |
# non-Android Linux check should be a glibc Linux check |
166 |
epatch "${FILESDIR}"/fix-android-check-musl.patch |
167 |
# <sys/sysctl.h> unavailable on musl |
168 |
epatch "${FILESDIR}"/fix-jemalloc-includes-musl.patch |
169 |
# <sys/sysctl.h> unavailable on musl, also wrong order of kernel headers |
170 |
# Portions from |
171 |
# http://git.alpinelinux.org/cgit/aports/tree/main/firefox/fix-media.patch |
172 |
epatch "${FILESDIR}"/fix-mtransport-includes-musl.patch |
173 |
# Dumb sctp-refimpl include fixes, to be improved and submitted upstream |
174 |
# Portions from |
175 |
# http://git.alpinelinux.org/cgit/aports/tree/main/firefox/fix-netwerk.patch |
176 |
epatch "${FILESDIR}"/fix-sctp-includes-musl.patch |
177 |
# Files erroneously assume other headers include <sys/types.h> |
178 |
# Portions from |
179 |
# http://git.alpinelinux.org/cgit/aports/tree/main/firefox/fix-tools.patch |
180 |
epatch "${FILESDIR}"/include-systypesh-musl.patch |
181 |
# Incorrect assumptions about pthread_t |
182 |
# https://bugzilla.mozilla.org/show_bug.cgi?id=1010194 |
183 |
epatch "${FILESDIR}"/make-handleInt-unsigned-long-musl.patch |
184 |
# Felix Janda's amd64 fixes |
185 |
epatch "${FILESDIR}"/fix-amd64-build-musl.patch |
186 |
# Stagefright includes <sys/cdefs.h>, unavailable on musl. Upstream will |
187 |
# probably want to include it on Android. |
188 |
epatch "${FILESDIR}"/dont-include-cdefsh-stagefright-musl.patch |
189 |
|
190 |
# Allow user to apply any additional patches without modifing ebuild |
191 |
epatch_user |
192 |
|
193 |
# From http://git.alpinelinux.org/cgit/aports/tree/main/firefox/stab.h, added N_UNDF |
194 |
cp "${FILESDIR}"/stab.h "${S}"/toolkit/crashreporter/google-breakpad/src/ |
195 |
|
196 |
# Enable gnomebreakpad |
197 |
if use debug ; then |
198 |
sed -i -e "s:GNOME_DISABLE_CRASH_DIALOG=1:GNOME_DISABLE_CRASH_DIALOG=0:g" \ |
199 |
"${S}"/build/unix/run-mozilla.sh || die "sed failed!" |
200 |
fi |
201 |
|
202 |
# Ensure that our plugins dir is enabled as default |
203 |
sed -i -e "s:/usr/lib/mozilla/plugins:/usr/lib/nsbrowser/plugins:" \ |
204 |
"${S}"/xpcom/io/nsAppFileLocationProvider.cpp || die "sed failed to replace plugin path for 32bit!" |
205 |
sed -i -e "s:/usr/lib64/mozilla/plugins:/usr/lib64/nsbrowser/plugins:" \ |
206 |
"${S}"/xpcom/io/nsAppFileLocationProvider.cpp || die "sed failed to replace plugin path for 64bit!" |
207 |
|
208 |
# Fix sandbox violations during make clean, bug 372817 |
209 |
sed -e "s:\(/no-such-file\):${T}\1:g" \ |
210 |
-i "${S}"/config/rules.mk \ |
211 |
-i "${S}"/nsprpub/configure{.in,} \ |
212 |
|| die |
213 |
|
214 |
# Don't exit with error when some libs are missing which we have in |
215 |
# system. |
216 |
sed '/^MOZ_PKG_FATAL_WARNINGS/s@= 1@= 0@' \ |
217 |
-i "${S}"/browser/installer/Makefile.in || die |
218 |
|
219 |
# Don't error out when there's no files to be removed: |
220 |
sed 's@\(xargs rm\)$@\1 -f@' \ |
221 |
-i "${S}"/toolkit/mozapps/installer/packager.mk || die |
222 |
|
223 |
eautoreconf |
224 |
|
225 |
# Must run autoconf in js/src |
226 |
cd "${S}"/js/src || die |
227 |
eautoconf |
228 |
|
229 |
# Need to update jemalloc's configure |
230 |
cd "${S}"/memory/jemalloc/src || die |
231 |
WANT_AUTOCONF= eautoconf |
232 |
} |
233 |
|
234 |
src_configure() { |
235 |
MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}" |
236 |
MEXTENSIONS="default" |
237 |
# Google API keys (see http://www.chromium.org/developers/how-tos/api-keys) |
238 |
# Note: These are for Gentoo Linux use ONLY. For your own distribution, please |
239 |
# get your own set of keys. |
240 |
_google_api_key=AIzaSyDEAOvatFo0eTgsV_ZlEzx0ObmepsMzfAc |
241 |
|
242 |
#################################### |
243 |
# |
244 |
# mozconfig, CFLAGS and CXXFLAGS setup |
245 |
# |
246 |
#################################### |
247 |
|
248 |
mozconfig_init |
249 |
mozconfig_config |
250 |
|
251 |
# It doesn't compile on alpha without this LDFLAGS |
252 |
use alpha && append-ldflags "-Wl,--no-relax" |
253 |
|
254 |
# Add full relro support for hardened |
255 |
use hardened && append-ldflags "-Wl,-z,relro,-z,now" |
256 |
|
257 |
# Setup api key for location services |
258 |
echo -n "${_google_api_key}" > "${S}"/google-api-key |
259 |
mozconfig_annotate '' --with-google-api-keyfile="${S}/google-api-key" |
260 |
|
261 |
mozconfig_annotate '' --enable-extensions="${MEXTENSIONS}" |
262 |
mozconfig_annotate '' --disable-mailnews |
263 |
|
264 |
# Other ff-specific settings |
265 |
mozconfig_annotate '' --with-default-mozilla-five-home=${MOZILLA_FIVE_HOME} |
266 |
|
267 |
# mozjemalloc doesn't build on musl yet |
268 |
mozconfig_annotate '' --disable-replace-malloc |
269 |
mozconfig_annotate '' --disable-jemalloc |
270 |
|
271 |
# Allow for a proper pgo build |
272 |
if use pgo; then |
273 |
echo "mk_add_options PROFILE_GEN_SCRIPT='\$(PYTHON) \$(OBJDIR)/_profile/pgo/profileserver.py'" >> "${S}"/.mozconfig |
274 |
fi |
275 |
|
276 |
echo "mk_add_options MOZ_OBJDIR=${BUILD_OBJ_DIR}" >> "${S}"/.mozconfig |
277 |
|
278 |
# Finalize and report settings |
279 |
mozconfig_final |
280 |
|
281 |
if [[ $(gcc-major-version) -lt 4 ]]; then |
282 |
append-cxxflags -fno-stack-protector |
283 |
elif [[ $(gcc-major-version) -gt 4 || $(gcc-minor-version) -gt 3 ]]; then |
284 |
if use amd64 || use x86; then |
285 |
append-flags -mno-avx |
286 |
fi |
287 |
fi |
288 |
} |
289 |
|
290 |
src_compile() { |
291 |
if use pgo; then |
292 |
addpredict /root |
293 |
addpredict /etc/gconf |
294 |
# Reset and cleanup environment variables used by GNOME/XDG |
295 |
gnome2_environment_reset |
296 |
|
297 |
# Firefox tries to use dri stuff when it's run, see bug 380283 |
298 |
shopt -s nullglob |
299 |
cards=$(echo -n /dev/dri/card* | sed 's/ /:/g') |
300 |
if test -z "${cards}"; then |
301 |
cards=$(echo -n /dev/ati/card* /dev/nvidiactl* | sed 's/ /:/g') |
302 |
if test -n "${cards}"; then |
303 |
# Binary drivers seem to cause access violations anyway, so |
304 |
# let's use indirect rendering so that the device files aren't |
305 |
# touched at all. See bug 394715. |
306 |
export LIBGL_ALWAYS_INDIRECT=1 |
307 |
fi |
308 |
fi |
309 |
shopt -u nullglob |
310 |
addpredict "${cards}" |
311 |
|
312 |
CC="$(tc-getCC)" CXX="$(tc-getCXX)" LD="$(tc-getLD)" \ |
313 |
MOZ_MAKE_FLAGS="${MAKEOPTS}" SHELL="${SHELL}" \ |
314 |
Xemake -f client.mk profiledbuild || die "Xemake failed" |
315 |
else |
316 |
CC="$(tc-getCC)" CXX="$(tc-getCXX)" LD="$(tc-getLD)" \ |
317 |
MOZ_MAKE_FLAGS="${MAKEOPTS}" SHELL="${SHELL}" \ |
318 |
emake -f client.mk |
319 |
fi |
320 |
|
321 |
} |
322 |
|
323 |
src_install() { |
324 |
MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}" |
325 |
DICTPATH="\"${EPREFIX}/usr/share/myspell\"" |
326 |
|
327 |
cd "${BUILD_OBJ_DIR}" || die |
328 |
|
329 |
# Pax mark xpcshell for hardened support, only used for startupcache creation. |
330 |
pax-mark m "${BUILD_OBJ_DIR}"/dist/bin/xpcshell |
331 |
|
332 |
# Add our default prefs for firefox |
333 |
cp "${FILESDIR}"/gentoo-default-prefs.js-1 \ |
334 |
"${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" \ |
335 |
|| die |
336 |
|
337 |
# Set default path to search for dictionaries. |
338 |
echo "pref(\"spellchecker.dictionary_path\", ${DICTPATH});" \ |
339 |
>> "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" \ |
340 |
|| die |
341 |
|
342 |
echo "pref(\"extensions.autoDisableScopes\", 3);" >> \ |
343 |
"${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" \ |
344 |
|| die |
345 |
|
346 |
local plugin |
347 |
use gmp-autoupdate || for plugin in \ |
348 |
gmp-gmpopenh264 ; do |
349 |
echo "pref(\"media.${plugin}.autoupdate\", false);" >> \ |
350 |
"${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" \ |
351 |
|| die |
352 |
done |
353 |
|
354 |
MOZ_MAKE_FLAGS="${MAKEOPTS}" \ |
355 |
emake DESTDIR="${D}" install |
356 |
|
357 |
# Install language packs |
358 |
mozlinguas_src_install |
359 |
|
360 |
local size sizes icon_path icon name |
361 |
if use bindist; then |
362 |
sizes="16 32 48" |
363 |
icon_path="${S}/browser/branding/aurora" |
364 |
# Firefox's new rapid release cycle means no more codenames |
365 |
# Let's just stick with this one... |
366 |
icon="aurora" |
367 |
name="Aurora" |
368 |
else |
369 |
sizes="16 22 24 32 256" |
370 |
icon_path="${S}/browser/branding/official" |
371 |
icon="${PN}" |
372 |
name="Mozilla Firefox" |
373 |
fi |
374 |
|
375 |
# Install icons and .desktop for menu entry |
376 |
for size in ${sizes}; do |
377 |
insinto "/usr/share/icons/hicolor/${size}x${size}/apps" |
378 |
newins "${icon_path}/default${size}.png" "${icon}.png" |
379 |
done |
380 |
# The 128x128 icon has a different name |
381 |
insinto "/usr/share/icons/hicolor/128x128/apps" |
382 |
newins "${icon_path}/mozicon128.png" "${icon}.png" |
383 |
# Install a 48x48 icon into /usr/share/pixmaps for legacy DEs |
384 |
newicon "${icon_path}/content/icon48.png" "${icon}.png" |
385 |
newmenu "${FILESDIR}/icon/${PN}.desktop" "${PN}.desktop" |
386 |
sed -i -e "s:@NAME@:${name}:" -e "s:@ICON@:${icon}:" \ |
387 |
"${ED}/usr/share/applications/${PN}.desktop" || die |
388 |
|
389 |
# Add StartupNotify=true bug 237317 |
390 |
if use startup-notification ; then |
391 |
echo "StartupNotify=true"\ |
392 |
>> "${ED}/usr/share/applications/${PN}.desktop" \ |
393 |
|| die |
394 |
fi |
395 |
|
396 |
# Required in order to use plugins and even run firefox on hardened. |
397 |
pax-mark m "${ED}"${MOZILLA_FIVE_HOME}/{firefox,firefox-bin,plugin-container} |
398 |
|
399 |
if use minimal; then |
400 |
rm -r "${ED}"/usr/include "${ED}${MOZILLA_FIVE_HOME}"/{idl,include,lib,sdk} \ |
401 |
|| die "Failed to remove sdk and headers" |
402 |
fi |
403 |
|
404 |
# very ugly hack to make firefox not sigbus on sparc |
405 |
# FIXME: is this still needed?? |
406 |
use sparc && { sed -e 's/Firefox/FirefoxGentoo/g' \ |
407 |
-i "${ED}/${MOZILLA_FIVE_HOME}/application.ini" \ |
408 |
|| die "sparc sed failed"; } |
409 |
|
410 |
# revdep-rebuild entry |
411 |
insinto /etc/revdep-rebuild |
412 |
echo "SEARCH_DIRS_MASK=${MOZILLA_FIVE_HOME}" >> ${T}/10firefox |
413 |
doins "${T}"/10${PN} || die |
414 |
} |
415 |
|
416 |
pkg_preinst() { |
417 |
gnome2_icon_savelist |
418 |
} |
419 |
|
420 |
pkg_postinst() { |
421 |
# Update mimedb for the new .desktop file |
422 |
fdo-mime_desktop_database_update |
423 |
gnome2_icon_cache_update |
424 |
} |
425 |
|
426 |
pkg_postrm() { |
427 |
gnome2_icon_cache_update |
428 |
} |