1 |
1 |
# Copyright 1999-2023 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
|
EAPI="7"
|
|
4 |
EAPI="8"
|
5 |
5 |
|
6 |
6 |
# Patch version
|
7 |
|
FIREFOX_PATCHSET="firefox-78esr-patches-19.tar.xz"
|
8 |
|
SPIDERMONKEY_PATCHSET="spidermonkey-78-patches-05.tar.xz"
|
|
7 |
FIREFOX_PATCHSET="firefox-91esr-patches-10j.tar.xz"
|
|
8 |
SPIDERMONKEY_PATCHSET="spidermonkey-91-patches-05j.tar.xz"
|
9 |
9 |
|
10 |
|
LLVM_MAX_SLOT=14
|
|
10 |
LLVM_MAX_SLOT=15
|
11 |
11 |
|
12 |
12 |
PYTHON_COMPAT=( python3_{9..11} )
|
13 |
|
PYTHON_REQ_USE="ssl"
|
|
13 |
PYTHON_REQ_USE="ssl,xml(+)"
|
14 |
14 |
|
15 |
15 |
WANT_AUTOCONF="2.1"
|
16 |
16 |
|
... | ... | |
51 |
51 |
fi
|
52 |
52 |
|
53 |
53 |
PATCH_URIS=(
|
54 |
|
https://dev.gentoo.org/~{whissi,polynomial-c,axs}/mozilla/patchsets/${FIREFOX_PATCHSET}
|
55 |
|
https://dev.gentoo.org/~juippis/mozilla/patchsets/${SPIDERMONKEY_PATCHSET}
|
|
54 |
https://dev.gentoo.org/~{juippis,polynomial-c,whissi}/mozilla/patchsets/${FIREFOX_PATCHSET}
|
|
55 |
https://dev.gentoo.org/~{juippis,polynomial-c,whissi}/mozilla/patchsets/${SPIDERMONKEY_PATCHSET}
|
56 |
56 |
)
|
57 |
57 |
|
58 |
58 |
SRC_URI="${MOZ_SRC_BASE_URI}/source/${MOZ_P}.source.tar.xz -> ${MOZ_P_DISTFILES}.source.tar.xz
|
59 |
59 |
${PATCH_URIS[@]}"
|
60 |
60 |
|
61 |
61 |
DESCRIPTION="SpiderMonkey is Mozilla's JavaScript engine written in C and C++"
|
62 |
|
HOMEPAGE="https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey"
|
|
62 |
HOMEPAGE="https://spidermonkey.dev https://firefox-source-docs.mozilla.org/js/index.html "
|
63 |
63 |
|
64 |
|
KEYWORDS="amd64 arm arm64 ~mips ~ppc ppc64 ~riscv ~sparc x86"
|
|
64 |
KEYWORDS="amd64 arm arm64 ~mips ppc ppc64 ~riscv sparc x86"
|
65 |
65 |
|
66 |
|
SLOT="78"
|
|
66 |
SLOT="91"
|
67 |
67 |
LICENSE="MPL-2.0"
|
68 |
68 |
IUSE="clang cpu_flags_arm_neon debug +jit lto test"
|
69 |
69 |
|
70 |
70 |
RESTRICT="!test? ( test )"
|
71 |
71 |
|
72 |
72 |
BDEPEND="${PYTHON_DEPS}
|
73 |
|
>=virtual/rust-1.41.0
|
74 |
|
virtual/pkgconfig
|
75 |
73 |
|| (
|
76 |
74 |
(
|
77 |
|
sys-devel/llvm:14
|
78 |
|
clang? (
|
79 |
|
sys-devel/clang:14
|
80 |
|
lto? ( =sys-devel/lld-14* )
|
81 |
|
)
|
82 |
|
)
|
83 |
|
(
|
84 |
|
sys-devel/llvm:13
|
|
75 |
sys-devel/llvm:15
|
85 |
76 |
clang? (
|
86 |
|
sys-devel/clang:13
|
87 |
|
lto? ( =sys-devel/lld-13* )
|
|
77 |
sys-devel/clang:15
|
|
78 |
virtual/rust:0/llvm-15
|
|
79 |
lto? ( sys-devel/lld:15 )
|
88 |
80 |
)
|
89 |
81 |
)
|
90 |
82 |
(
|
91 |
|
sys-devel/llvm:12
|
|
83 |
sys-devel/llvm:14
|
92 |
84 |
clang? (
|
93 |
|
sys-devel/clang:12
|
94 |
|
lto? ( =sys-devel/lld-12* )
|
|
85 |
sys-devel/clang:14
|
|
86 |
virtual/rust:0/llvm-14
|
|
87 |
lto? ( sys-devel/lld:14 )
|
95 |
88 |
)
|
96 |
89 |
)
|
97 |
90 |
)
|
98 |
|
lto? (
|
99 |
|
!clang? ( sys-devel/binutils[gold] )
|
100 |
|
)"
|
101 |
|
|
102 |
|
CDEPEND=">=dev-libs/icu-67.1:=
|
103 |
|
>=dev-libs/nspr-4.25
|
104 |
|
sys-libs/readline:0=
|
105 |
|
>=sys-libs/zlib-1.2.3"
|
106 |
|
|
107 |
|
DEPEND="${CDEPEND}
|
|
91 |
!clang? ( virtual/rust )
|
|
92 |
virtual/pkgconfig
|
108 |
93 |
test? (
|
109 |
94 |
$(python_gen_any_dep 'dev-python/six[${PYTHON_USEDEP}]')
|
110 |
95 |
)"
|
111 |
|
|
112 |
|
RDEPEND="${CDEPEND}"
|
|
96 |
DEPEND=">=dev-libs/icu-69.1:=
|
|
97 |
dev-libs/nspr
|
|
98 |
sys-libs/readline:0=
|
|
99 |
sys-libs/zlib"
|
|
100 |
RDEPEND="${DEPEND}"
|
113 |
101 |
|
114 |
102 |
S="${WORKDIR}/firefox-${MY_PV}/js/src"
|
115 |
103 |
|
... | ... | |
125 |
113 |
return 1
|
126 |
114 |
fi
|
127 |
115 |
|
|
116 |
if ! has_version -b "virtual/rust:0/llvm-${LLVM_SLOT}" ; then
|
|
117 |
einfo "virtual/rust:0/llvm-${LLVM_SLOT} is missing! Cannot use LLVM slot ${LLVM_SLOT} ..." >&2
|
|
118 |
return 1
|
|
119 |
fi
|
|
120 |
|
128 |
121 |
if use lto ; then
|
129 |
122 |
if ! has_version -b "sys-devel/lld:${LLVM_SLOT}" ; then
|
130 |
123 |
einfo "sys-devel/lld:${LLVM_SLOT} is missing! Cannot use LLVM slot ${LLVM_SLOT} ..." >&2
|
... | ... | |
138 |
131 |
|
139 |
132 |
python_check_deps() {
|
140 |
133 |
if use test ; then
|
141 |
|
has_version "dev-python/six[${PYTHON_USEDEP}]"
|
|
134 |
python_has_version "dev-python/six[${PYTHON_USEDEP}]"
|
142 |
135 |
fi
|
143 |
136 |
}
|
144 |
137 |
|
... | ... | |
169 |
162 |
[[ -n ${version_lld} ]] && version_lld=$(ver_cut 1 "${version_lld}")
|
170 |
163 |
[[ -z ${version_lld} ]] && die "Failed to read ld.lld version!"
|
171 |
164 |
|
172 |
|
# temp fix for https://bugs.gentoo.org/768543
|
173 |
|
# we can assume that rust 1.{49,50}.0 always uses llvm 11
|
174 |
|
local version_rust=$(rustc -Vv 2>/dev/null | grep -F -- 'release:' | awk '{ print $2 }')
|
175 |
|
[[ -n ${version_rust} ]] && version_rust=$(ver_cut 1-2 "${version_rust}")
|
176 |
|
[[ -z ${version_rust} ]] && die "Failed to read version from rustc!"
|
177 |
|
|
178 |
|
if ver_test "${version_rust}" -ge "1.49" && ver_test "${version_rust}" -le "1.50" ; then
|
179 |
|
local version_llvm_rust="11"
|
180 |
|
else
|
181 |
|
local version_llvm_rust=$(rustc -Vv 2>/dev/null | grep -F -- 'LLVM version:' | awk '{ print $3 }')
|
182 |
|
[[ -n ${version_llvm_rust} ]] && version_llvm_rust=$(ver_cut 1 "${version_llvm_rust}")
|
183 |
|
[[ -z ${version_llvm_rust} ]] && die "Failed to read used LLVM version from rustc!"
|
184 |
|
fi
|
|
165 |
local version_llvm_rust=$(rustc -Vv 2>/dev/null | grep -F -- 'LLVM version:' | awk '{ print $3 }')
|
|
166 |
[[ -n ${version_llvm_rust} ]] && version_llvm_rust=$(ver_cut 1 "${version_llvm_rust}")
|
|
167 |
[[ -z ${version_llvm_rust} ]] && die "Failed to read used LLVM version from rustc!"
|
185 |
168 |
|
186 |
169 |
if ver_test "${version_lld}" -ne "${version_llvm_rust}" ; then
|
187 |
170 |
eerror "Rust is using LLVM version ${version_llvm_rust} but ld.lld version belongs to LLVM version ${version_lld}."
|
... | ... | |
189 |
172 |
eerror " - Manually switch rust version using 'eselect rust' to match used LLVM version"
|
190 |
173 |
eerror " - Switch to dev-lang/rust[system-llvm] which will guarantee matching version"
|
191 |
174 |
eerror " - Build ${CATEGORY}/${PN} without USE=lto"
|
|
175 |
eerror " - Rebuild lld with llvm that was used to build rust (may need to rebuild the whole "
|
|
176 |
eerror " llvm/clang/lld/rust chain depending on your @world updates)"
|
192 |
177 |
die "LLVM version used by Rust (${version_llvm_rust}) does not match with ld.lld version (${version_lld})!"
|
193 |
178 |
fi
|
194 |
179 |
fi
|
... | ... | |
219 |
204 |
|
220 |
205 |
default
|
221 |
206 |
|
222 |
|
# Make LTO respect MAKEOPTS
|
223 |
|
sed -i \
|
224 |
|
-e "s/multiprocessing.cpu_count()/$(makeopts_jobs)/" \
|
225 |
|
build/moz.configure/lto-pgo.configure \
|
226 |
|
|| die "sed failed to set num_cores"
|
|
207 |
# Make cargo respect MAKEOPTS
|
|
208 |
export CARGO_BUILD_JOBS="$(makeopts_jobs)"
|
227 |
209 |
|
228 |
210 |
# sed-in toolchain prefix
|
229 |
211 |
sed -i \
|
... | ... | |
293 |
275 |
local -a myeconfargs=(
|
294 |
276 |
--host="${CBUILD:-${CHOST}}"
|
295 |
277 |
--target="${CHOST}"
|
|
278 |
--disable-ctype
|
296 |
279 |
--disable-jemalloc
|
297 |
280 |
--disable-optimize
|
|
281 |
--disable-smoosh
|
298 |
282 |
--disable-strip
|
299 |
283 |
--enable-readline
|
|
284 |
--enable-release
|
300 |
285 |
--enable-shared-js
|
301 |
286 |
--with-intl-api
|
302 |
287 |
--with-system-icu
|
... | ... | |
308 |
293 |
$(use_enable test tests)
|
309 |
294 |
)
|
310 |
295 |
|
311 |
|
# Breaks with newer (1.63+) Rust.
|
|
296 |
# Temporary fix with rust-1.63, bgo#870193
|
312 |
297 |
# if ! use x86 && [[ ${CHOST} != armv*h* ]] ; then
|
313 |
298 |
# myeconfargs+=( --enable-rust-simd )
|
314 |
|
#fi
|
|
299 |
# fi
|
315 |
300 |
myeconfargs+=( --disable-rust-simd )
|
316 |
301 |
|
317 |
302 |
# Modifications to better support ARM, bug 717344
|
... | ... | |
327 |
312 |
|
328 |
313 |
# Tell build system that we want to use LTO
|
329 |
314 |
if use lto ; then
|
330 |
|
myeconfargs+=( --enable-lto )
|
331 |
|
|
332 |
315 |
if use clang ; then
|
333 |
316 |
myeconfargs+=( --enable-linker=lld )
|
|
317 |
myeconfargs+=( --enable-lto=cross )
|
334 |
318 |
else
|
335 |
|
myeconfargs+=( --enable-linker=gold )
|
|
319 |
myeconfargs+=( --enable-linker=bfd )
|
|
320 |
myeconfargs+=( --enable-lto )
|
336 |
321 |
fi
|
337 |
322 |
fi
|
338 |
323 |
|
... | ... | |
346 |
331 |
fi
|
347 |
332 |
fi
|
348 |
333 |
|
|
334 |
export MACH_USE_SYSTEM_PYTHON=1
|
|
335 |
export PIP_NO_CACHE_DIR=off
|
|
336 |
|
349 |
337 |
# Show flags we will use
|
350 |
338 |
einfo "Build CFLAGS: ${CFLAGS}"
|
351 |
339 |
einfo "Build CXXFLAGS: ${CXXFLAGS}"
|
... | ... | |
372 |
360 |
die "Smoke-test failed: did interpreter initialization fail?"
|
373 |
361 |
fi
|
374 |
362 |
|
375 |
|
local -a KNOWN_TESTFAILURES
|
376 |
|
KNOWN_TESTFAILURES+=( non262/Date/reset-time-zone-cache-same-offset.js )
|
377 |
|
KNOWN_TESTFAILURES+=( non262/Date/time-zone-path.js )
|
378 |
|
KNOWN_TESTFAILURES+=( non262/Date/time-zones-historic.js )
|
379 |
|
KNOWN_TESTFAILURES+=( non262/Date/time-zones-imported.js )
|
380 |
|
KNOWN_TESTFAILURES+=( non262/Date/toString-localized.js )
|
381 |
|
KNOWN_TESTFAILURES+=( non262/Date/toString-localized-posix.js )
|
382 |
|
KNOWN_TESTFAILURES+=( non262/Intl/Date/toLocaleString_timeZone.js )
|
383 |
|
KNOWN_TESTFAILURES+=( non262/Intl/Date/toLocaleDateString_timeZone.js )
|
384 |
|
KNOWN_TESTFAILURES+=( non262/Intl/DateTimeFormat/format.js )
|
385 |
|
KNOWN_TESTFAILURES+=( non262/Intl/DateTimeFormat/format_timeZone.js )
|
386 |
|
KNOWN_TESTFAILURES+=( non262/Intl/DateTimeFormat/timeZone_backward_links.js )
|
387 |
|
KNOWN_TESTFAILURES+=( non262/Intl/DateTimeFormat/tz-environment-variable.js )
|
388 |
|
KNOWN_TESTFAILURES+=( non262/Intl/DisplayNames/language.js )
|
389 |
|
KNOWN_TESTFAILURES+=( non262/Intl/DisplayNames/region.js )
|
390 |
|
KNOWN_TESTFAILURES+=( non262/Intl/Locale/likely-subtags.js )
|
391 |
|
KNOWN_TESTFAILURES+=( non262/Intl/Locale/likely-subtags-generated.js )
|
392 |
|
KNOWN_TESTFAILURES+=( test262/intl402/Locale/prototype/minimize/removing-likely-subtags-first-adds-likely-subtags.js )
|
|
363 |
cp "${FILESDIR}"/spidermonkey-91-known-test-failures.txt "${T}"/known_failures.list || die
|
|
364 |
|
|
365 |
# bgo #827960
|
|
366 |
if use ppc; then
|
|
367 |
echo "non262/TypedArray/map-and-filter.js" >> "${T}"/known_failures.list
|
|
368 |
echo "test262/built-ins/Atomics/load/bigint/good-views.js" >> "${T}"/known_failures.list
|
|
369 |
echo "test262/built-ins/Atomics/load/bigint/non-shared-bufferdata.js" >> "${T}"/known_failures.list
|
|
370 |
echo "test262/built-ins/Atomics/add/bigint/good-views.js" >> "${T}"/known_failures.list
|
|
371 |
echo "test262/built-ins/Atomics/add/bigint/non-shared-bufferdata.js" >> "${T}"/known_failures.list
|
|
372 |
echo "test262/built-ins/Atomics/exchange/bigint/good-views.js" >> "${T}"/known_failures.list
|
|
373 |
echo "test262/built-ins/Atomics/exchange/bigint/non-shared-bufferdata.js" >> "${T}"/known_failures.list
|
|
374 |
echo "test262/built-ins/Atomics/store/bigint/good-views.js" >> "${T}"/known_failures.list
|
|
375 |
echo "test262/built-ins/Atomics/store/bigint/non-shared-bufferdata.js" >> "${T}"/known_failures.list
|
|
376 |
echo "test262/built-ins/Atomics/xor/bigint/good-views.js" >> "${T}"/known_failures.list
|
|
377 |
echo "test262/built-ins/Atomics/xor/bigint/non-shared-bufferdata.js" >> "${T}"/known_failures.list
|
|
378 |
echo "test262/built-ins/Atomics/sub/bigint/good-views.js" >> "${T}"/known_failures.list
|
|
379 |
echo "test262/built-ins/Atomics/sub/bigint/non-shared-bufferdata.js" >> "${T}"/known_failures.list
|
|
380 |
echo "test262/built-ins/Atomics/wait/bigint/no-spurious-wakeup-on-exchange.js" >> "${T}"/known_failures.list
|
|
381 |
echo "test262/built-ins/Atomics/and/bigint/good-views.js" >> "${T}"/known_failures.list
|
|
382 |
echo "test262/built-ins/Atomics/wait/bigint/no-spurious-wakeup-on-or.js" >> "${T}"/known_failures.list
|
|
383 |
echo "test262/built-ins/Atomics/wait/bigint/false-for-timeout-agent.js" >> "${T}"/known_failures.list
|
|
384 |
echo "test262/built-ins/Atomics/wait/bigint/no-spurious-wakeup-on-add.js" >> "${T}"/known_failures.list
|
|
385 |
echo "test262/built-ins/Atomics/or/bigint/non-shared-bufferdata.js" >> "${T}"/known_failures.list
|
|
386 |
echo "test262/built-ins/Atomics/wait/bigint/no-spurious-wakeup-on-sub.js" >> "${T}"/known_failures.list
|
|
387 |
echo "test262/built-ins/Atomics/wait/bigint/no-spurious-wakeup-on-compareExchange.js" >> "${T}"/known_failures.list
|
|
388 |
echo "test262/built-ins/Atomics/wait/bigint/negative-timeout-agent.js" >> "${T}"/known_failures.list
|
|
389 |
echo "test262/built-ins/Atomics/wait/bigint/no-spurious-wakeup-on-xor.js" >> "${T}"/known_failures.list
|
|
390 |
echo "test262/built-ins/Atomics/wait/bigint/value-not-equal.js" >> "${T}"/known_failures.list
|
|
391 |
echo "test262/built-ins/Atomics/wait/bigint/no-spurious-wakeup-no-operation.js" >> "${T}"/known_failures.list
|
|
392 |
echo "test262/built-ins/Atomics/wait/bigint/waiterlist-block-indexedposition-wake.js" >> "${T}"/known_failures.list
|
|
393 |
echo "test262/built-ins/Atomics/wait/bigint/nan-for-timeout.js" >> "${T}"/known_failures.list
|
|
394 |
echo "test262/built-ins/Atomics/wait/bigint/no-spurious-wakeup-on-and.js" >> "${T}"/known_failures.list
|
|
395 |
echo "test262/built-ins/Atomics/wait/bigint/was-woken-before-timeout.js" >> "${T}"/known_failures.list
|
|
396 |
echo "test262/built-ins/Atomics/wait/bigint/no-spurious-wakeup-on-store.js" >> "${T}"/known_failures.list
|
|
397 |
echo "test262/built-ins/Atomics/wait/bigint/waiterlist-order-of-operations-is-fifo.js" >> "${T}"/known_failures.list
|
|
398 |
echo "test262/built-ins/Atomics/compareExchange/bigint/non-shared-bufferdata.js" >> "${T}"/known_failures.list
|
|
399 |
echo "test262/built-ins/Atomics/compareExchange/bigint/good-views.js" >> "${T}"/known_failures.list
|
|
400 |
echo "test262/built-ins/Atomics/and/bigint/non-shared-bufferdata.js" >> "${T}"/known_failures.list
|
|
401 |
echo "test262/built-ins/Atomics/or/bigint/good-views.js" >> "${T}"/known_failures.list
|
|
402 |
echo "test262/built-ins/Atomics/notify/bigint/notify-all-on-loc.js" >> "${T}"/known_failures.list
|
|
403 |
fi
|
393 |
404 |
|
394 |
405 |
if use x86 ; then
|
395 |
|
KNOWN_TESTFAILURES+=( non262/Date/timeclip.js )
|
396 |
|
KNOWN_TESTFAILURES+=( test262/built-ins/Number/prototype/toPrecision/return-values.js )
|
397 |
|
KNOWN_TESTFAILURES+=( test262/language/types/number/S8.5_A2.1.js )
|
398 |
|
KNOWN_TESTFAILURES+=( test262/language/types/number/S8.5_A2.2.js )
|
|
406 |
echo "non262/Date/timeclip.js" >> "${T}"/known_failures.list
|
|
407 |
echo "test262/built-ins/Number/prototype/toPrecision/return-values.js" >> "${T}"/known_failures.list
|
|
408 |
echo "test262/language/types/number/S8.5_A2.1.js" >> "${T}"/known_failures.list
|
|
409 |
echo "test262/language/types/number/S8.5_A2.2.js" >> "${T}"/known_failures.list
|
399 |
410 |
fi
|
400 |
411 |
|
401 |
412 |
if [[ $(tc-endian) == "big" ]] ; then
|
402 |
|
KNOWN_TESTFAILURES+=( test262/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-other-type.js )
|
|
413 |
echo "non262/extensions/clone-errors.js" >> "${T}"/known_failures.list
|
|
414 |
echo "test262/built-ins/Date/UTC/fp-evaluation-order.js" >> "${T}"/known_failures.list
|
|
415 |
echo "test262/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-other-type.js" >> "${T}"/known_failures.list
|
403 |
416 |
fi
|
404 |
417 |
|
405 |
|
echo "" > "${T}"/known_failures.list || die
|
406 |
|
|
407 |
|
local KNOWN_TESTFAILURE
|
408 |
|
for KNOWN_TESTFAILURE in ${KNOWN_TESTFAILURES[@]} ; do
|
409 |
|
echo "${KNOWN_TESTFAILURE}" >> "${T}"/known_failures.list
|
410 |
|
done
|
411 |
|
|
412 |
|
PYTHONPATH="${S}/tests/lib" \
|
413 |
|
${PYTHON} \
|
|
418 |
${EPYTHON} \
|
414 |
419 |
"${S}"/tests/jstests.py -d -s -t 1800 --wpt=disabled --no-progress \
|
415 |
420 |
--exclude-file="${T}"/known_failures.list \
|
416 |
421 |
"${MOZJS_BUILDDIR}"/js/src/js \
|
417 |
422 |
|| die
|
418 |
423 |
|
419 |
424 |
if use jit ; then
|
420 |
|
KNOWN_TESTFAILURES=()
|
421 |
|
|
422 |
|
echo "" > "${T}"/known_failures.list || die
|
423 |
|
|
424 |
|
for KNOWN_TESTFAILURE in ${KNOWN_TESTFAILURES[@]} ; do
|
425 |
|
echo "${KNOWN_TESTFAILURE}" >> "${T}"/known_failures.list
|
426 |
|
done
|
427 |
|
|
428 |
|
PYTHONPATH="${S}/tests/lib" \
|
429 |
|
${PYTHON} \
|
|
425 |
${EPYTHON} \
|
430 |
426 |
"${S}"/tests/jstests.py -d -s -t 1800 --wpt=disabled --no-progress \
|
431 |
427 |
--exclude-file="${T}"/known_failures.list \
|
432 |
428 |
"${MOZJS_BUILDDIR}"/js/src/js basic \
|