buildroot.busybox.net archive mirror
 help / color / mirror / Atom feed
* [Buildroot] [PATCH RFC 1/4] DEVELOPERS: add Thomas Petazzoni for nodejs
@ 2022-09-25 20:40 Thomas Petazzoni via buildroot
  2022-09-25 20:40 ` [Buildroot] [PATCH RFC 2/4] package/nodejs-bin: new package Thomas Petazzoni
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Thomas Petazzoni via buildroot @ 2022-09-25 20:40 UTC (permalink / raw)
  To: Buildroot List, Yann E. MORIN, Daniel Price, Martin Bark,
	Alexandru Ardelean
  Cc: Thomas Petazzoni

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 DEVELOPERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/DEVELOPERS b/DEVELOPERS
index 564149de0f..f82472bbb5 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2902,6 +2902,7 @@ F:	package/msmtp/
 F:	package/musl/
 F:	package/musl-fts/
 F:	package/ne10/
+F:	package/nodejs/
 F:	package/pkg-python.mk
 F:	package/pkg-autotools.mk
 F:	package/pkg-generic.mk
-- 
2.37.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH RFC 2/4] package/nodejs-bin: new package
  2022-09-25 20:40 [Buildroot] [PATCH RFC 1/4] DEVELOPERS: add Thomas Petazzoni for nodejs Thomas Petazzoni via buildroot
@ 2022-09-25 20:40 ` Thomas Petazzoni
  2022-09-26  7:56   ` Alexandru Ardelean
  2022-09-25 20:40 ` [Buildroot] [PATCH RFC 3/4] package/nodejs: make host package a virtual package Thomas Petazzoni
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Thomas Petazzoni @ 2022-09-25 20:40 UTC (permalink / raw)
  To: Buildroot List, Yann E. MORIN, Daniel Price, Martin Bark,
	Alexandru Ardelean
  Cc: Thomas Petazzoni

For now, it is not exposed in any way, but in the next commit, it will
be offered as an alternative to build host-nodejs from source.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 DEVELOPERS                         |  1 +
 package/nodejs-bin/nodejs-bin.hash |  7 ++++++
 package/nodejs-bin/nodejs-bin.mk   | 34 ++++++++++++++++++++++++++++++
 3 files changed, 42 insertions(+)
 create mode 100644 package/nodejs-bin/nodejs-bin.hash
 create mode 100644 package/nodejs-bin/nodejs-bin.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index f82472bbb5..564ab2ae72 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2903,6 +2903,7 @@ F:	package/musl/
 F:	package/musl-fts/
 F:	package/ne10/
 F:	package/nodejs/
+F:	package/nodejs-bin/
 F:	package/pkg-python.mk
 F:	package/pkg-autotools.mk
 F:	package/pkg-generic.mk
