blob: 3700d88c2464dc4779c2bc8675c1e86705eba665 [file] [log] [blame]
Andrew Geissler595f6302022-01-24 19:11:47 +00001SUMMARY = "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-rust.configure-Skip-all-target-manipulations.patch \
9 file://0002-build-do-not-use-autoconf-s-config.sub-to-canonicali.patch \
10 file://0003-Do-not-check-binaries-after-build.patch \
11 file://0004-Cargo.toml-do-not-abort-on-panic.patch \
12 file://0005-Fixup-compatibility-of-mozbuild-with-Python-3.10.patch \
13 file://0006-use-asm-sgidefs.h.patch \
14 file://0007-fix-musl-build.patch \
15 file://0008-riscv.patch \
16 file://0009-riscv-Disable-atomic-operations.patch \
17 file://0010-riscv-Set-march-correctly.patch \
18 file://0011-replace-include-by-code-to-fix-arm-build.patch \
19 file://0012-Add-SharedArrayRawBufferRefs-to-public-API.patch \
20 file://0013-util.configure-fix-one-occasionally-reproduced-confi.patch \
21 file://0014-rewrite-cargo-host-linker-in-python3.patch \
22"
23
24SRC_URI[sha256sum] = "a4438d84d95171a6d4fea9c9f02c2edbf0475a9c614d968ebe2eedc25a672151"
25S = "${WORKDIR}/firefox-${@d.getVar("PV").replace("esr", "")}"
26
27DEPENDS = " \
28 autoconf-2.13-native \
29 icu-native \
30 cargo-native \
31 zlib \
32 python3-six \
33 python3-six-native \
34"
35
36inherit autotools pkgconfig rust python3native siteinfo
37
38JIT ?= ""
39JIT:mipsarch = "--disable-jit"
40
41EXTRA_OECONF = " \
42 --target=${TARGET_SYS} \
43 --host=${BUILD_SYS} \
44 --prefix=${prefix} \
45 --libdir=${libdir} \
46 --x-includes=${STAGING_INCDIR} \
47 --x-libraries=${STAGING_LIBDIR} \
48 --without-system-icu \
49 --disable-tests --disable-strip --disable-optimize \
50 --disable-jemalloc \
51 ${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', "--enable-gold", '--disable-gold', d)} \
52 ${JIT} \
53"
54# Note: Python with mozilla build is a mess: E.g: python-six: to get an error
55# free configure we need:
56# * python3-six-native in DEPENDS
57# * python3-six in DEPENDS
58# * path to python-six shipped by mozilla in PYTHONPATH
59prepare_python_and_rust() {
60 if [ ! -f ${B}/PYTHONPATH ]; then
61 oldpath=`pwd`
62 cd ${S}
63 # Add mozjs python-modules necessary
64 PYTHONPATH="${S}/build:${S}/config"
65 PYTHONPATH="$PYTHONPATH:${S}/third_party/python/distro:${S}/third_party/python/jsmin"
66 PYTHONPATH="$PYTHONPATH:${S}/third_party/python/pytoml:${S}/third_party/python/six"
67 PYTHONPATH="$PYTHONPATH:${S}/third_party/python/pyyaml/lib3:${S}/third_party/python/which"
68 for sub_dir in python testing/mozbase; do
69 for module_dir in `ls $sub_dir -1`;do
70 [ $module_dir = "virtualenv" ] && continue
71 if [ -d "${S}/$sub_dir/$module_dir" ];then
72 PYTHONPATH="$PYTHONPATH:${S}/$sub_dir/$module_dir"
73 fi
74 done
75 done
76 # looks odd but it's huge and we want to see what's in there
77 echo "$PYTHONPATH" > ${B}/PYTHONPATH
78 cd "$oldpath"
79 fi
80
81 export PYTHONPATH=`cat ${B}/PYTHONPATH`
82
83 export RUST_TARGET_PATH="${RUST_TARGET_PATH}"
84 export RUST_TARGET="${TARGET_SYS}"
85 export RUSTFLAGS="${RUSTFLAGS}"
86}
87
88export HOST_CC = "${BUILD_CC}"
89export HOST_CXX = "${BUILD_CXX}"
90export HOST_CFLAGS = "${BUILD_CFLAGS}"
91export HOST_CPPFLAGS = "${BUILD_CPPFLAGS}"
92export HOST_CXXFLAGS = "${BUILD_CXXFLAGS}"
93# otherwise we are asked for yasm...
94export AS = "${CC}"
95
96CPPFLAGS:append:mips:toolchain-clang = " -fpie"
97CPPFLAGS:append:mipsel:toolchain-clang = " -fpie"
98
99do_configure() {
100 prepare_python_and_rust
101
102 cd ${S}/js/src
103 autoconf213 --macrodir=${STAGING_DATADIR_NATIVE}/autoconf213 old-configure.in > old-configure
104
105 cd ${B}
106 # * use of /tmp can causes problems on heavily loaded hosts
107 # * with mozjs-78 we get without:
108 # | Path specified in LOCAL_INCLUDES (..) resolves to the topsrcdir or topobjdir (<tmpdir>/oe-core-glibc/work/cortexa72-mortsgna-linux/mozjs-78/78.15.0-r0/firefox-78.15.0/js/src), which is not allowed
109 mkdir -p "${B}/lcl_tmp"
110 TMPDIR="${B}/lcl_tmp" CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" ${S}/js/src/configure ${EXTRA_OECONF}
111
112 # inspired by what fedora [1] does: for big endian rebuild icu dat
113 # this avoids gjs qemu crash on mips at gir creation
114 # [1] https://src.fedoraproject.org/rpms/mozjs78/blob/rawhide/f/mozjs78.spec
115 if [ ${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', 'little', 'big', d)} = "big" -a ! -e ${S}/config/external/icu/data/icudt67b.dat ]; then
116 echo "Do big endian icu dat-convert..."
117 icupkg -tb ${S}/config/external/icu/data/icudt67l.dat ${S}/config/external/icu/data/icudt67b.dat
118 rm -f ${S}/config/external/icu/data/icudt*l.dat
119 fi
120}
121
122do_compile:prepend() {
123 prepare_python_and_rust
124}
125
126do_install:prepend() {
127 prepare_python_and_rust
128}
129
130do_install:append() {
131 # tidy up installation
132 chmod -x ${D}${libdir}/pkgconfig/*.pc
133 sed -i 's:\x24{includedir}/mozjs-78/js/RequiredDefines.h:js/RequiredDefines.h:g' ${D}${libdir}/pkgconfig/*.pc
134
135 rm -f ${D}${libdir}/libjs_static.ajs
136}
137
138ARM_INSTRUCTION_SET:armv5 = "arm"
139ARM_INSTRUCTION_SET:armv4 = "arm"
140
141DISABLE_STATIC = ""
142
143PACKAGES =+ "lib${BPN}"
144FILES:lib${BPN} += "${libdir}/lib*"