blob: 70bdbc1688e5470bb5e08826d9e0de35a2eb3449 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001SUMMARY = "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"
Brad Bishop15ae2502019-06-18 21:44:24 -04004LIC_FILES_CHKSUM = "file://LICENSE;md5=dc9b6ecd19a14a54a628edaaf23733bf"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08005
Brad Bishop15ae2502019-06-18 21:44:24 -04006SRC_URI = "https://dev.gentoo.org/~axs/distfiles/mozjs-60.5.2.tar.bz2 \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08007 file://0001-js.pc.in-do-not-include-RequiredDefines.h-for-depend.patch \
8 file://0010-fix-cross-compilation-on-i586-targets.patch \
9 file://0001-do-not-create-python-environment.patch \
10 file://0002-fix-cannot-find-link.patch \
11 file://0003-workaround-autoconf-2.13-detection-failed.patch \
12 file://0004-do-not-use-autoconf-2.13-to-refresh-old.configure.patch \
13 file://0005-fix-do_compile-failed-on-mips.patch \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080014 file://add-riscv-support.patch \
15 file://0001-mozjs-fix-coredump-caused-by-getenv.patch \
Brad Bishop19323692019-04-05 15:28:33 -040016 file://format-overflow.patch \
Brad Bishopc342db32019-05-15 21:57:59 -040017 file://0001-To-fix-build-error-on-arm32BE.patch \
Brad Bishop15ae2502019-06-18 21:44:24 -040018 file://JS_PUBLIC_API.patch \
19 file://0001-riscv-Disable-atomic-operations.patch \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080020 "
21SRC_URI_append_libc-musl = " \
22 file://0006-support-musl.patch \
Brad Bishop15ae2502019-06-18 21:44:24 -040023 file://0001-js-Fix-build-with-musl.patch \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080024 "
25SRC_URI_append_mipsarchn32 = " \
26 file://0001-fix-compiling-failure-on-mips64-n32-bsp.patch \
27 "
Brad Bishop15ae2502019-06-18 21:44:24 -040028SRC_URI[md5sum] = "023ed014e9e93d01620d121bc06a3589"
29SRC_URI[sha256sum] = "f51039c997415fd0f13f8e01966b4a8ff80cbf90deb8b14c18827104a369cc0d"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080030
31inherit autotools pkgconfig perlnative pythonnative
32
33inherit distro_features_check
34CONFLICT_DISTRO_FEATURES_mipsarchn32 = "ld-is-gold"
35
Brad Bishop15ae2502019-06-18 21:44:24 -040036DEPENDS += "nspr zlib python-six-native python-pytoml-native \
37 python-jsmin-native python-futures-native \
38 python-which-native"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080039
40# Disable null pointer optimization in gcc >= 6
41# https://bugzilla.redhat.com/show_bug.cgi?id=1328045
42CFLAGS += "-fno-tree-vrp -fno-strict-aliasing -fno-delete-null-pointer-checks"
43CXXFLAGS += "-fno-tree-vrp -fno-strict-aliasing -fno-delete-null-pointer-checks"
44
45# nspr's package-config is ignored so set libs manually
46EXTRA_OECONF = " \
47 --target=${TARGET_SYS} \
48 --host=${BUILD_SYS} \
49 --prefix=${prefix} \
50 --libdir=${libdir} \
Brad Bishop19323692019-04-05 15:28:33 -040051 --disable-tests --disable-strip --disable-optimize \
Brad Bishop15ae2502019-06-18 21:44:24 -040052 --disable-jemalloc \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080053 --with-nspr-libs='-lplds4 -lplc4 -lnspr4' \
54 ${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', "--enable-gold", '--disable-gold', d)} \
55"
56
Brad Bishop15ae2502019-06-18 21:44:24 -040057EXTRA_OECONF_append_mipsarch = " --disable-ion"
58EXTRA_OECONF_append_riscv64 = " --disable-ion"
59EXTRA_OECONF_append_riscv32 = " --disable-ion"
60
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080061PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}"
Andrew Geissler1548c072019-02-22 16:03:50 -060062PACKAGECONFIG[x11] = "--x-includes=${STAGING_INCDIR} --x-libraries=${STAGING_LIBDIR},--x-includes=no --x-libraries=no,virtual/libx11"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080063
Brad Bishop19323692019-04-05 15:28:33 -040064EXTRA_OEMAKE_task-compile += "BUILD_OPT=1 OS_LDFLAGS='-Wl,-latomic ${LDFLAGS}'"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080065EXTRA_OEMAKE_task-install += "STATIC_LIBRARY_NAME=js_static"
66
Brad Bishop19323692019-04-05 15:28:33 -040067export HOST_CC = "${BUILD_CC}"
68export HOST_CXX = "${BUILD_CXX}"
69export HOST_CFLAGS = "${BUILD_CFLAGS}"
70export HOST_CPPFLAGS = "${BUILD_CPPFLAGS}"
71export HOST_CXXFLAGS = "${BUILD_CXXFLAGS}"
72
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080073do_configure() {
74 export SHELL="/bin/sh"
75 export TMP="${B}"
76 ${S}/js/src/configure ${EXTRA_OECONF}
77}
78
79do_compile_prepend() {
80 export SHELL="/bin/sh"
81 export S
82 export PYTHONPATH
83 cd ${S}
84 for sub_dir in python testing/mozbase; do
85 for module_dir in `ls $sub_dir -1`;do
86 [ $module_dir = "virtualenv" ] && continue
87 if [ -d "${S}/$sub_dir/$module_dir" ];then
88 PYTHONPATH="$PYTHONPATH:${S}/$sub_dir/$module_dir"
89 fi
90 done
91 done
92 PYTHONPATH="$PYTHONPATH:${S}/config:${S}/build"
93 cd -
94}
95
96do_install_prepend() {
97 export SHELL="/bin/sh"
98 export S
99 export PYTHONPATH
100 cd ${S}
101 for sub_dir in python testing/mozbase; do
102 for module_dir in `ls $sub_dir -1`;do
103 [ $module_dir = "virtualenv" ] && continue
104 if [ -d "${S}/$sub_dir/$module_dir" ];then
105 PYTHONPATH="$PYTHONPATH:${S}/$sub_dir/$module_dir"
106 fi
107 done
108 done
109 PYTHONPATH="$PYTHONPATH:${S}/config:${S}/build"
110 cd -
111}
112
113PACKAGES =+ "lib${BPN}"
114FILES_lib${BPN} += "${libdir}/lib*.so"
Brad Bishop15ae2502019-06-18 21:44:24 -0400115FILES_${PN}-dev += "${bindir}/js60-config"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800116
117# Fails to build with thumb-1 (qemuarm)
118#| {standard input}: Assembler messages:
119#| {standard input}:2172: Error: shifts in CMP/MOV instructions are only supported in unified syntax -- `mov r2,r1,LSR#20'
120#| {standard input}:2173: Error: unshifted register required -- `bic r2,r2,#(1<<11)'
121#| {standard input}:2174: Error: unshifted register required -- `orr r1,r1,#(1<<20)'
122#| {standard input}:2176: Error: instruction not supported in Thumb16 mode -- `subs r2,r2,#0x300'
123#| {standard input}:2178: Error: instruction not supported in Thumb16 mode -- `subs r5,r2,#52'
124ARM_INSTRUCTION_SET_armv5 = "arm"
125ARM_INSTRUCTION_SET_armv4 = "arm"
126
127DISABLE_STATIC = ""