Skip to contentSkip to conversation

package/spidermonkey: do not build the JavaScript shell, by default

PATCH New unixmania at gmail.com 2 participants 4 messages Mar 8, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/spidermonkey: do not build the JavaScript shell, by default

From: Carlos Santos <[email protected]>

Add a configuration to enable the JavaScript shell (default off). So far only libmozjs is required (by polkit) and the shell takes around 24MiB.

---
 ....in-install-shell-only-if-it-s-built.patch | 28 +++++++++++++++++++
 package/spidermonkey/Config.in                | 11 ++++++++
 package/spidermonkey/spidermonkey.mk          |  1 +
 3 files changed, 40 insertions(+)
 create mode 100644 package/spidermonkey/0001-js-src-Makefile.in-install-shell-only-if-it-s-built.patch
package/spidermonkey/0001-js-src-Makefile.in-install-shell-only-if-it-s-built.patch new file +28 -0
new file mode 100644
index 0000000000..f6092af7ef
@@ -0,0 +1,28 @@
+From b5e4a9926cf50d12e9c5c05c6d1b161e5b662d62 Mon Sep 17 00:00:00 2001
+From: Carlos Santos <[email protected]>
+Date: Sat, 7 Mar 2020 23:42:02 -0300
+Subject: [PATCH] js/src/Makefile.in: install shell only if it's built
+
+Prevents an installation error if we configure with --disable-js-shell.
+
+Signed-off-by: Carlos Santos <[email protected]>
+---
+ js/src/Makefile.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/js/src/Makefile.in b/js/src/Makefile.in
+index 4ac9f48..9c8fb64 100644
+--- a/js/src/Makefile.in
++++ b/js/src/Makefile.in
+@@ -136,7 +136,7 @@ endif
+ 
+ install::
+ 	$(MAKE) -C build install
+-	$(MAKE) -C shell install
++	if [ -d shell ]; then $(MAKE) -C shell install; fi
+ 
+ ifdef HAVE_DTRACE
+ javascript-trace.h: $(srcdir)/devtools/javascript-trace.d
+-- 
+2.18.2
+
package/spidermonkey/Config.in +11 -0
index 5f12110626..e015e84ad2 100644
@@ -37,6 +37,17 @@ config BR2_PACKAGE_SPIDERMONKEY
 
 	  https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey
 
+if BR2_PACKAGE_SPIDERMONKEY
+
+config BR2_PACKAGE_SPIDERMONKEY_JS_SHELL
+	bool "JS shell"
+	help
+	  Build the JavaScript shell.
+
+	  WARNING: increases target image size by around 24 MiB.
+
+endif
+
 comment "spidermonkey needs a glibc or musl toolchain with C++, wchar, dynamic library, NPTL, gcc >= 4.9"
 	depends on BR2_USE_MMU
 	depends on BR2_PACKAGE_SPIDERMONKEY_ARCH_SUPPORTS
package/spidermonkey/spidermonkey.mk +1 -0
index 579dc7b864..9bd19b01d1 100644
@@ -30,6 +30,7 @@ SPIDERMONKEY_CONF_OPTS = \
 	--host=$(GNU_HOST_NAME) \
 	--target=$(GNU_TARGET_NAME) \
 	--disable-jemalloc \
+	--$(if $(BR2_PACKAGE_SPIDERMONKEY_JS_SHELL),en,dis)able-js-shell \
 	--enable-shared-js \
 	--with-system-zlib \
 	--with-system-nspr \
Signature · 1 line
2.18.2
#1 lore raw

PATCH 1/1 package/spidermonkey: do not build the JavaScript shell, by default

Hello Carlos,

package/spidermonkey/0001-js-src-Makefile.in-install-shell-only-if-it-s-built.patch

Quoted 19 lines · On Sun, 8 Mar 2020 00:21:28 -0300 unixmania at gmail.com wrote:

From: Carlos Santos <[email protected]>

Add a configuration to enable the JavaScript shell (default off). So far only libmozjs is required (by polkit) and the shell takes around 24MiB.

---
 ....in-install-shell-only-if-it-s-built.patch | 28 +++++++++++++++++++
 package/spidermonkey/Config.in                | 11 ++++++++
 package/spidermonkey/spidermonkey.mk          |  1 +
 3 files changed, 40 insertions(+)
 create mode 100644 package/spidermonkey/0001-js-src-Makefile.in-install-shell-only-if-it-s-built.patch
