blob: 85b28744cbed6dfb181646fd0ea3df7142c212b5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
|
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI="7"
PYTHON_COMPAT=( python3_{8..9} )
PYTHON_REQ_USE="ssl"
WANT_AUTOCONF="2.1"
inherit autotools check-reqs python-any-r1 toolchain-funcs
MY_PN="mozjs"
MY_PV="${PV/_pre*}" # Handle Gentoo pre-releases
MY_MAJOR=$(ver_cut 1)
MOZ_ESR="1"
# Convert the ebuild version to the upstream mozilla version
MOZ_PV="${MY_PV/_alpha/a}" # Handle alpha for SRC_URI
MOZ_PV="${MOZ_PV/_beta/b}" # Handle beta for SRC_URI
MOZ_PV="${MOZ_PV%%_rc*}" # Handle rc for SRC_URI
if [[ ${MOZ_ESR} == 1 ]] ; then
# ESR releases have slightly different version numbers
MOZ_PV="${MOZ_PV}esr"
fi
# Patch version
FIREFOX_PATCHSET="firefox-68.0-patches-15"
SPIDERMONKEY_PATCHSET="${PN}-68.6.0-patches-04"
MOZ_HTTP_URI="https://archive.mozilla.org/pub/firefox/releases"
MOZ_SRC_URI="${MOZ_HTTP_URI}/${MOZ_PV}/source/firefox-${MOZ_PV}.source.tar.xz"
if [[ "${PV}" == *_rc* ]]; then
MOZ_HTTP_URI="https://archive.mozilla.org/pub/firefox/candidates/${MOZ_PV}-candidates/build${PV##*_rc}"
MOZ_SRC_URI="${MOZ_HTTP_URI}/source/firefox-${MOZ_PV}.source.tar.xz"
fi
PATCH_URIS=(
https://dev.gentoo.org/~{anarchy,whissi,polynomial-c,axs}/mozilla/patchsets/${FIREFOX_PATCHSET}.tar.xz
https://dev.gentoo.org/~{whissi,polynomial-c,axs}/mozilla/patchsets/${SPIDERMONKEY_PATCHSET}.tar.xz
)
SRC_URI="${MOZ_SRC_URI}
${PATCH_URIS[@]}"
DESCRIPTION="SpiderMonkey is Mozilla's JavaScript engine written in C and C++"
HOMEPAGE="https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey"
# riscv support requires a patch currently only available in firefox-78 patch sets
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~mips ppc ppc64 -riscv ~s390 sparc x86"
SLOT="68"
LICENSE="MPL-2.0"
IUSE="cpu_flags_arm_neon debug +jit test"
RESTRICT="!test? ( test )"
BDEPEND="dev-lang/python:2.7
test? ( ${PYTHON_DEPS} )"
DEPEND=">=dev-libs/icu-63.1:=
>=dev-libs/nspr-4.21
sys-libs/readline:0=
>=sys-libs/zlib-1.2.3"
RDEPEND="${DEPEND}"
S="${WORKDIR}/firefox-${MY_PV}/js/src"
pkg_pretend() {
if use test ; then
CHECKREQS_DISK_BUILD="6G"
else
CHECKREQS_DISK_BUILD="5G"
fi
check-reqs_pkg_pretend
}
pkg_setup() {
if use test ; then
CHECKREQS_DISK_BUILD="6G"
else
CHECKREQS_DISK_BUILD="5G"
fi
check-reqs_pkg_setup
use test && python-any-r1_pkg_setup
}
src_prepare() {
cd ../.. || die
rm "${WORKDIR}"/firefox/2013_avoid_noinline_on_GCC_with_skcms.patch
rm "${WORKDIR}"/firefox/2015_fix_cssparser.patch
rm "${WORKDIR}"/firefox/2016_set_CARGO_PROFILE_RELEASE_LTO.patch
eapply "${WORKDIR}"/firefox
eapply "${WORKDIR}"/spidermonkey-patches
eapply "${FILESDIR}"/spidermonkey-68.0-add-riscv-support.patch
default
# sed-in toolchain prefix
sed -i \
-e "s/objdump/${CHOST}-objdump/" \
python/mozbuild/mozbuild/configure/check_debug_ranges.py \
|| die "sed failed to set toolchain prefix"
MOZJS_BUILDDIR="${WORKDIR}/build"
mkdir "${MOZJS_BUILDDIR}" || die
cd "${S}" || die
eautoconf
}
src_configure() {
tc-export CC CXX LD AR RANLIB
# backup current active Python version
local PYTHON_OLD=${PYTHON}
# build system will require Python2.7
export PYTHON=python2.7
cd "${MOZJS_BUILDDIR}" || die
# ../python/mach/mach/mixin/process.py fails to detect SHELL
export SHELL="${EPREFIX}/bin/bash"
local -a myeconfargs=(
--host="${CBUILD:-${CHOST}}"
--target="${CHOST}"
--disable-jemalloc
--disable-optimize
--disable-strip
--enable-readline
--enable-shared-js
--with-intl-api
--with-system-icu
--with-system-nspr
--with-system-zlib
--with-toolchain-prefix="${CHOST}-"
$(use_enable debug)
$(use_enable jit ion)
$(use_enable test tests)
)
# Modifications to better support ARM, bug 717344
if use cpu_flags_arm_neon ; then
myeconfargs+=( --with-fpu=neon )
if ! tc-is-clang ; then
# thumb options aren't supported when using clang, bug 666966
myeconfargs+=( --with-thumb=yes )
myeconfargs+=( --with-thumb-interwork=no )
fi
fi
# Forcing system-icu allows us to skip patching bundled ICU for PPC
# and other minor arches
ECONF_SOURCE="${S}" \
econf \
${myeconfargs[@]} \
XARGS="${EPREFIX}/usr/bin/xargs"
# restore PYTHON
export PYTHON=${PYTHON_OLD}
}
src_compile() {
cd "${MOZJS_BUILDDIR}" || die
default
}
src_test() {
if "${MOZJS_BUILDDIR}/js/src/js" -e 'print("Hello world!")'; then
einfo "Smoke-test successful, continuing with full test suite"
else
die "Smoke-test failed: did interpreter initialization fail?"
fi
local -a KNOWN_TESTFAILURES
KNOWN_TESTFAILURES+=( test262/built-ins/Atomics/wait/bigint/waiterlist-order-of-operations-is-fifo.js )
KNOWN_TESTFAILURES+=( test262/intl402/RelativeTimeFormat/prototype/format/en-us-numeric-auto.js )
KNOWN_TESTFAILURES+=( non262/Intl/DateTimeFormat/timeZone_backward_links.js )
KNOWN_TESTFAILURES+=( non262/Intl/DateTimeFormat/tz-environment-variable.js )
KNOWN_TESTFAILURES+=( non262/Intl/RelativeTimeFormat/format.js )
KNOWN_TESTFAILURES+=( non262/Date/time-zones-imported.js )
KNOWN_TESTFAILURES+=( non262/Date/toString-localized.js )
KNOWN_TESTFAILURES+=( non262/Date/time-zone-path.js )
KNOWN_TESTFAILURES+=( non262/Date/time-zones-historic.js )
KNOWN_TESTFAILURES+=( non262/Date/toString-localized-posix.js )
KNOWN_TESTFAILURES+=( non262/Date/reset-time-zone-cache-same-offset.js )
if use x86 ; then
KNOWN_TESTFAILURES+=( test262/language/types/number/S8.5_A2.1.js )
KNOWN_TESTFAILURES+=( test262/language/types/number/S8.5_A2.2.js )
KNOWN_TESTFAILURES+=( test262/built-ins/Number/prototype/toPrecision/return-values.js )
KNOWN_TESTFAILURES+=( non262/Date/timeclip.js )
elif use sparc ; then
KNOWN_TESTFAILURES+=( non262/Array/regress-157652.js )
KNOWN_TESTFAILURES+=( non262/Array/regress-330812.js )
KNOWN_TESTFAILURES+=( non262/regress/regress-422348.js )
fi
if [[ $(tc-endian) == "big" ]] ; then
KNOWN_TESTFAILURES+=( test262/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-other-type.js )
fi
echo "" > "${T}"/known_failures.list || die
local KNOWN_TESTFAILURE
for KNOWN_TESTFAILURE in ${KNOWN_TESTFAILURES[@]} ; do
echo "${KNOWN_TESTFAILURE}" >> "${T}"/known_failures.list
done
PYTHONPATH="${S}/tests/lib" \
${PYTHON} \
"${S}"/tests/jstests.py -d -s -t 1800 --wpt=disabled --no-progress \
--exclude-file="${T}"/known_failures.list \
"${MOZJS_BUILDDIR}"/js/src/js \
|| die
if use jit ; then
KNOWN_TESTFAILURES=()
echo "" > "${T}"/known_failures.list || die
for KNOWN_TESTFAILURE in ${KNOWN_TESTFAILURES[@]} ; do
echo "${KNOWN_TESTFAILURE}" >> "${T}"/known_failures.list
done
PYTHONPATH="${S}/tests/lib" \
${PYTHON} \
"${S}"/tests/jstests.py -d -s -t 1800 --wpt=disabled --no-progress \
--exclude-file="${T}"/known_failures.list \
"${MOZJS_BUILDDIR}"/js/src/js basic \
|| die
fi
}
src_install() {
cd "${MOZJS_BUILDDIR}" || die
default
# fix soname links
pushd "${ED}"/usr/$(get_libdir) &>/dev/null || die
mv lib${MY_PN}-${MY_MAJOR}.so lib${MY_PN}-${MY_MAJOR}.so.0.0.0 || die
ln -s lib${MY_PN}-${MY_MAJOR}.so.0.0.0 lib${MY_PN}-${MY_MAJOR}.so.0 || die
ln -s lib${MY_PN}-${MY_MAJOR}.so.0 lib${MY_PN}-${MY_MAJOR}.so || die
popd &>/dev/null || die
# remove unneeded files
rm \
"${ED}"/usr/bin/js${MY_MAJOR}-config \
"${ED}"/usr/$(get_libdir)/libjs_static.ajs \
|| die
# fix permissions
chmod -x \
"${ED}"/usr/$(get_libdir)/pkgconfig/*.pc \
"${ED}"/usr/include/mozjs-${MY_MAJOR}/js-config.h \
|| die
}
|