blob: 33142d6fe5b65f96643c729134a11095fa08769e [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 Bishop26bdd442019-08-16 17:08:17 -040020 file://fallback-to-2011-C++-standard.patch \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080021 "
22SRC_URI_append_libc-musl = " \
23 file://0006-support-musl.patch \
Brad Bishop15ae2502019-06-18 21:44:24 -040024 file://0001-js-Fix-build-with-musl.patch \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080025 "
26SRC_URI_append_mipsarchn32 = " \
27 file://0001-fix-compiling-failure-on-mips64-n32-bsp.patch \
28 "
Brad Bishop15ae2502019-06-18 21:44:24 -040029SRC_URI[md5sum] = "023ed014e9e93d01620d121bc06a3589"
30SRC_URI[sha256sum] = "f51039c997415fd0f13f8e01966b4a8ff80cbf90deb8b14c18827104a369cc0d"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080031
32inherit autotools pkgconfig perlnative pythonnative
33
34inherit distro_features_check
35CONFLICT_DISTRO_FEATURES_mipsarchn32 = "ld-is-gold"
36
Brad Bishop15ae2502019-06-18 21:44:24 -040037DEPENDS += "nspr zlib python-six-native python-pytoml-native \
38 python-jsmin-native python-futures-native \
39 python-which-native"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080040
41# Disable null pointer optimization in gcc >= 6
42# https://bugzilla.redhat.com/show_bug.cgi?id=1328045
43CFLAGS += "-fno-tree-vrp -fno-strict-aliasing -fno-delete-null-pointer-checks"
44CXXFLAGS += "-fno-tree-vrp -fno-strict-aliasing -fno-delete-null-pointer-checks"
45
46# nspr's package-config is ignored so set libs manually
47EXTRA_OECONF = " \
48 --target=${TARGET_SYS} \
49 --host=${BUILD_SYS} \
50 --prefix=${prefix} \
51 --libdir=${libdir} \
Brad Bishop19323692019-04-05 15:28:33 -040052 --disable-tests --disable-strip --disable-optimize \
Brad Bishop15ae2502019-06-18 21:44:24 -040053 --disable-jemalloc \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080054 --with-nspr-libs='-lplds4 -lplc4 -lnspr4' \
55 ${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', "--enable-gold", '--disable-gold', d)} \
56"
57
Brad Bishop26bdd442019-08-16 17:08:17 -040058# Without this, JS_Init() will fail for mips64.
59EXTRA_OECONF_append_mips64 = " --with-intl-api=build"
60
Brad Bishop15ae2502019-06-18 21:44:24 -040061EXTRA_OECONF_append_mipsarch = " --disable-ion"
62EXTRA_OECONF_append_riscv64 = " --disable-ion"
63EXTRA_OECONF_append_riscv32 = " --disable-ion"
64
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080065PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}"
Andrew Geissler1548c072019-02-22 16:03:50 -060066PACKAGECONFIG[x11] = "--x-includes=${STAGING_INCDIR} --x-libraries=${STAGING_LIBDIR},--x-includes=no --x-libraries=no,virtual/libx11"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080067
Brad Bishop19323692019-04-05 15:28:33 -040068EXTRA_OEMAKE_task-compile += "BUILD_OPT=1 OS_LDFLAGS='-Wl,-latomic ${LDFLAGS}'"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080069EXTRA_OEMAKE_task-install += "STATIC_LIBRARY_NAME=js_static"
70
Brad Bishop19323692019-04-05 15:28:33 -040071export HOST_CC = "${BUILD_CC}"
72export HOST_CXX = "${BUILD_CXX}"
73export HOST_CFLAGS = "${BUILD_CFLAGS}"
74export HOST_CPPFLAGS = "${BUILD_CPPFLAGS}"
75export HOST_CXXFLAGS = "${BUILD_CXXFLAGS}"
76
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080077do_configure() {
78 export SHELL="/bin/sh"
79 export TMP="${B}"
80 ${S}/js/src/configure ${EXTRA_OECONF}
81}
82
83do_compile_prepend() {
84 export SHELL="/bin/sh"
85 export S
86 export PYTHONPATH
87 cd ${S}
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 PYTHONPATH="$PYTHONPATH:${S}/config:${S}/build"
97 cd -
98}
99
100do_install_prepend() {
101 export SHELL="/bin/sh"
102 export S
103 export PYTHONPATH
104 cd ${S}
105 for sub_dir in python testing/mozbase; do
106 for module_dir in `ls $sub_dir -1`;do
107 [ $module_dir = "virtualenv" ] && continue
108 if [ -d "${S}/$sub_dir/$module_dir" ];then
109 PYTHONPATH="$PYTHONPATH:${S}/$sub_dir/$module_dir"
110 fi
111 done
112 done
113 PYTHONPATH="$PYTHONPATH:${S}/config:${S}/build"
114 cd -
115}
116
117PACKAGES =+ "lib${BPN}"
118FILES_lib${BPN} += "${libdir}/lib*.so"
Brad Bishop15ae2502019-06-18 21:44:24 -0400119FILES_${PN}-dev += "${bindir}/js60-config"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800120
121# Fails to build with thumb-1 (qemuarm)
122#| {standard input}: Assembler messages:
123#| {standard input}:2172: Error: shifts in CMP/MOV instructions are only supported in unified syntax -- `mov r2,r1,LSR#20'
124#| {standard input}:2173: Error: unshifted register required -- `bic r2,r2,#(1<<11)'
125#| {standard input}:2174: Error: unshifted register required -- `orr r1,r1,#(1<<20)'
126#| {standard input}:2176: Error: instruction not supported in Thumb16 mode -- `subs r2,r2,#0x300'
127#| {standard input}:2178: Error: instruction not supported in Thumb16 mode -- `subs r5,r2,#52'
128ARM_INSTRUCTION_SET_armv5 = "arm"
129ARM_INSTRUCTION_SET_armv4 = "arm"
130
131DISABLE_STATIC = ""