package/spidermonkey/0001-js-src-Makefile.in-install-shell-only-if-it-s-built.patch new file +0 -0
new file mode 100644
index 0000000000..f6092af7ef

We already had a 0001 patch, we actually have 10 patches on spidermonkey, so I renamed this one 0011.

Has this patch been submitted upstream ?

package/spidermonkey/spidermonkey.mk SPIDERMONKEY_CONF_OPTS = \ · line 33

Quoted 9 lines
package/spidermonkey/spidermonkey.mk +1 -0
index 579dc7b864..9bd19b01d1 100644
@@ -30,6 +30,7 @@ SPIDERMONKEY_CONF_OPTS = \
 	--host=$(GNU_HOST_NAME) \
 	--target=$(GNU_TARGET_NAME) \
 	--disable-jemalloc \
+	--$(if $(BR2_PACKAGE_SPIDERMONKEY_JS_SHELL),en,dis)able-js-shell \

That's really not the typical/conventional way of writing that in Buildroot, so I've expanded that into our more verbose, but more standard ifeq .. else .. endif conditional.

Then I've applied to master, because I really consider a 24 MB space saving to be a fix :-)

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH 1/1 package/spidermonkey: do not build the JavaScript shell, by default

Quoted 20 lines · Thomas Petazzoni

Hello Carlos,

Quoted 14 lines · On Sun, 8 Mar 2020 00:21:28 -0300 unixmania at gmail.com wrote:

From: Carlos Santos <[email protected]>

Add a configuration to enable the JavaScript shell (default off). So far only libmozjs is required (by polkit) and the shell takes around 24MiB.

---
 ....in-install-shell-only-if-it-s-built.patch | 28 +++++++++++++++++++
 package/spidermonkey/Config.in                | 11 ++++++++
 package/spidermonkey/spidermonkey.mk          |  1 +
 3 files changed, 40 insertions(+)
 create mode 100644 package/spidermonkey/0001-js-src-Makefile.in-install-shell-only-if-it-s-built.patch
Quoted 8 lines

package/spidermonkey/0001-js-src-Makefile.in-install-shell-only-if-it-s-built.patch

Quoted 5 lines
package/spidermonkey/0001-js-src-Makefile.in-install-shell-only-if-it-s-built.patch new file +0 -0
new file mode 100644
index 0000000000..f6092af7ef

We already had a 0001 patch, we actually have 10 patches on spidermonkey, so I renamed this one 0011.

Hum, that's the price passing "1" instead of "11" to --start-number. :-(

Quoted 1 line

Has this patch been submitted upstream ?

Well, "upstream" is Firefox and I don't believe they would care about an installation error when we compile a code sub-tree taken from a tarball made for Gentoo with an extra patch to force in-tree builds. ;-)

If the patch annoys you we can just use a post-install-target hook to remove js60. I didn't follow this approach because I was afraid that not passing --disable-js-shell would lead to the inclusion of code that could cause problem at run time.

Signature · 1 line
Carlos Santos <[email protected]>
#3 lore raw

PATCH 1/1 package/spidermonkey: do not build the JavaScript shell, by default

Hello Carlos,

Quoted 4 lines · On Sun, 8 Mar 2020 12:11:41 -0300 Carlos Santos <[email protected]> wrote:
Quoted 2 lines

We already had a 0001 patch, we actually have 10 patches on spidermonkey, so I renamed this one 0011.

Hum, that's the price passing "1" instead of "11" to --start-number. :-(

Hehe :-)

Quoted 7 lines
Quoted 2 lines

Has this patch been submitted upstream ?

Well, "upstream" is Firefox and I don't believe they would care about an installation error when we compile a code sub-tree taken from a tarball made for Gentoo with an extra patch to force in-tree builds. ;-)

Indeed, there is not really a regular upstream for spidermonkey. Fortunately, there are some patches submitting to polkit to make it use the duktape JS engine instead of spidermonkey, hopefully they will be merged in the near future.

Quoted 4 lines

If the patch annoys you we can just use a post-install-target hook to remove js60. I didn't follow this approach because I was afraid that not passing --disable-js-shell would lead to the inclusion of code that could cause problem at run time.

Nah, the patch is fine, let's keep it this way.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com