diff --git a/package/nodejs-bin/nodejs-bin.hash b/package/nodejs-bin/nodejs-bin.hash
new file mode 100644
index 0000000000..51dd082710
--- /dev/null
+++ b/package/nodejs-bin/nodejs-bin.hash
@@ -0,0 +1,7 @@
+# From https://nodejs.org/dist/v16.17.1/SHASUMS256.txt.asc
+sha256  3dfb8fd8f6b97df69cdc56524abc906c50ef1d0bf091188616802e6c7c731389  node-v16.17.1-linux-arm64.tar.xz
+sha256  a035ceefb5e16f5fce98c8ddfdf721b96eec20542c72fb8781bcbb6ef20c5550  node-v16.17.1-linux-armv7l.tar.xz
+sha256  70305934661f89fca64053b85317a75f233d5e3fdb2caa6546a19262a519cf20  node-v16.17.1-linux-ppc64le.tar.xz
+sha256  06ba2eb34aa385967f5f58c87a44753f83212f6cccea892b33f80a2e7fda8384  node-v16.17.1-linux-x64.tar.xz
+# Locally calculated
+sha256  69090e865afa7c62715b97f0712632d2923bd7a5faba91f94e4e75a2f9219d5e  LICENSE
diff --git a/package/nodejs-bin/nodejs-bin.mk b/package/nodejs-bin/nodejs-bin.mk
new file mode 100644
index 0000000000..5ebd8760c0
--- /dev/null
+++ b/package/nodejs-bin/nodejs-bin.mk
@@ -0,0 +1,34 @@
+################################################################################
+#
+# nodejs-bin
+#
+################################################################################
+
+# keep in sync with package/nodejs/nodejs.mk
+NODEJS_BIN_VERSION = 16.17.1
+NODEJS_BIN_SITE = https://nodejs.org/dist/v$(NODEJS_BIN_VERSION)
+
+ifeq ($(HOSTARCH),aarch64)
+NODEJS_BIN_ARCH = arm64
+else ifeq ($(HOSTARCH),arm)
+# We assume that if someone does a build on ARM, it will be on an
+# ARMv7 machine
+NODEJS_BIN_ARCH = armv7l
+else ifeq ($(HOSTARCH),ppc64le)
+NODEJS_BIN_ARCH = ppc64le
+else ifeq ($(HOSTARCH),x86_64)
+NODEJS_BIN_ARCH = x64
+endif
+
+NODEJS_BIN_SOURCE = node-v$(NODEJS_BIN_VERSION)-linux-$(NODEJS_BIN_ARCH).tar.xz
+NODEJS_BIN_LICENSE = MIT (core code); MIT, Apache and BSD family licenses (Bundled components)
+NODEJS_BIN_LICENSE_FILES = LICENSE
+NODEJS_BIN_CPE_ID_VENDOR = nodejs
+NODEJS_BIN_CPE_ID_PRODUCT = node.js
+
+define HOST_NODEJS_BIN_INSTALL_CMDS
+	rsync -a --exclude=CHANGELOG.md --exclude=LICENSE --exclude=README.md \
+		$(@D)/* $(HOST_DIR)/
+endef
+
+$(eval $(host-generic-package))
-- 
2.37.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH RFC 3/4] package/nodejs: make host package a virtual package
  2022-09-25 20:40 [Buildroot] [PATCH RFC 1/4] DEVELOPERS: add Thomas Petazzoni for nodejs Thomas Petazzoni via buildroot
  2022-09-25 20:40 ` [Buildroot] [PATCH RFC 2/4] package/nodejs-bin: new package Thomas Petazzoni
@ 2022-09-25 20:40 ` Thomas Petazzoni
  2022-09-25 20:43   ` Thomas Petazzoni
  2022-09-25 20:40 ` [Buildroot] [PATCH RFC 4/4] support/testing/tests/package/test_nodejs: test both host-nodejs-bin and host-nodejs-src Thomas Petazzoni
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Thomas Petazzoni @ 2022-09-25 20:40 UTC (permalink / raw)
  To: Buildroot List, Yann E. MORIN, Daniel Price, Martin Bark,
	Alexandru Ardelean
  Cc: Thomas Petazzoni

host-nodejs is quite long to build (5 minutes on a very fast build
machine), and will become a download dependency when we implement
vendoring for NodeJS-based packages.

In order to mitigate this build time, an idea is to use a pre-compiled
host NodeJS. One option would be to use a pre-installed NodeJS, but
we're concerned by version compatibility issues of the host NodeJS/NPM
does not have the same version as the target NodeJS/NPM. So another
option is to use a pre-compiled NodeJS provided by the NodeJS project
itself.

To achieve this, this commit turns the host-nodejs package into a
virtual package, which has two providers:

 - host-nodejs-src, which builds host-nodejs from source. Therefore
   the logic that used to be in package/nodejs/nodejs.mk to build
   host-nodejs from source is moved to
   package/nodejs-src/nodejs-src.mk. It should be noted that the
   patches in package/nodejs are not applied to package/nodejs-src as
   all patches are related to solving target-only issues. However, we
   could certainly think of applying the same patches if need be.

 - host-nodejs-bin, which was introduced in the previous commit, and
   which simply installs a pre-compiled NodeJS.

One possible alternate organization is to have package/nodejs/ contain
all three packages: package/nodejs/nodejs/, package/nodejs/nodejs-src,
package/nodejs/nodejs-bin, which would allow to more easily share a
few common variables (version, license, license files, CPE ID, etc.).

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 DEVELOPERS                                    |  1 +
 package/nodejs-bin/nodejs-bin.mk              |  4 +-
 package/{nodejs => nodejs-src}/Config.in.host |  4 +-
 package/nodejs-src/nodejs-src.hash            |  1 +
 package/nodejs-src/nodejs-src.mk              | 72 +++++++++++++++++++
 package/nodejs/Config.in.host                 | 39 ++++++++--
 package/nodejs/nodejs.mk                      | 57 +--------------
 7 files changed, 115 insertions(+), 63 deletions(-)
 copy package/{nodejs => nodejs-src}/Config.in.host (78%)
 create mode 120000 package/nodejs-src/nodejs-src.hash
 create mode 100644 package/nodejs-src/nodejs-src.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index 564ab2ae72..d6955ccbb4 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2904,6 +2904,7 @@ F:	package/musl-fts/
 F:	package/ne10/
 F:	package/nodejs/
 F:	package/nodejs-bin/
+F:	package/nodejs-src/
 F:	package/pkg-python.mk
 F:	package/pkg-autotools.mk
 F:	package/pkg-generic.mk
diff --git a/package/nodejs-bin/nodejs-bin.mk b/package/nodejs-bin/nodejs-bin.mk
index 5ebd8760c0..5077458eab 100644
--- a/package/nodejs-bin/nodejs-bin.mk
+++ b/package/nodejs-bin/nodejs-bin.mk
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-# keep in sync with package/nodejs/nodejs.mk
+# keep in sync with package/nodejs and package/nodejs-src
 NODEJS_BIN_VERSION = 16.17.1
 NODEJS_BIN_SITE = https://nodejs.org/dist/v$(NODEJS_BIN_VERSION)
 
@@ -26,6 +26,8 @@ NODEJS_BIN_LICENSE_FILES = LICENSE
 NODEJS_BIN_CPE_ID_VENDOR = nodejs
 NODEJS_BIN_CPE_ID_PRODUCT = node.js
 
+HOST_NODEJS_BIN_PROVIDES = host-nodejs
+
 define HOST_NODEJS_BIN_INSTALL_CMDS
 	rsync -a --exclude=CHANGELOG.md --exclude=LICENSE --exclude=README.md \
 		$(@D)/* $(HOST_DIR)/
diff --git a/package/nodejs/Config.in.host b/package/nodejs-src/Config.in.host
similarity index 78%
copy from package/nodejs/Config.in.host
copy to package/nodejs-src/Config.in.host
index f7f2b80a9b..e8f50959de 100644
--- a/package/nodejs/Config.in.host
+++ b/package/nodejs-src/Config.in.host
@@ -1,4 +1,4 @@
-config BR2_PACKAGE_HOST_NODEJS
+config BR2_PACKAGE_HOST_NODEJS_SRC
 	bool "host nodejs"
 	depends on BR2_HOST_GCC_AT_LEAST_8
 	select BR2_PACKAGE_HOST_PYTHON3
@@ -10,5 +10,5 @@ config BR2_PACKAGE_HOST_NODEJS
 
 	  http://nodejs.org/
 
-comment "host nodejs needs a host gcc >= 8"
+comment "host nodejs-src needs a host gcc >= 8"
 	depends on !BR2_HOST_GCC_AT_LEAST_8
diff --git a/package/nodejs-src/nodejs-src.hash b/package/nodejs-src/nodejs-src.hash
new file mode 120000
index 0000000000..d719b6629e
--- /dev/null
+++ b/package/nodejs-src/nodejs-src.hash
@@ -0,0 +1 @@
+../nodejs/nodejs.hash
\ No newline at end of file
diff --git a/package/nodejs-src/nodejs-src.mk b/package/nodejs-src/nodejs-src.mk
new file mode 100644
index 0000000000..f62e975c61
--- /dev/null
+++ b/package/nodejs-src/nodejs-src.mk
@@ -0,0 +1,72 @@
+################################################################################
+#
+# nodejs-src
+#
+################################################################################
+
+# Keep in sync with package/nodejs and package/nodejs-bin
+NODEJS_SRC_VERSION = 16.17.1
+NODEJS_SRC_SOURCE = node-v$(NODEJS_VERSION).tar.xz
+NODEJS_SRC_SITE = http://nodejs.org/dist/v$(NODEJS_VERSION)
+
+NODEJS_SRC_LICENSE = MIT (core code); MIT, Apache and BSD family licenses (Bundled components)
+NODEJS_SRC_LICENSE_FILES = LICENSE
+NODEJS_SRC_CPE_ID_VENDOR = nodejs
+NODEJS_SRC_CPE_ID_PRODUCT = node.js
+
+HOST_NODEJS_SRC_PROVIDES = host-nodejs
+
+HOST_NODEJS_SRC_DEPENDENCIES = \
+	host-icu \
+	host-libopenssl \
+	host-ninja \
+	host-pkgconf \
+	host-python3 \
+	host-zlib
+
+HOST_NODEJS_SRC_MAKE_OPTS = \
+	$(HOST_CONFIGURE_OPTS) \
+	CXXFLAGS="$(HOST_NODEJS_CXXFLAGS)" \
+	LDFLAGS.host="$(HOST_LDFLAGS)" \
+	NO_LOAD=cctest.target.mk \
+	PATH=$(@D)/bin:$(BR_PATH)
+
+define HOST_NODEJS_SRC_PYTHON3_SYMLINK
+	mkdir -p $(@D)/bin
+	ln -sf $(HOST_DIR)/bin/python3 $(@D)/bin/python
+endef
+HOST_NODEJS_SRC_PRE_CONFIGURE_HOOKS += NODEJS_PYTHON3_SYMLINK
+
+define HOST_NODEJS_SRC_CONFIGURE_CMDS
+	cd $(@D); \
+		$(HOST_CONFIGURE_OPTS) \
+		PATH=$(@D)/bin:$(BR_PATH) \
+		PYTHON=$(HOST_DIR)/bin/python3 \
+		$(HOST_DIR)/bin/python3 ./configure \
+		--prefix=$(HOST_DIR) \
+		--without-dtrace \
+		--without-etw \
+		--shared-openssl \
+		--shared-openssl-includes=$(HOST_DIR)/include \
+		--shared-openssl-libpath=$(HOST_DIR)/lib \
+		--shared-zlib \
+		--no-cross-compiling \
+		--with-intl=system-icu \
+		--ninja
+endef
+
+HOST_NODEJS_SRC_CXXFLAGS = $(HOST_CXXFLAGS)
+
+define HOST_NODEJS_SRC_BUILD_CMDS
+	$(HOST_MAKE_ENV) PYTHON=$(HOST_DIR)/bin/python3 \
+		$(MAKE) -C $(@D) \
+		$(HOST_NODEJS_MAKE_OPTS)
+endef
+
+define HOST_NODEJS_SRC_INSTALL_CMDS
+	$(HOST_MAKE_ENV) PYTHON=$(HOST_DIR)/bin/python3 \
+		$(MAKE) -C $(@D) install \
+		$(HOST_NODEJS_MAKE_OPTS)
+endef
+
+$(eval $(host-generic-package))
diff --git a/package/nodejs/Config.in.host b/package/nodejs/Config.in.host
index f7f2b80a9b..8e797cc6f4 100644
--- a/package/nodejs/Config.in.host
+++ b/package/nodejs/Config.in.host
@@ -1,14 +1,43 @@
+config BR2_PACKAGE_HOST_NODEJS_BIN_ARCH_SUPPORTS
+	bool
+	default y if BR2_HOSTARCH = "aarch64"
+	default y if BR2_HOSTARCH = "arm"
+	default y if BR2_HOSTARCH = "ppc64le"
+	default y if BR2_HOSTARCH = "x86_64"
+
 config BR2_PACKAGE_HOST_NODEJS
 	bool "host nodejs"
-	depends on BR2_HOST_GCC_AT_LEAST_8
-	select BR2_PACKAGE_HOST_PYTHON3
-	select BR2_PACKAGE_HOST_PYTHON3_BZIP2
-	select BR2_PACKAGE_HOST_PYTHON3_SSL
+	depends on BR2_PACKAGE_HOST_NODEJS_BIN_ARCH_SUPPORTS || \
+		BR2_HOST_GCC_AT_LEAST_8
 	help
 	  Event-driven I/O server-side JavaScript environment based on
 	  V8.
 
 	  http://nodejs.org/
 
-comment "host nodejs needs a host gcc >= 8"
+if BR2_PACKAGE_HOST_NODEJS
+
+choice
+
+config BR2_PACKAGE_HOST_NODEJS_BIN
+	bool "pre-built version"
+	depends on BR2_PACKAGE_HOST_NODEJS_BIN_ARCH_SUPPORTS
+
+config BR2_PACKAGE_HOST_NODEJS_SRC
+	bool "compile from source"
+	depends on BR2_HOST_GCC_AT_LEAST_8
+	select BR2_PACKAGE_HOST_PYTHON3
+	select BR2_PACKAGE_HOST_PYTHON3_BZIP2
+	select BR2_PACKAGE_HOST_PYTHON3_SSL
+
+comment "host nodejs from source needs a host gcc >= 8"
 	depends on !BR2_HOST_GCC_AT_LEAST_8
+
+endchoice
+
+endif
+
+config BR2_PACKAGE_PROVIDES_HOST_NODEJS
+	string
+	default "host-nodejs-bin" if BR2_PACKAGE_HOST_NODEJS_BIN
+	default "host-nodejs-src" if BR2_PACKAGE_HOST_NODEJS_SRC
diff --git a/package/nodejs/nodejs.mk b/package/nodejs/nodejs.mk
index 05456e3443..1dbe99cec5 100644
--- a/package/nodejs/nodejs.mk
+++ b/package/nodejs/nodejs.mk
@@ -4,6 +4,7 @@
 #
 ################################################################################
 
+# Keep in sync with package/nodejs-src and package/nodejs-bin
 NODEJS_VERSION = 16.17.1
 NODEJS_SOURCE = node-v$(NODEJS_VERSION).tar.xz
 NODEJS_SITE = http://nodejs.org/dist/v$(NODEJS_VERSION)
@@ -17,13 +18,6 @@ NODEJS_DEPENDENCIES = \
 	nghttp2 \
 	zlib \
 	$(call qstrip,$(BR2_PACKAGE_NODEJS_MODULES_ADDITIONAL_DEPS))
-HOST_NODEJS_DEPENDENCIES = \
-	host-icu \
-	host-libopenssl \
-	host-ninja \
-	host-pkgconf \
-	host-python3 \
-	host-zlib
 NODEJS_INSTALL_STAGING = YES
 NODEJS_LICENSE = MIT (core code); MIT, Apache and BSD family licenses (Bundled components)
 NODEJS_LICENSE_FILES = LICENSE
@@ -41,13 +35,6 @@ NODEJS_CONF_OPTS = \
 	--dest-os=linux \
 	--ninja
 
-HOST_NODEJS_MAKE_OPTS = \
-	$(HOST_CONFIGURE_OPTS) \
-	CXXFLAGS="$(HOST_NODEJS_CXXFLAGS)" \
-	LDFLAGS.host="$(HOST_LDFLAGS)" \
-	NO_LOAD=cctest.target.mk \
-	PATH=$(@D)/bin:$(BR_PATH)
-
 NODEJS_MAKE_OPTS = \
 	$(TARGET_CONFIGURE_OPTS) \
 	NO_LOAD=cctest.target.mk \
@@ -62,7 +49,6 @@ define NODEJS_PYTHON3_SYMLINK
 	mkdir -p $(@D)/bin
 	ln -sf $(HOST_DIR)/bin/python3 $(@D)/bin/python
 endef
-HOST_NODEJS_PRE_CONFIGURE_HOOKS += NODEJS_PYTHON3_SYMLINK
 NODEJS_PRE_CONFIGURE_HOOKS += NODEJS_PYTHON3_SYMLINK
 
 ifeq ($(BR2_PACKAGE_OPENSSL),y)
@@ -83,38 +69,6 @@ ifneq ($(BR2_PACKAGE_NODEJS_NPM),y)
 NODEJS_CONF_OPTS += --without-npm
 endif
 
-define HOST_NODEJS_CONFIGURE_CMDS
-	cd $(@D); \
-		$(HOST_CONFIGURE_OPTS) \
-		PATH=$(@D)/bin:$(BR_PATH) \
-		PYTHON=$(HOST_DIR)/bin/python3 \
-		$(HOST_DIR)/bin/python3 ./configure \
-		--prefix=$(HOST_DIR) \
-		--without-dtrace \
-		--without-etw \
-		--shared-openssl \
-		--shared-openssl-includes=$(HOST_DIR)/include \
-		--shared-openssl-libpath=$(HOST_DIR)/lib \
-		--shared-zlib \
-		--no-cross-compiling \
-		--with-intl=system-icu \
-		--ninja
-endef
-
-HOST_NODEJS_CXXFLAGS = $(HOST_CXXFLAGS)
-
-define HOST_NODEJS_BUILD_CMDS
-	$(HOST_MAKE_ENV) PYTHON=$(HOST_DIR)/bin/python3 \
-		$(MAKE) -C $(@D) \
-		$(HOST_NODEJS_MAKE_OPTS)
-endef
-
-define HOST_NODEJS_INSTALL_CMDS
-	$(HOST_MAKE_ENV) PYTHON=$(HOST_DIR)/bin/python3 \
-		$(MAKE) -C $(@D) install \
-		$(HOST_NODEJS_MAKE_OPTS)
-endef
-
 ifeq ($(BR2_i386),y)
 NODEJS_CPU = ia32
 else ifeq ($(BR2_x86_64),y)
@@ -186,13 +140,6 @@ define NODEJS_WRAPPER_FIXUP
 endef
 NODEJS_PRE_CONFIGURE_HOOKS += NODEJS_WRAPPER_FIXUP
 
-# Do not run the qemu-wrapper for the host build.
-define HOST_NODEJS_WRAPPER_FIXUP
-	$(SED) "s%@MAYBE_WRAPPER@%%g" $(@D)/node.gyp
-	$(SED) "s%@MAYBE_WRAPPER@%%g" $(@D)/tools/v8_gypfiles/v8.gyp
-endef
-HOST_NODEJS_PRE_CONFIGURE_HOOKS += HOST_NODEJS_WRAPPER_FIXUP
-
 define NODEJS_CONFIGURE_CMDS
 	(cd $(@D); \
 		$(TARGET_CONFIGURE_OPTS) \
@@ -265,4 +212,4 @@ endef
 
 # node.js configure is a Python script and does not use autotools
 $(eval $(generic-package))
-$(eval $(host-generic-package))
+$(eval $(host-virtual-package))
-- 
2.37.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH RFC 4/4] support/testing/tests/package/test_nodejs: test both host-nodejs-bin and host-nodejs-src
  2022-09-25 20:40 [Buildroot] [PATCH RFC 1/4] DEVELOPERS: add Thomas Petazzoni for nodejs Thomas Petazzoni via buildroot
  2022-09-25 20:40 ` [Buildroot] [PATCH RFC 2/4] package/nodejs-bin: new package Thomas Petazzoni
  2022-09-25 20:40 ` [Buildroot] [PATCH RFC 3/4] package/nodejs: make host package a virtual package Thomas Petazzoni
@ 2022-09-25 20:40 ` Thomas Petazzoni
  2022-09-26  8:00 ` [Buildroot] [PATCH RFC 1/4] DEVELOPERS: add Thomas Petazzoni for nodejs Alexandru Ardelean
  2023-10-02 15:42 ` Arnout Vandecappelle via buildroot
  4 siblings, 0 replies; 10+ messages in thread
From: Thomas Petazzoni @ 2022-09-25 20:40 UTC (permalink / raw)
  To: Buildroot List, Yann E. MORIN, Daniel Price, Martin Bark,
	Alexandru Ardelean
  Cc: Thomas Petazzoni

The TestNodeJSModule test triggers the build of host-nodejs to be able
to install third party modules. Now that host-nodejs has two
providers, it makes sense to test both cases, so we duplicate
TestNodeJSModule into TestNodeJsModuleHostBin (which tests the
host-nodejs-bin) and TestNodeJSModuleHostSrc (which tests the
host-nodejs-src).

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 support/testing/tests/package/test_nodejs.py | 29 +++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/support/testing/tests/package/test_nodejs.py b/support/testing/tests/package/test_nodejs.py
index 9463c76b72..b63d44c97e 100644
--- a/support/testing/tests/package/test_nodejs.py
+++ b/support/testing/tests/package/test_nodejs.py
@@ -27,7 +27,7 @@ class TestNodeJSBasic(infra.basetest.BRTest):
         self.assertRunOk("node sample_nodejs_basic.js")
 
 
-class TestNodeJSModule(infra.basetest.BRTest):
+class TestNodeJSModuleHostBin(infra.basetest.BRTest):
     config = \
         """
         BR2_arm=y
@@ -36,6 +36,33 @@ class TestNodeJSModule(infra.basetest.BRTest):
         BR2_TOOLCHAIN_EXTERNAL=y
         BR2_PACKAGE_NODEJS=y
         BR2_PACKAGE_NODEJS_MODULES_ADDITIONAL="lodash"
+        BR2_PACKAGE_HOST_NODEJS_BIN=y
+        BR2_TARGET_ROOTFS_CPIO=y
+        # BR2_TARGET_ROOTFS_TAR is not set
+        BR2_ROOTFS_POST_BUILD_SCRIPT="{}"
+        BR2_ROOTFS_POST_SCRIPT_ARGS="{}"
+        """.format(infra.filepath("tests/package/copy-sample-script-to-target.sh"),
+                   infra.filepath("tests/package/sample_nodejs_module.js"))
+
+    def test_run(self):
+        cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
+        self.emulator.boot(arch="armv7",
+                           kernel="builtin",
+                           options=["-initrd", cpio_file])
+        self.emulator.login()
+        self.assertRunOk("node sample_nodejs_module.js")
+
+
+class TestNodeJSModuleHostSrc(infra.basetest.BRTest):
+    config = \
+        """
+        BR2_arm=y
+        BR2_cortex_a9=y
+        BR2_ARM_ENABLE_VFP=y
+        BR2_TOOLCHAIN_EXTERNAL=y
+        BR2_PACKAGE_NODEJS=y
+        BR2_PACKAGE_NODEJS_MODULES_ADDITIONAL="lodash"
+        BR2_PACKAGE_HOST_NODEJS_SRC=y
         BR2_TARGET_ROOTFS_CPIO=y
         # BR2_TARGET_ROOTFS_TAR is not set
         BR2_ROOTFS_POST_BUILD_SCRIPT="{}"
-- 
2.37.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [Buildroot] [PATCH RFC 3/4] package/nodejs: make host package a virtual package
  2022-09-25 20:40 ` [Buildroot] [PATCH RFC 3/4] package/nodejs: make host package a virtual package Thomas Petazzoni
@ 2022-09-25 20:43   ` Thomas Petazzoni
  0 siblings, 0 replies; 10+ messages in thread
From: Thomas Petazzoni @ 2022-09-25 20:43 UTC (permalink / raw)
  To: Buildroot List, Yann E. MORIN, Daniel Price, Martin Bark,
	Alexandru Ardelean

On Sun, 25 Sep 2022 22:40:28 +0200
Thomas Petazzoni <thomas.petazzoni@bootlin.com> wrote:

> diff --git a/package/nodejs/Config.in.host b/package/nodejs-src/Config.in.host
> similarity index 78%
> copy from package/nodejs/Config.in.host
> copy to package/nodejs-src/Config.in.host
> index f7f2b80a9b..e8f50959de 100644
> --- a/package/nodejs/Config.in.host
> +++ b/package/nodejs-src/Config.in.host

Dammit, I was supposed to remove this file. I will fix this in v2.
package/nodejs-src/Config.in.host should not exist.

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Buildroot] [PATCH RFC 2/4] package/nodejs-bin: new package
  2022-09-25 20:40 ` [Buildroot] [PATCH RFC 2/4] package/nodejs-bin: new package Thomas Petazzoni
@ 2022-09-26  7:56   ` Alexandru Ardelean
  2022-09-26  8:05     ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 10+ messages in thread
From: Alexandru Ardelean @ 2022-09-26  7:56 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: Daniel Price, Martin Bark, Yann E. MORIN, Buildroot List

On Sun, Sep 25, 2022 at 11:40 PM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> For now, it is not exposed in any way, but in the next commit, it will
> be offered as an alternative to build host-nodejs from source.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
>  DEVELOPERS                         |  1 +
>  package/nodejs-bin/nodejs-bin.hash |  7 ++++++
>  package/nodejs-bin/nodejs-bin.mk   | 34 ++++++++++++++++++++++++++++++
>  3 files changed, 42 insertions(+)
>  create mode 100644 package/nodejs-bin/nodejs-bin.hash
>  create mode 100644 package/nodejs-bin/nodejs-bin.mk
>
> diff --git a/DEVELOPERS b/DEVELOPERS
> index f82472bbb5..564ab2ae72 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -2903,6 +2903,7 @@ F:        package/musl/
>  F:     package/musl-fts/
>  F:     package/ne10/
>  F:     package/nodejs/
> +F:     package/nodejs-bin/
>  F:     package/pkg-python.mk
>  F:     package/pkg-autotools.mk
>  F:     package/pkg-generic.mk
> diff --git a/package/nodejs-bin/nodejs-bin.hash b/package/nodejs-bin/nodejs-bin.hash
> new file mode 100644
> index 0000000000..51dd082710
> --- /dev/null
> +++ b/package/nodejs-bin/nodejs-bin.hash
> @@ -0,0 +1,7 @@
> +# From https://nodejs.org/dist/v16.17.1/SHASUMS256.txt.asc
> +sha256  3dfb8fd8f6b97df69cdc56524abc906c50ef1d0bf091188616802e6c7c731389  node-v16.17.1-linux-arm64.tar.xz
> +sha256  a035ceefb5e16f5fce98c8ddfdf721b96eec20542c72fb8781bcbb6ef20c5550  node-v16.17.1-linux-armv7l.tar.xz
> +sha256  70305934661f89fca64053b85317a75f233d5e3fdb2caa6546a19262a519cf20  node-v16.17.1-linux-ppc64le.tar.xz
> +sha256  06ba2eb34aa385967f5f58c87a44753f83212f6cccea892b33f80a2e7fda8384  node-v16.17.1-linux-x64.tar.xz
> +# Locally calculated
> +sha256  69090e865afa7c62715b97f0712632d2923bd7a5faba91f94e4e75a2f9219d5e  LICENSE
> diff --git a/package/nodejs-bin/nodejs-bin.mk b/package/nodejs-bin/nodejs-bin.mk
> new file mode 100644
> index 0000000000..5ebd8760c0
> --- /dev/null
> +++ b/package/nodejs-bin/nodejs-bin.mk
> @@ -0,0 +1,34 @@
> +################################################################################
> +#
> +# nodejs-bin
> +#
> +################################################################################
> +
> +# keep in sync with package/nodejs/nodejs.mk
> +NODEJS_BIN_VERSION = 16.17.1

Silly question(s) from me.
This may go against some BR guidelines.

But, what if you were to add a 'package/nodejs/version' file and
include it here like `include ../package/nodejs/version` ?

Another idea would be to maybe add a new folder sub-level like
'package/nodejs/nodejs/<the current one>' &
'package/nodejs/nodejs-bin/<this new one>' and have a
'package/nodejs/nodejs.mk' which includes the mk files from the
sub-dirs.
But ¯\_(ツ)_/¯
Still don't know if it goes against BR guidelines.

> +NODEJS_BIN_SITE = https://nodejs.org/dist/v$(NODEJS_BIN_VERSION)
> +
> +ifeq ($(HOSTARCH),aarch64)
> +NODEJS_BIN_ARCH = arm64
> +else ifeq ($(HOSTARCH),arm)
> +# We assume that if someone does a build on ARM, it will be on an
> +# ARMv7 machine
> +NODEJS_BIN_ARCH = armv7l
> +else ifeq ($(HOSTARCH),ppc64le)
> +NODEJS_BIN_ARCH = ppc64le
> +else ifeq ($(HOSTARCH),x86_64)
> +NODEJS_BIN_ARCH = x64
> +endif
> +
> +NODEJS_BIN_SOURCE = node-v$(NODEJS_BIN_VERSION)-linux-$(NODEJS_BIN_ARCH).tar.xz
> +NODEJS_BIN_LICENSE = MIT (core code); MIT, Apache and BSD family licenses (Bundled components)
> +NODEJS_BIN_LICENSE_FILES = LICENSE
> +NODEJS_BIN_CPE_ID_VENDOR = nodejs
> +NODEJS_BIN_CPE_ID_PRODUCT = node.js
> +
> +define HOST_NODEJS_BIN_INSTALL_CMDS
> +       rsync -a --exclude=CHANGELOG.md --exclude=LICENSE --exclude=README.md \
> +               $(@D)/* $(HOST_DIR)/
> +endef
> +
> +$(eval $(host-generic-package))
> --
> 2.37.3
>
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Buildroot] [PATCH RFC 1/4] DEVELOPERS: add Thomas Petazzoni for nodejs
  2022-09-25 20:40 [Buildroot] [PATCH RFC 1/4] DEVELOPERS: add Thomas Petazzoni for nodejs Thomas Petazzoni via buildroot
                   ` (2 preceding siblings ...)
  2022-09-25 20:40 ` [Buildroot] [PATCH RFC 4/4] support/testing/tests/package/test_nodejs: test both host-nodejs-bin and host-nodejs-src Thomas Petazzoni
@ 2022-09-26  8:00 ` Alexandru Ardelean
  2023-10-02 15:42 ` Arnout Vandecappelle via buildroot
  4 siblings, 0 replies; 10+ messages in thread
From: Alexandru Ardelean @ 2022-09-26  8:00 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: Daniel Price, Martin Bark, Yann E. MORIN, Buildroot List

On Sun, Sep 25, 2022 at 11:40 PM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>

Better nodejs support will make it interesting to bridge upper-level
JS devs with embedded for projects like smart-TVs.

So, thank you for the support on this :)

I'm still curious how a smart-TV would end-up looking like (with BR at
the base + nodejs + webkit + cog).
It satisfies the embedded needs relatively well.

Thanks
Alexandru

> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
>  DEVELOPERS | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/DEVELOPERS b/DEVELOPERS
> index 564149de0f..f82472bbb5 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -2902,6 +2902,7 @@ F:        package/msmtp/
>  F:     package/musl/
>  F:     package/musl-fts/
>  F:     package/ne10/
> +F:     package/nodejs/
>  F:     package/pkg-python.mk
>  F:     package/pkg-autotools.mk
>  F:     package/pkg-generic.mk
> --
> 2.37.3
>
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Buildroot] [PATCH RFC 2/4] package/nodejs-bin: new package
  2022-09-26  7:56   ` Alexandru Ardelean
@ 2022-09-26  8:05     ` Thomas Petazzoni via buildroot
  2022-09-26  8:08       ` Alexandru Ardelean
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas Petazzoni via buildroot @ 2022-09-26  8:05 UTC (permalink / raw)
  To: Alexandru Ardelean
  Cc: Daniel Price, Martin Bark, Yann E. MORIN, Buildroot List

On Mon, 26 Sep 2022 10:56:10 +0300
Alexandru Ardelean <ardeleanalex@gmail.com> wrote:

> Silly question(s) from me.
> This may go against some BR guidelines.
> 
> But, what if you were to add a 'package/nodejs/version' file and
> include it here like `include ../package/nodejs/version` ?

We've not been doing this like this for now.

> Another idea would be to maybe add a new folder sub-level like
> 'package/nodejs/nodejs/<the current one>' &
> 'package/nodejs/nodejs-bin/<this new one>' and have a
> 'package/nodejs/nodejs.mk' which includes the mk files from the
> sub-dirs.

See the commit log for PATCH 3/4, which says:

"""
One possible alternate organization is to have package/nodejs/ contain
all three packages: package/nodejs/nodejs/, package/nodejs/nodejs-src,
package/nodejs/nodejs-bin, which would allow to more easily share a
few common variables (version, license, license files, CPE ID, etc.).
"""

 :-)

BTW, did you confirm that with the latest master you can now build
NodeJS correctly for your scenario?

Best regards,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Buildroot] [PATCH RFC 2/4] package/nodejs-bin: new package
  2022-09-26  8:05     ` Thomas Petazzoni via buildroot
@ 2022-09-26  8:08       ` Alexandru Ardelean
  0 siblings, 0 replies; 10+ messages in thread
From: Alexandru Ardelean @ 2022-09-26  8:08 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: Daniel Price, Martin Bark, Yann E. MORIN, Buildroot List

On Mon, Sep 26, 2022 at 11:05 AM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> On Mon, 26 Sep 2022 10:56:10 +0300
> Alexandru Ardelean <ardeleanalex@gmail.com> wrote:
>
> > Silly question(s) from me.
> > This may go against some BR guidelines.
> >
> > But, what if you were to add a 'package/nodejs/version' file and
> > include it here like `include ../package/nodejs/version` ?
>
> We've not been doing this like this for now.
>
> > Another idea would be to maybe add a new folder sub-level like
> > 'package/nodejs/nodejs/<the current one>' &
> > 'package/nodejs/nodejs-bin/<this new one>' and have a
> > 'package/nodejs/nodejs.mk' which includes the mk files from the
> > sub-dirs.
>
> See the commit log for PATCH 3/4, which says:

Ah, apologies.
I missed that.

>
> """
> One possible alternate organization is to have package/nodejs/ contain
> all three packages: package/nodejs/nodejs/, package/nodejs/nodejs-src,
> package/nodejs/nodejs-bin, which would allow to more easily share a
> few common variables (version, license, license files, CPE ID, etc.).
> """
>
>  :-)
>
> BTW, did you confirm that with the latest master you can now build
> NodeJS correctly for your scenario?

The message is in my draft folder to be sent.

I confirm nodejs for ARM64 with external toolchain.

Running nodejs ARM with external toolchain now.
I wanted to send that message after ARM finishes.
Will send it when ARM finishes.

Thanks
Alexandru

>
> Best regards,
>
> Thomas
> --
> Thomas Petazzoni, co-owner and CEO, Bootlin
> Embedded Linux and Kernel engineering and training
> https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Buildroot] [PATCH RFC 1/4] DEVELOPERS: add Thomas Petazzoni for nodejs
  2022-09-25 20:40 [Buildroot] [PATCH RFC 1/4] DEVELOPERS: add Thomas Petazzoni for nodejs Thomas Petazzoni via buildroot
                   ` (3 preceding siblings ...)
  2022-09-26  8:00 ` [Buildroot] [PATCH RFC 1/4] DEVELOPERS: add Thomas Petazzoni for nodejs Alexandru Ardelean
@ 2023-10-02 15:42 ` Arnout Vandecappelle via buildroot
  4 siblings, 0 replies; 10+ messages in thread
From: Arnout Vandecappelle via buildroot @ 2023-10-02 15:42 UTC (permalink / raw)
  To: Thomas Petazzoni, Buildroot List, Yann E. MORIN, Daniel Price,
	Martin Bark, Alexandru Ardelean



On 25/09/2022 22:40, Thomas Petazzoni via buildroot wrote:
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

  Series applied to master, after reworking similar to the just-posted go-bin 
series [1].

  Regards,
  Arnout

[1] https://patchwork.ozlabs.org/project/buildroot/list/?series=375729


> ---
>   DEVELOPERS | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/DEVELOPERS b/DEVELOPERS
> index 564149de0f..f82472bbb5 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -2902,6 +2902,7 @@ F:	package/msmtp/
>   F:	package/musl/
>   F:	package/musl-fts/
>   F:	package/ne10/
> +F:	package/nodejs/
>   F:	package/pkg-python.mk
>   F:	package/pkg-autotools.mk
>   F:	package/pkg-generic.mk
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-10-02 15:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-25 20:40 [Buildroot] [PATCH RFC 1/4] DEVELOPERS: add Thomas Petazzoni for nodejs Thomas Petazzoni via buildroot
2022-09-25 20:40 ` [Buildroot] [PATCH RFC 2/4] package/nodejs-bin: new package Thomas Petazzoni
2022-09-26  7:56   ` Alexandru Ardelean
2022-09-26  8:05     ` Thomas Petazzoni via buildroot
2022-09-26  8:08       ` Alexandru Ardelean
2022-09-25 20:40 ` [Buildroot] [PATCH RFC 3/4] package/nodejs: make host package a virtual package Thomas Petazzoni
2022-09-25 20:43   ` Thomas Petazzoni
2022-09-25 20:40 ` [Buildroot] [PATCH RFC 4/4] support/testing/tests/package/test_nodejs: test both host-nodejs-bin and host-nodejs-src Thomas Petazzoni
2022-09-26  8:00 ` [Buildroot] [PATCH RFC 1/4] DEVELOPERS: add Thomas Petazzoni for nodejs Alexandru Ardelean
2023-10-02 15:42 ` Arnout Vandecappelle via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).