blob: 130ff13ec1a705ab4ee4dab147b490f612185174 [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001SUMMARY = "SpiderMonkey is Mozilla's JavaScript engine written in C/C++"
2HOMEPAGE = "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey"
3LICENSE = "MPL-2.0"
4LIC_FILES_CHKSUM = "file://LICENSE;md5=dc9b6ecd19a14a54a628edaaf23733bf"
5
6SRC_URI = " \
7 https://archive.mozilla.org/pub/firefox/releases/${PV}esr/source/firefox-${PV}esr.source.tar.xz \
8 file://0001-Port-build-to-python3.patch \
9 file://0002-js.pc.in-do-not-include-RequiredDefines.h-for-depend.patch \
10 file://0003-fix-cross-compilation-on-i586-targets.patch \
11 file://0004-do-not-create-python-environment.patch \
12 file://0005-fix-cannot-find-link.patch \
13 file://0006-workaround-autoconf-2.13-detection-failed.patch \
14 file://0007-fix-do_compile-failed-on-mips.patch \
15 file://0008-add-riscv-support.patch \
16 file://0009-mozjs-fix-coredump-caused-by-getenv.patch \
17 file://0010-format-overflow.patch \
18 file://0011-To-fix-build-error-on-arm32BE.patch \
19 file://0012-JS_PUBLIC_API.patch \
20 file://0013-riscv-Disable-atomic-operations.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050021"
22SRC_URI_append_libc-musl = " \
23 file://musl/0001-support-musl.patch \
24 file://musl/0002-js-Fix-build-with-musl.patch \
25"
26SRC_URI_append_mipsarchn32 = " \
27 file://mipsarchn32/0001-fix-compiling-failure-on-mips64-n32-bsp.patch \
28"
29SRC_URI[md5sum] = "69a0be9ce695e5dc4941ed0c78ef00c2"
30SRC_URI[sha256sum] = "9f453c8cc5669e46e38f977764d49a36295bf0d023619d9aac782e6bb3e8c53f"
31
32S = "${WORKDIR}/firefox-${@d.getVar("PV").replace("esr", "")}"
33
34inherit autotools pkgconfig perlnative python3native
35
36inherit features_check
37CONFLICT_DISTRO_FEATURES_mipsarchn32 = "ld-is-gold"
38
39DEPENDS += " \
40 nspr zlib autoconf-2.13-native \
41 python3-six-native python3-pytoml-native \
42 python3-jsmin-native python3-six \
43"
44
45# Disable null pointer optimization in gcc >= 6
46# https://bugzilla.redhat.com/show_bug.cgi?id=1328045
47CFLAGS += "-fno-tree-vrp -fno-strict-aliasing -fno-delete-null-pointer-checks"
48CXXFLAGS += "-fno-tree-vrp -fno-strict-aliasing -fno-delete-null-pointer-checks"
49
50# nspr's package-config is ignored so set libs manually
51EXTRA_OECONF = " \
52 --target=${TARGET_SYS} \
53 --host=${BUILD_SYS} \
54 --prefix=${prefix} \
55 --libdir=${libdir} \
56 --disable-tests --disable-strip --disable-optimize \
57 --disable-jemalloc \
58 --with-nspr-cflags='-I${STAGING_INCDIR}/nspr -I${STAGING_INCDIR}/nss3' \
59 --with-nspr-libs='-lplds4 -lplc4 -lnspr4' \
60 ${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', "--enable-gold", '--disable-gold', d)} \
61"
62
63# Without this, JS_Init() will fail for mips64.
64EXTRA_OECONF_append_mipsarch = " --with-intl-api=build"
65EXTRA_OECONF_append_powerpc = " --with-intl-api=build"
66
67EXTRA_OECONF_append_mipsarch = " --disable-ion"
68EXTRA_OECONF_append_riscv64 = " --disable-ion"
69EXTRA_OECONF_append_riscv32 = " --disable-ion"
70
71PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}"
72PACKAGECONFIG[x11] = "--x-includes=${STAGING_INCDIR} --x-libraries=${STAGING_LIBDIR},--x-includes=no --x-libraries=no,virtual/libx11"
73
74EXTRA_OEMAKE_task-compile += "BUILD_OPT=1 OS_LDFLAGS='-Wl,-latomic ${LDFLAGS}'"
75EXTRA_OEMAKE_task-install += "STATIC_LIBRARY_NAME=js_static"
76
77export HOST_CC = "${BUILD_CC}"
78export HOST_CXX = "${BUILD_CXX}"
79export HOST_CFLAGS = "${BUILD_CFLAGS}"
80export HOST_CPPFLAGS = "${BUILD_CPPFLAGS}"
81export HOST_CXXFLAGS = "${BUILD_CXXFLAGS}"
82
83do_configure() {
84 export SHELL="/bin/sh"
85 cd ${S}
86 # Add mozjs python-modules necessary
87 PYTHONPATH="${S}/third_party/python/which:${S}/config:${S}/build"
88 for sub_dir in python testing/mozbase; do
89 for module_dir in `ls $sub_dir -1`;do
90 [ $module_dir = "virtualenv" ] && continue
91 if [ -d "${S}/$sub_dir/$module_dir" ];then
92 PYTHONPATH="$PYTHONPATH:${S}/$sub_dir/$module_dir"
93 fi
94 done
95 done
96 echo "$PYTHONPATH" > ${B}/PYTHONPATH
97 export PYTHONPATH=`cat ${B}/PYTHONPATH`
98
99 cd ${S}/js/src
100 autoconf213 --macrodir=${STAGING_DATADIR_NATIVE}/autoconf213 old-configure.in > old-configure
101
102 cd ${B}
Andrew Geisslerbffdb3e2020-08-21 16:13:29 -0500103 # use of /tmp can causes problems on heavily loaded hosts
104 mkdir -p "${B}/lcl_tmp"
105 TMPDIR="${B}/lcl_tmp" ${S}/js/src/configure ${EXTRA_OECONF}
Andrew Geissler82c905d2020-04-13 13:39:40 -0500106
107 # Make standard Makefile checks pass
108 touch ${S}/js/src/configure
109 touch ${B}/config.status
110}
111
112do_compile_prepend() {
113 export SHELL="/bin/sh"
114 export PYTHONPATH=`cat ${B}/PYTHONPATH`
115}
116
117do_install_prepend() {
118 export SHELL="/bin/sh"
119 export PYTHONPATH=`cat ${B}/PYTHONPATH`
120}
121
Andrew Geisslerbffdb3e2020-08-21 16:13:29 -0500122inherit multilib_script multilib_header
123
124MULTILIB_SCRIPTS += " ${PN}-dev:${bindir}/js60-config"
125
126do_install_append() {
127 oe_multilib_header mozjs-60/js-config.h
128}
129
Andrew Geissler82c905d2020-04-13 13:39:40 -0500130PACKAGES =+ "lib${BPN}"
131FILES_lib${BPN} += "${libdir}/lib*.so"
132FILES_${PN}-dev += "${bindir}/js60-config"
133
134# Fails to build with thumb-1 (qemuarm)
135#| {standard input}: Assembler messages:
136#| {standard input}:2172: Error: shifts in CMP/MOV instructions are only supported in unified syntax -- `mov r2,r1,LSR#20'
137#| {standard input}:2173: Error: unshifted register required -- `bic r2,r2,#(1<<11)'
138#| {standard input}:2174: Error: unshifted register required -- `orr r1,r1,#(1<<20)'
139#| {standard input}:2176: Error: instruction not supported in Thumb16 mode -- `subs r2,r2,#0x300'
140#| {standard input}:2178: Error: instruction not supported in Thumb16 mode -- `subs r5,r2,#52'
141ARM_INSTRUCTION_SET_armv5 = "arm"
142ARM_INSTRUCTION_SET_armv4 = "arm"
143
144DISABLE_STATIC = ""