kumquat-buildroot/package/spidermonkey/spidermonkey.mk

59 lines
1.7 KiB
Makefile
Raw Normal View History

package/spidermonkey: new package Spidermonkey is Mozilla's JavaScript engine written in C and C++. It is used in various Mozilla products, including Firefox, and is available under the MPL2. There are 10 patches currently required to properly cross-compile spidermonkey: 1) allow-newer-autoconf-versions - Spidermonkey is hardcoded to use Autoconf 2.13, which is from 1999! The reasoning behind using 2.13 is because newer versions of Autoconf do not work correctly with the custom m4 macros in the source code. However: Because we are building just the Spidermonkey engine instead of the entire Firefox package, newer versions of Autoconf work without issue. See: See: https://bugzilla.mozilla.org/show_bug.cgi?id=104642 for further explanation. 2) allow-building-in-tree - By default, spidermonkey must be configured and built out-of-tree, otherwise the following error occurs: FATAL ERROR PROCESSING MOZBUILD FILE ============================== The error occurred while processing the following file or one of the files it includes: js/src/shell/moz.build The error occurred when validating the result of the execution. The reported error is: The path specified in LOCAL_INCLUDES is not allowed: .. (resolved to js/src) Remove this check, as spidermonkey builds without issue in-tree. 3) allow-unknown-configuration-options - By default, if an unknown parameter is passed to configure, an error is raised. Replace the raise with a pass and continue. Fixes: https://bugzilla.mozilla.org/show_bug.cgi?id=1379540 4) fix-building-with-musl - The MIPS specific header <sgidefs.h> is not provided by musl. The Linux kernel headers <asm/sgidefs.h> provide the same definitions. 5) add-riscv-support - Submitted upstream: See: https://bugzilla.mozilla.org/show_bug.cgi?id=1318905 6) copy-headers-on-install-instead-of-symlinking - When installing, instead of linking the headers to the source directory, copy them. 7) ensure-proper-running-on-64-bit-and-32-bit-be-platforms - Taken from the Fedora RPM Applied upstream. Fixes: https://bugzilla.mozilla.org/show_bug.cgi?id=1488552 8) 0008-save-and-restore-non-volatile-x28-on-ARM64-for-generated-unboxed-obje - Taken from the Fedora RPM: Applied upstream. Fixes: https://bugzilla.mozilla.org/show_bug.cgi?id=1375074 9) save-x28-before-clobbering-it-in-the-regex-compiler - Taken from the Fedora RPM: Applied upstream. Fixes: https://bugzilla.mozilla.org/show_bug.cgi?id=1445907 10) always-use-the-equivalent-year-to-determine-the-time-zone - Taken from the Fedora RPM: Applied upstream. Fixes: https://bugzilla.mozilla.org/show_bug.cgi?id=1415202 Typically, The Firefox source tarball is used to build spidermonkey; however, this has two disadvantages: - It's large. The Firefox source tarball is over 250M. - It requires Autoconf 2.13 Instead, use a tarball with only the Spidermonkey source code in it with a pre-setup configure file. This tarball reduces the size to 31M and prevents the Autoconf 2.13 requirement. Signed-off-by: Adam Duskett <aduskett@greenlots.com> [Thomas: adjust how the libnspr arch dependency is handled] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-11-25 18:50:28 +01:00
################################################################################
#
# spidermonkey
#
################################################################################
# Use a tarball with only the spidermonkey source code and a pre-setup
# old-configure in src/js.This prevents having to use autoconf 2.13 and
# makes the package much 31M instead of 257M
SPIDERMONKEY_VERSION = 60.5.2
SPIDERMONKEY_SOURCE = mozjs-$(SPIDERMONKEY_VERSION).tar.bz2
SPIDERMONKEY_SITE = https://gentoo.osuosl.org/distfiles/9a
SPIDERMONKEY_SUBDIR = js/src
SPIDERMONKEY_LICENSE = MPL-2.0
SPIDERMONKEY_LICENSE_FILES = moz.configure
SPIDERMONKEY_INSTALL_STAGING = YES
SPIDERMONKEY_DEPENDENCIES = \
host-python \
libnspr \
zlib
SPIDERMONKEY_CONF_ENV = \
PYTHON="$(HOST_DIR)/bin/python2"
# spidermonkey mixes up target and host.
# spidermonkey does not allow building against a system jemalloc,
# as it causes a conflict with glibc.
SPIDERMONKEY_CONF_OPTS = \
--host=$(GNU_HOST_NAME) \
--target=$(GNU_TARGET_NAME) \
--disable-jemalloc \
--enable-shared-js \
--with-system-zlib \
--with-system-nspr \
--with-nspr-exec-prefix="$(STAGING_DIR)/usr"
ifeq ($(BR2_PACKAGE_SPIDERMONKEY_JIT_ARCH_SUPPORTS),y)
SPIDERMONKEY_CONF_OPTS += --enable-ion
else
SPIDERMONKEY_CONF_OPTS += --disable-ion
endif
ifeq ($(BR2_PACKAGE_READLINE),y)
SPIDERMONKEY_CONF_OPTS += --enable-readline
SPIDERMONKEY_DEPENDENCIES += readline
else
SPIDERMONKEY_CONF_OPTS += --disable-readline
endif
# Remove unneeded files
define SPIDERMONKEY_CLEANUP
rm -rf $(TARGET_DIR)/usr/lib/libjs_static.ajs
rm -rf $(TARGET_DIR)/usr/bin/js60-config
endef
SPIDERMONKEY_POST_INSTALL_TARGET_HOOKS += SPIDERMONKEY_CLEANUP
$(eval $(autotools-package))