Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | SUMMARY = "SpiderMonkey is Mozilla's JavaScript engine written in C/C++" |
| 2 | HOMEPAGE = "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey" |
| 3 | LICENSE = "MPL-2.0" |
| 4 | LIC_FILES_CHKSUM = "file://LICENSE;md5=dc9b6ecd19a14a54a628edaaf23733bf" |
| 5 | |
| 6 | SRC_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 Geissler | 97771a3 | 2021-03-05 15:23:11 -0600 | [diff] [blame] | 21 | file://0014-remove-JS_VOLATIME_ARM.patch \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 22 | " |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 23 | SRC_URI:append:libc-musl = " \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 24 | file://musl/0001-support-musl.patch \ |
| 25 | file://musl/0002-js-Fix-build-with-musl.patch \ |
| 26 | " |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 27 | SRC_URI:append:mipsarchn32 = " \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 28 | file://mipsarchn32/0001-fix-compiling-failure-on-mips64-n32-bsp.patch \ |
| 29 | " |
| 30 | SRC_URI[md5sum] = "69a0be9ce695e5dc4941ed0c78ef00c2" |
| 31 | SRC_URI[sha256sum] = "9f453c8cc5669e46e38f977764d49a36295bf0d023619d9aac782e6bb3e8c53f" |
| 32 | |
| 33 | S = "${WORKDIR}/firefox-${@d.getVar("PV").replace("esr", "")}" |
| 34 | |
| 35 | inherit autotools pkgconfig perlnative python3native |
| 36 | |
| 37 | inherit features_check |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 38 | CONFLICT_DISTRO_FEATURES:mipsarchn32 = "ld-is-gold" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 39 | |
| 40 | DEPENDS += " \ |
| 41 | nspr zlib autoconf-2.13-native \ |
| 42 | python3-six-native python3-pytoml-native \ |
| 43 | python3-jsmin-native python3-six \ |
| 44 | " |
| 45 | |
| 46 | # Disable null pointer optimization in gcc >= 6 |
| 47 | # https://bugzilla.redhat.com/show_bug.cgi?id=1328045 |
| 48 | CFLAGS += "-fno-tree-vrp -fno-strict-aliasing -fno-delete-null-pointer-checks" |
| 49 | CXXFLAGS += "-fno-tree-vrp -fno-strict-aliasing -fno-delete-null-pointer-checks" |
| 50 | |
| 51 | # nspr's package-config is ignored so set libs manually |
| 52 | EXTRA_OECONF = " \ |
| 53 | --target=${TARGET_SYS} \ |
| 54 | --host=${BUILD_SYS} \ |
| 55 | --prefix=${prefix} \ |
| 56 | --libdir=${libdir} \ |
| 57 | --disable-tests --disable-strip --disable-optimize \ |
| 58 | --disable-jemalloc \ |
| 59 | --with-nspr-cflags='-I${STAGING_INCDIR}/nspr -I${STAGING_INCDIR}/nss3' \ |
| 60 | --with-nspr-libs='-lplds4 -lplc4 -lnspr4' \ |
| 61 | ${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', "--enable-gold", '--disable-gold', d)} \ |
| 62 | " |
| 63 | |
| 64 | # Without this, JS_Init() will fail for mips64. |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 65 | EXTRA_OECONF:append:mipsarch = " --with-intl-api=build" |
| 66 | EXTRA_OECONF:append:powerpc = " --with-intl-api=build" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 67 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 68 | EXTRA_OECONF:append:mipsarch = " --disable-ion" |
| 69 | EXTRA_OECONF:append:riscv64 = " --disable-ion" |
| 70 | EXTRA_OECONF:append:riscv32 = " --disable-ion" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 71 | |
| 72 | PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}" |
| 73 | PACKAGECONFIG[x11] = "--x-includes=${STAGING_INCDIR} --x-libraries=${STAGING_LIBDIR},--x-includes=no --x-libraries=no,virtual/libx11" |
| 74 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 75 | EXTRA_OEMAKE:task-compile += "BUILD_OPT=1 OS_LDFLAGS='-Wl,-latomic ${LDFLAGS}'" |
| 76 | EXTRA_OEMAKE:task-install += "STATIC_LIBRARY_NAME=js_static" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 77 | |
| 78 | export HOST_CC = "${BUILD_CC}" |
| 79 | export HOST_CXX = "${BUILD_CXX}" |
| 80 | export HOST_CFLAGS = "${BUILD_CFLAGS}" |
| 81 | export HOST_CPPFLAGS = "${BUILD_CPPFLAGS}" |
| 82 | export HOST_CXXFLAGS = "${BUILD_CXXFLAGS}" |
| 83 | |
| 84 | do_configure() { |
| 85 | export SHELL="/bin/sh" |
| 86 | cd ${S} |
| 87 | # Add mozjs python-modules necessary |
| 88 | PYTHONPATH="${S}/third_party/python/which:${S}/config:${S}/build" |
| 89 | for sub_dir in python testing/mozbase; do |
| 90 | for module_dir in `ls $sub_dir -1`;do |
| 91 | [ $module_dir = "virtualenv" ] && continue |
| 92 | if [ -d "${S}/$sub_dir/$module_dir" ];then |
| 93 | PYTHONPATH="$PYTHONPATH:${S}/$sub_dir/$module_dir" |
| 94 | fi |
| 95 | done |
| 96 | done |
| 97 | echo "$PYTHONPATH" > ${B}/PYTHONPATH |
| 98 | export PYTHONPATH=`cat ${B}/PYTHONPATH` |
| 99 | |
| 100 | cd ${S}/js/src |
| 101 | autoconf213 --macrodir=${STAGING_DATADIR_NATIVE}/autoconf213 old-configure.in > old-configure |
| 102 | |
| 103 | cd ${B} |
Andrew Geissler | bffdb3e | 2020-08-21 16:13:29 -0500 | [diff] [blame] | 104 | # use of /tmp can causes problems on heavily loaded hosts |
| 105 | mkdir -p "${B}/lcl_tmp" |
| 106 | TMPDIR="${B}/lcl_tmp" ${S}/js/src/configure ${EXTRA_OECONF} |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 107 | |
| 108 | # Make standard Makefile checks pass |
| 109 | touch ${S}/js/src/configure |
| 110 | touch ${B}/config.status |
| 111 | } |
| 112 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 113 | do_compile:prepend() { |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 114 | export SHELL="/bin/sh" |
| 115 | export PYTHONPATH=`cat ${B}/PYTHONPATH` |
| 116 | } |
| 117 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 118 | do_install:prepend() { |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 119 | export SHELL="/bin/sh" |
| 120 | export PYTHONPATH=`cat ${B}/PYTHONPATH` |
| 121 | } |
| 122 | |
Andrew Geissler | bffdb3e | 2020-08-21 16:13:29 -0500 | [diff] [blame] | 123 | inherit multilib_script multilib_header |
| 124 | |
| 125 | MULTILIB_SCRIPTS += " ${PN}-dev:${bindir}/js60-config" |
| 126 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 127 | do_install:append() { |
Andrew Geissler | bffdb3e | 2020-08-21 16:13:29 -0500 | [diff] [blame] | 128 | oe_multilib_header mozjs-60/js-config.h |
Andrew Geissler | ac970dd | 2021-02-12 15:32:45 -0600 | [diff] [blame] | 129 | sed -e 's@${STAGING_DIR_HOST}@@g' \ |
| 130 | -i ${D}${bindir}/js60-config |
Andrew Geissler | bffdb3e | 2020-08-21 16:13:29 -0500 | [diff] [blame] | 131 | } |
| 132 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 133 | PACKAGES =+ "lib${BPN}" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 134 | FILES:lib${BPN} += "${libdir}/lib*.so" |
| 135 | FILES:${PN}-dev += "${bindir}/js60-config" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 136 | |
| 137 | # Fails to build with thumb-1 (qemuarm) |
| 138 | #| {standard input}: Assembler messages: |
| 139 | #| {standard input}:2172: Error: shifts in CMP/MOV instructions are only supported in unified syntax -- `mov r2,r1,LSR#20' |
| 140 | #| {standard input}:2173: Error: unshifted register required -- `bic r2,r2,#(1<<11)' |
| 141 | #| {standard input}:2174: Error: unshifted register required -- `orr r1,r1,#(1<<20)' |
| 142 | #| {standard input}:2176: Error: instruction not supported in Thumb16 mode -- `subs r2,r2,#0x300' |
| 143 | #| {standard input}:2178: Error: instruction not supported in Thumb16 mode -- `subs r5,r2,#52' |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 144 | ARM_INSTRUCTION_SET:armv5 = "arm" |
| 145 | ARM_INSTRUCTION_SET:armv4 = "arm" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 146 | |
| 147 | DISABLE_STATIC = "" |