mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH v5 1/3] nodejs: version bump 6.9.5 -> 12.14.1 LTS
@ 2020-02-04  7:53 Ulrich Ölmann
  2020-02-04  7:53 ` [ptxdist] [PATCH v5 2/3] host-yarn: new package Ulrich Ölmann
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Ulrich Ölmann @ 2020-02-04  7:53 UTC (permalink / raw)
  To: PTXdist Development Mailing List

From: Björn Esser <b.esser@pengutronix.de>

We also need to build a host-nodejs package first, as there
are some tools needed to be executable on the host system
during the intermediate cross-build process.

This package drops support for NPM, as we will be managing
Node.js packages with Yarn, which will be implemented in the
following commits.

The patches that are shipped along with this version of the
package have been taken from the SRPM of the Node.js-package
in Fedora. See:

https://src.fedoraproject.org/rpms/nodejs/c/f0e2a1ed4615?branch=master

Signed-off-by: Björn Esser <b.esser@pengutronix.de>
[uol: adjusted commit message, dropped CREDIT lines, removed shell usage &
inserted line break in build command]
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
---
v1 --> v2: fix configure flags for host-nodejs
v2 --> v3: add missing patches, remove obsolete patches
Range-diff of v5 against v4:
1:  e08d21cc0be1 ! 1:  440fed72eaf9 nodejs: version bump 6.9.5 -> 12.14.1 LTS
    @@ Commit message
         https://src.fedoraproject.org/rpms/nodejs/c/f0e2a1ed4615?branch=master

         Signed-off-by: Björn Esser <b.esser@pengutronix.de>
    +    [uol: adjusted commit message, dropped CREDIT lines, removed shell usage &
    +    inserted line break in build command]
    +    Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>

      ## patches/node-v12.14.1/0001-Disable-running-gyp-on-shared-deps.patch (new) ##
     @@
    @@ rules/host-nodejs.make
      #
      # Copyright (C) 2015 by Michael Grzeschik <mgr@pengutronix.de>
     +# Copyright (C) 2019 by Björn Esser <bes@pengutronix.de>
    -+#
    -+# See CREDITS for details about who has contributed to this project.
      #
      # For further information about the PTXdist project and license conditions
      # see the README file.
    @@ rules/nodejs.make
      #
      # Copyright (C) 2015 by Michael Grzeschik <mgr@pengutronix.de>
     +# Copyright (C) 2019 by Björn Esser <bes@pengutronix.de>
    -+#
    -+# See CREDITS for details about who has contributed to this project.
      #
      # For further information about the PTXdist project and license conditions
      # see the README file.
    @@ rules/nodejs.make: NODEJS_ARM_FLOAT_ABI = $(shell ptxd_cross_cc_v | sed -n "s/CO
     +#	# to the pre-built host tool binaries, which are different for
     +#	# each individual checkout of a BSP.  -_-
     +	$(foreach f,$(NODEJS_HOST_TOOLS), \
    -+		$(shell sed -i -e "s#<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)$(f)<(EXECUTABLE_SUFFIX)#$(PTXDIST_SYSROOT_HOST)/bin/$(f)#" $(NODEJS_DIR)/node.gyp $(NODEJS_DIR)/tools/v8_gypfiles/v8.gyp) \
    -+	)
    ++		sed -i -e "s#<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)$(f)<(EXECUTABLE_SUFFIX)#$(PTXDIST_SYSROOT_HOST)/bin/$(f)#" \
    ++			$(NODEJS_DIR)/node.gyp $(NODEJS_DIR)/tools/v8_gypfiles/v8.gyp $(ptx/nl))
     +
     +	@$(call world/prepare, NODEJS)
     +

 ...1-Disable-running-gyp-on-shared-deps.patch |  25 ++++
 ...Install-both-binaries-and-use-libdir.patch |  83 ++++++++++++
 patches/node-v12.14.1/series                  |   5 +
 ...build-from-source-option-to-npmunbox.patch |  31 -----
 patches/npmbox-2.6.1/series                   |   4 -
 rules/host-nodejs.in                          |   2 +
 rules/host-nodejs.make                        |  39 +++---
 rules/nodejs.in                               |  54 ++------
 rules/nodejs.make                             | 119 ++++++------------
 9 files changed, 185 insertions(+), 177 deletions(-)
 create mode 100644 patches/node-v12.14.1/0001-Disable-running-gyp-on-shared-deps.patch
 create mode 100644 patches/node-v12.14.1/0002-Install-both-binaries-and-use-libdir.patch
 create mode 100644 patches/node-v12.14.1/series
 delete mode 100644 patches/npmbox-2.6.1/0001-npmbox-add-build-from-source-option-to-npmunbox.patch
 delete mode 100644 patches/npmbox-2.6.1/series

diff --git a/patches/node-v12.14.1/0001-Disable-running-gyp-on-shared-deps.patch b/patches/node-v12.14.1/0001-Disable-running-gyp-on-shared-deps.patch
new file mode 100644
index 000000000000..58d46a8f4167
--- /dev/null
+++ b/patches/node-v12.14.1/0001-Disable-running-gyp-on-shared-deps.patch
@@ -0,0 +1,25 @@
+From: Zuzana Svetlikova <zsvetlik@redhat.com>
+Date: Thu, 27 Apr 2017 14:25:42 +0200
+Subject: [PATCH] Disable running gyp on shared deps
+
+---
+ Makefile | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 56f53582d1f4..2fb80e742637 100644
+--- a/Makefile
++++ b/Makefile
+@@ -141,9 +141,9 @@ test-code-cache: with-code-cache
+ 	echo "'test-code-cache' target is a noop"
+ 
+ out/Makefile: config.gypi common.gypi node.gyp \
+-	deps/uv/uv.gyp deps/http_parser/http_parser.gyp deps/zlib/zlib.gyp \
+-	tools/v8_gypfiles/toolchain.gypi tools/v8_gypfiles/features.gypi \
+-	tools/v8_gypfiles/inspector.gypi tools/v8_gypfiles/v8.gyp
++  deps/http_parser/http_parser.gyp \
++  tools/v8_gypfiles/toolchain.gypi tools/v8_gypfiles/features.gypi \
++  tools/v8_gypfiles/inspector.gypi tools/v8_gypfiles/v8.gyp
+ 	$(PYTHON) tools/gyp_node.py -f make
+ 
+ # node_version.h is listed because the N-API version is taken from there
diff --git a/patches/node-v12.14.1/0002-Install-both-binaries-and-use-libdir.patch b/patches/node-v12.14.1/0002-Install-both-binaries-and-use-libdir.patch
new file mode 100644
index 000000000000..38c3c96503f1
--- /dev/null
+++ b/patches/node-v12.14.1/0002-Install-both-binaries-and-use-libdir.patch
@@ -0,0 +1,83 @@
+From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
+Date: Tue, 19 Mar 2019 23:22:40 -0400
+Subject: [PATCH] Install both binaries and use libdir.
+
+This allows us to build with a shared library for other users while
+still providing the normal executable.
+
+Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
+---
+ configure.py     |  7 +++++++
+ tools/install.py | 31 ++++++++++++++-----------------
+ 2 files changed, 21 insertions(+), 17 deletions(-)
+
+diff --git a/configure.py b/configure.py
+index 20cce214dbb1..e2d78a2a51ef 100755
+--- a/configure.py
++++ b/configure.py
+@@ -559,6 +559,12 @@ parser.add_option('--shared',
+     help='compile shared library for embedding node in another project. ' +
+          '(This mode is not officially supported for regular applications)')
+ 
++parser.add_option('--libdir',
++    action='store',
++    dest='libdir',
++    default='lib',
++    help='a directory to install the shared library into')
++
+ parser.add_option('--without-v8-platform',
+     action='store_true',
+     dest='without_v8_platform',
+@@ -1103,6 +1109,7 @@ def configure_node(o):
+   if o['variables']['want_separate_host_toolset'] == 0:
+     o['variables']['node_code_cache'] = 'yes' # For testing
+   o['variables']['node_shared'] = b(options.shared)
++  o['variables']['libdir'] = options.libdir
+   node_module_version = getmoduleversion.get_version()
+ 
+   if sys.platform == 'darwin':
+diff --git a/tools/install.py b/tools/install.py
+index 655802980a6e..fe4723bf1501 100755
+--- a/tools/install.py
++++ b/tools/install.py
+@@ -121,26 +121,23 @@ def subdir_files(path, dest, action):
+ 
+ def files(action):
+   is_windows = sys.platform == 'win32'
+-  output_file = 'node'
+   output_prefix = 'out/Release/'
++  output_libprefix = output_prefix
+ 
+-  if 'false' == variables.get('node_shared'):
+-    if is_windows:
+-      output_file += '.exe'
++  if is_windows:
++    output_bin = 'node.exe'
++    output_lib = 'node.dll'
+   else:
+-    if is_windows:
+-      output_file += '.dll'
+-    else:
+-      output_file = 'lib' + output_file + '.' + variables.get('shlib_suffix')
+-      # GYP will output to lib.target except on OS X, this is hardcoded
+-      # in its source - see the _InstallableTargetInstallPath function.
+-      if sys.platform != 'darwin':
+-        output_prefix += 'lib.target/'
+-
+-  if 'false' == variables.get('node_shared'):
+-    action([output_prefix + output_file], 'bin/' + output_file)
+-  else:
+-    action([output_prefix + output_file], 'lib/' + output_file)
++    output_bin = 'node'
++    output_lib = 'libnode.' + variables.get('shlib_suffix')
++    # GYP will output to lib.target except on OS X, this is hardcoded
++    # in its source - see the _InstallableTargetInstallPath function.
++    if sys.platform != 'darwin':
++      output_libprefix += 'lib.target/'
++
++  action([output_prefix + output_bin], 'bin/' + output_bin)
++  if 'true' == variables.get('node_shared'):
++    action([output_libprefix + output_lib], variables.get('libdir') + '/' + output_lib)
+ 
+   if 'true' == variables.get('node_use_dtrace'):
+     action(['out/Release/node.d'], 'lib/dtrace/node.d')
diff --git a/patches/node-v12.14.1/series b/patches/node-v12.14.1/series
new file mode 100644
index 000000000000..f04c4243f9ad
--- /dev/null
+++ b/patches/node-v12.14.1/series
@@ -0,0 +1,5 @@
+# generated by git-ptx-patches
+#tag:base --start-number 1
+0001-Disable-running-gyp-on-shared-deps.patch
+0002-Install-both-binaries-and-use-libdir.patch
+# b42ea3192f53366dd53d306dcc1bec97  - git-ptx-patches magic
diff --git a/patches/npmbox-2.6.1/0001-npmbox-add-build-from-source-option-to-npmunbox.patch b/patches/npmbox-2.6.1/0001-npmbox-add-build-from-source-option-to-npmunbox.patch
deleted file mode 100644
index 1e34b0dd3eba..000000000000
--- a/patches/npmbox-2.6.1/0001-npmbox-add-build-from-source-option-to-npmunbox.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From: Michael Grzeschik <m.grzeschik@pengutronix.de>
-Date: Wed, 22 Jul 2015 18:18:59 +0200
-Subject: [PATCH] npmbox: add build from source option to npmunbox
-
-Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
----
- lib/node_modules/npmbox/npmunbox.js | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/lib/node_modules/npmbox/npmunbox.js b/lib/node_modules/npmbox/npmunbox.js
-index 66d6ef3..1cdc375 100644
---- a/lib/node_modules/npmbox/npmunbox.js
-+++ b/lib/node_modules/npmbox/npmunbox.js
-@@ -43,6 +43,7 @@ if (args.length<1 || argv.help) {
- 	console.log("  -O, -save-optional   npm --save-optional swtich.");
- 	console.log("  -B, -save-bundle     npm --save-bundle swtich.");
- 	console.log("  -E, -save-exact      npm --save-exact swtich.");
-+	console.log("  -b, -build-from-source      npm --build-from-source swtich.");
- 	console.log("");
- 	process.exit(0);
- }
-@@ -55,7 +56,8 @@ var options = {
- 	"save-dev": argv.D || argv["save-dev"] || false,
- 	"save-optional": argv.O || argv["save-optional"] || false,
- 	"save-bundle": argv.B || argv["save-bundle"] || false,
--	"save-exact": argv.E || argv["save-exact"] || false
-+	"save-exact": argv.E || argv["save-exact"] || false,
-+	"build-from-source": argv.b || argv["build-from-source"] || false
- };
- if (argv.C || argv.prefix) options.prefix = argv.C || argv.prefix;
- 
diff --git a/patches/npmbox-2.6.1/series b/patches/npmbox-2.6.1/series
deleted file mode 100644
index 0e8cfa98b0d9..000000000000
--- a/patches/npmbox-2.6.1/series
+++ /dev/null
@@ -1,4 +0,0 @@
-# generated by git-ptx-patches
-#tag:base --start-number 1
-0001-npmbox-add-build-from-source-option-to-npmunbox.patch
-# 1fc845f15dff1b0b44df5cf3183e8d63  - git-ptx-patches magic
diff --git a/rules/host-nodejs.in b/rules/host-nodejs.in
index 6ea0dd519c96..527e7d427bee 100644
--- a/rules/host-nodejs.in
+++ b/rules/host-nodejs.in
@@ -3,4 +3,6 @@
 config HOST_NODEJS
 	tristate
 	default y if ALLYES
+	select HOST_C_ARES
 	select HOST_OPENSSL
+	select HOST_ZLIB
diff --git a/rules/host-nodejs.make b/rules/host-nodejs.make
index 432cf930c714..c24ee8572468 100644
--- a/rules/host-nodejs.make
+++ b/rules/host-nodejs.make
@@ -1,6 +1,7 @@
 # -*-makefile-*-
 #
 # Copyright (C) 2015 by Michael Grzeschik <mgr@pengutronix.de>
+# Copyright (C) 2019 by Björn Esser <bes@pengutronix.de>
 #
 # For further information about the PTXdist project and license conditions
 # see the README file.
@@ -11,32 +12,27 @@
 #
 HOST_PACKAGES-$(PTXCONF_HOST_NODEJS) += host-nodejs
 
-#
-# Paths and names
-#
-HOST_NODEJS_NPMBOX_VERSION	:= 2.6.1
-HOST_NODEJS_NPMBOX_MD5		:= 2779b99e3427cd49bbf28a236d871028
-HOST_NODEJS_NPMBOX		:= npmbox-$(HOST_NODEJS_NPMBOX_VERSION)
-HOST_NODEJS_NPMBOX_SUFFIX	:= tar.bz2
-HOST_NODEJS_NPMBOX_URL		:= http://www.pengutronix.de/software/ptxdist/temporary-src/$(HOST_NODEJS_NPMBOX).$(HOST_NODEJS_NPMBOX_SUFFIX)
-HOST_NODEJS_NPMBOX_SOURCE	:= $(SRCDIR)/$(HOST_NODEJS_NPMBOX).$(HOST_NODEJS_NPMBOX_SUFFIX)
-$(HOST_NODEJS_NPMBOX_SOURCE)	:= HOST_NODEJS_NPMBOX
-HOST_NODEJS_NPMBOX_DIR		= $(HOST_NODEJS_PKGDIR)
-HOST_NODEJS_NPMBOX_STRIP_LEVEL	:= 0
-
-HOST_NODEJS_SOURCES		+= $(HOST_NODEJS_NPMBOX_SOURCE)
+# Always run the preprocessor locally.
+HOST_NODEJS_COMPILE_ENV	:= \
+	ICECC_REMOTE_CPP=0
 
 # ----------------------------------------------------------------------------
 # Prepare
 # ----------------------------------------------------------------------------
 
-HOST_NODEJS_CONF_TOOL := autoconf
-HOST_NODEJS_CONF_OPT := \
+HOST_NODEJS_CONF_TOOL	:= autoconf
+HOST_NODEJS_CONF_OPT	:= \
 	$(HOST_AUTOCONF) \
 	--prefix=/ \
+	--no-cross-compiling \
 	--dest-os=linux \
+	--without-dtrace \
+	--without-etw \
+	--without-npm \
+	--shared \
 	--shared-openssl \
 	--shared-zlib \
+	--shared-cares \
 	--with-intl=none \
 	--without-snapshot
 
@@ -47,10 +43,13 @@ HOST_NODEJS_CONF_OPT := \
 $(STATEDIR)/host-nodejs.install:
 	@$(call targetinfo)
 	@$(call install, HOST_NODEJS)
-	@sed "1s^.*^#\!/usr/bin/env node^g" \
-		-i $(HOST_NODEJS_PKGDIR)/lib/node_modules/npm/bin/npm-cli.js
-	@$(call extract, HOST_NODEJS_NPMBOX)
-	@$(call world/patchin, HOST_NODEJS_NPMBOX)
+
+#	# Needed to cross-compile for target.
+	@install -pm 0755 $(HOST_NODEJS_DIR)/out/Release/bytecode_builtins_list_generator $(HOST_NODEJS_PKGDIR)/bin/
+	@install -pm 0755 $(HOST_NODEJS_DIR)/out/Release/mkcodecache $(HOST_NODEJS_PKGDIR)/bin/
+	@install -pm 0755 $(HOST_NODEJS_DIR)/out/Release/node_mksnapshot $(HOST_NODEJS_PKGDIR)/bin/
+	@install -pm 0755 $(HOST_NODEJS_DIR)/out/Release/torque $(HOST_NODEJS_PKGDIR)/bin/
+
 	@$(call touch)
 
 # vim: syntax=make
diff --git a/rules/nodejs.in b/rules/nodejs.in
index e4ac11568bcc..6d23f94ef8b7 100644
--- a/rules/nodejs.in
+++ b/rules/nodejs.in
@@ -1,48 +1,20 @@
-## SECTION=staging
-## old section:
-### SECTION=bytecode_engines
+## SECTION=bytecode_engines
 
 menuconfig NODEJS
 	tristate
-	prompt "nodejs                        "
+	prompt "Node.js                       "
 	select HOST_NODEJS
+	select C_ARES
+	select LIBUV
 	select OPENSSL
 	select ZLIB
 	help
-	  evented I/O for V8 javascript
-
-	  Node.js is a platform built on Chrome's JavaScript runtime
-	  for easily building fast, scalable network
-	  applications. Node.js uses an event-driven, non-blocking I/O
-	  model that makes it lightweight and efficient, perfect for
-	  data-intensive real-time applications that run across
-	  distributed devices.
-
-	  STAGING: remove in ptxdist-2020.06.0
-	  Old version that need to be updated. Fails to build with gcc >= 7.x.
-
-
-if NODEJS
-
-config NODEJS_NPM
-	bool
-	prompt "install npm on target"
-
-config NODEJS_MODULE_LIST
-	string
-	prompt "install nodejs packages"
-	help
-	  A list of Node.js packages including version (e.g. express@4.13.0).
-	  'ptxdist make nodejs-get' will download the packages and create a
-	  npmbox file for each package. Note: The packages are stored in
-	  local_src/ and should be part of the BSP. Downloading a package
-	  again may result in different content.
-
-config NODEJS_MODULE_MD5
-	string
-	prompt "nodejs packages md5 sums"
-	help
-	  A md5 sum for each npmbox file of the packages listed in
-	  NODEJS_MODULE_LIST.
-
-endif
+	  Node.js is an open-source, cross-platform, JavaScript runtime
+	  environment that executes JavaScript code outside of a browser.
+	  Node.js lets developers use JavaScript to write command line
+	  tools and for server-side scripting—running scripts server-side
+	  to produce dynamic web page content before the page is sent to
+	  the user's web browser. Consequently, Node.js represents a
+	  "JavaScript everywhere" paradigm, unifying web-application
+	  development around a single programming language, rather than
+	  different languages for server- and client-side scripts.
diff --git a/rules/nodejs.make b/rules/nodejs.make
index 03098b18080c..a9433bd0687a 100644
--- a/rules/nodejs.make
+++ b/rules/nodejs.make
@@ -1,6 +1,7 @@
 # -*-makefile-*-
 #
 # Copyright (C) 2015 by Michael Grzeschik <mgr@pengutronix.de>
+# Copyright (C) 2019 by Björn Esser <bes@pengutronix.de>
 #
 # For further information about the PTXdist project and license conditions
 # see the README file.
@@ -16,19 +17,24 @@ endif
 #
 # Paths and names
 #
-NODEJS_VERSION	:= v6.9.5
-NODEJS_MD5	:= a2a820b797fb69ffb259b479c7f5df32
-NODEJS		:= node-$(NODEJS_VERSION)
-NODEJS_SUFFIX	:= tar.gz
-NODEJS_URL	:= http://nodejs.org/dist/$(NODEJS_VERSION)/$(NODEJS).$(NODEJS_SUFFIX)
-NODEJS_SOURCE	:= $(SRCDIR)/$(NODEJS).$(NODEJS_SUFFIX)
-NODEJS_DIR	:= $(BUILDDIR)/$(NODEJS)
-NODEJS_LICENSE	:= unknown
-
-NODEJS_SRCDIR		:= $(PTXDIST_WORKSPACE)/local_src
-NODEJS_MODULE_LIST	:= $(call remove_quotes, $(PTXCONF_NODEJS_MODULE_LIST))
-NODEJS_NPMBOXES		:= $(foreach module,$(NODEJS_MODULE_LIST), \
-	$(addprefix $(NODEJS_SRCDIR)/,$(addsuffix .npmbox,$(module))))
+NODEJS_VERSION		:= v12.14.1
+NODEJS_MD5		:= 1c78a75f5c95321f533ecccca695e814
+NODEJS			:= node-$(NODEJS_VERSION)
+NODEJS_SUFFIX		:= tar.xz
+NODEJS_URL		:= http://nodejs.org/dist/$(NODEJS_VERSION)/$(NODEJS).$(NODEJS_SUFFIX)
+NODEJS_SOURCE		:= $(SRCDIR)/$(NODEJS).$(NODEJS_SUFFIX)
+NODEJS_DIR		:= $(BUILDDIR)/$(NODEJS)
+NODEJS_LICENSE		:= MIT
+NODEJS_LICENSE_FILES	:= \
+        file://LICENSE;md5=be4d5107c64dc3d7c57e3797e1a0674b
+
+NODEJS_HOST_TOOLS	:= \
+	bytecode_builtins_list_generator \
+	gen-regexp-special-case \
+	mkcodecache \
+	mksnapshot \
+	node_mksnapshot \
+	torque
 
 node/env = \
 	$(CROSS_ENV) \
@@ -39,47 +45,6 @@ node/env = \
 	npm_config_nodedir=$(NODEJS_DIR) \
 	$(1)
 
-# remove version number from package string
-define rmversion
-$(shell echo $(1) | sed 's-\<\([^ @]*\)@[^ @]*\>-\1-g')
-endef
-
-# ----------------------------------------------------------------------------
-# Get
-# ----------------------------------------------------------------------------
-
-nodejs-get: $(NODEJS_NPMBOXES)
-PHONY += nodejs-get
-
-$(NODEJS_SRCDIR)/%.npmbox:| $(STATEDIR)/host-nodejs.install.post
-	@$(call targetinfo)
-	mkdir -p $(NODEJS_SRCDIR)
-	cd $(NODEJS_SRCDIR) && \
-		$(call node/env, npmbox $(*) --verbose)
-
-# Map package sources and md5sums for world/check_src
-NODEJS_MODULE_MD5	:= $(call remove_quotes, $(PTXCONF_NODEJS_MODULE_MD5))
-define def_mod
-$(call rmversion,$(1))_SOURCE	:= $(addprefix $(NODEJS_SRCDIR)/,$(addsuffix .npmbox,$(1)))
-$(call rmversion,$(1))_MD5	:= $(firstword $(NODEJS_MODULE_MD5))
-NODEJS_MODULE_MD5 := $(filter-out $(firstword $(NODEJS_MODULE_MD5)),$(NODEJS_MODULE_MD5))
-endef
-$(foreach module,$(NODEJS_MODULE_LIST),$(eval $(call def_mod,$(module))))
-
-$(STATEDIR)/nodejs.get:
-	@$(call targetinfo)
-	@$(call world/get, NODEJS)
-	@$(call world/check_src, NODEJS)
-	@$(foreach npmbox,$(NODEJS_NPMBOXES), \
-		if [ ! -e $(npmbox) ]; then \
-			echo "NodeJS modules must be downloaded with 'ptxdist make nodejs-get'"; \
-			echo ; \
-			exit 1; \
-		fi;)
-	@$(foreach module,$(NODEJS_MODULE_LIST), \
-		$(call world/check_src, $(call rmversion,$(module)))$(ptx/nl))
-	@$(call touch)
-
 # ----------------------------------------------------------------------------
 # Prepare
 # ----------------------------------------------------------------------------
@@ -99,33 +64,37 @@ NODEJS_ARM_FLOAT_ABI = $(shell ptxd_cross_cc_v | sed -n "s/COLLECT_GCC_OPTIONS=.
 NODEJS_ARM_FPU = $(shell ptxd_cross_cc_v | sed -n "s/COLLECT_GCC_OPTIONS=.*'-mfpu=\([^']*\)'.*/\1/p" | tail -n1)
 endif
 
-NODEJS_CONF_TOOL := autoconf
-# Use '=' to delay $(shell ...) calls until this is needed
-NODEJS_CONF_OPT = \
+NODEJS_CONF_OPT := \
 	--prefix=/usr \
 	--dest-cpu=$(NODEJS_ARCH) \
+	--no-cross-compiling \
 	--dest-os=linux \
 	$(call ptx/ifdef,PTXCONF_ARCH_ARM,--with-arm-float-abi=$(NODEJS_ARM_FLOAT_ABI)) \
 	$(call ptx/ifdef,PTXCONF_ARCH_ARM,--with-arm-fpu=$(NODEJS_ARM_FPU)) \
 	--without-dtrace \
-	$(call ptx/ifdef,PTXCONF_NODEJS_NPM,,--without-npm) \
+	--without-etw \
+	--without-npm \
+	--shared \
+	--shared-libuv \
 	--shared-openssl \
 	--shared-zlib \
+	--shared-cares \
 	--with-intl=none \
 	--without-snapshot
 
-# ----------------------------------------------------------------------------
-# Install
-# ----------------------------------------------------------------------------
-
-$(STATEDIR)/nodejs.install:
+$(STATEDIR)/nodejs.prepare:
 	@$(call targetinfo)
-	@$(call install, NODEJS)
-	@$(foreach npmbox, $(NODEJS_NPMBOXES), \
-		cd $(NODEJS_PKGDIR)/usr/lib/ && \
-		$(call node/env, npmunbox -build-from-source $(npmbox))$(ptx/nl))
-	@$(call touch)
 
+#	# Using a patch here isn't enough, as we need absolute paths
+#	# to the pre-built host tool binaries, which are different for
+#	# each individual checkout of a BSP.  -_-
+	$(foreach f,$(NODEJS_HOST_TOOLS), \
+		sed -i -e "s#<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)$(f)<(EXECUTABLE_SUFFIX)#$(PTXDIST_SYSROOT_HOST)/bin/$(f)#" \
+			$(NODEJS_DIR)/node.gyp $(NODEJS_DIR)/tools/v8_gypfiles/v8.gyp $(ptx/nl))
+
+	@$(call world/prepare, NODEJS)
+
+	@$(call touch)
 
 # ----------------------------------------------------------------------------
 # Target-Install
@@ -141,23 +110,11 @@ $(STATEDIR)/nodejs.targetinstall:
 	@$(call install_fixup, nodejs,DESCRIPTION,missing)
 
 	@$(call install_copy, nodejs, 0, 0, 0755, -, /usr/bin/node)
+	@$(call install_lib, nodejs, 0, 0, 0644, libnode)
 
 #	# the place node searches for packages
 	@$(call install_link, nodejs, node_modules, /usr/lib/node)
 
-ifdef PTXCONF_NODEJS_NPM
-	@$(call install_link, nodejs, ../lib/node_modules/npm/bin/npm-cli.js, /usr/bin/npm)
-	@$(call install_tree, nodejs, 0, 0, -, /usr/lib/node_modules/npm/lib/)
-	@$(call install_tree, nodejs, 0, 0, -, /usr/lib/node_modules/npm/bin)
-	@$(call install_tree, nodejs, 0, 0, -, /usr/lib/node_modules/npm/scripts)
-	@$(call install_tree, nodejs, 0, 0, -, /usr/lib/node_modules/npm/node_modules)
-	@$(call install_copy, nodejs, 0, 0, 0644, -, /usr/lib/node_modules/npm/package.json)
-endif
-
-ifneq ($(NODEJS_MODULE_LIST),)
-	@$(foreach module, $(call rmversion, $(NODEJS_MODULE_LIST)), \
-		$(call install_tree, nodejs, 0, 0, -, /usr/lib/node_modules/$(module))$(ptx/nl))
-endif
 	@$(call install_finish, nodejs)
 
 	@$(call touch)
-- 
2.25.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

* [ptxdist] [PATCH v5 2/3] host-yarn: new package
  2020-02-04  7:53 [ptxdist] [PATCH v5 1/3] nodejs: version bump 6.9.5 -> 12.14.1 LTS Ulrich Ölmann
@ 2020-02-04  7:53 ` Ulrich Ölmann
  2020-02-21  8:26   ` Juergen Borleis
  2020-02-04  7:53 ` [ptxdist] [PATCH v5 3/3] nodejs_packages: " Ulrich Ölmann
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: Ulrich Ölmann @ 2020-02-04  7:53 UTC (permalink / raw)
  To: PTXdist Development Mailing List

From: Björn Esser <b.esser@pengutronix.de>

Fast, reliable, and secure dependency management for Node.js.

We use Yarn to generate an offline cache and a lock-file to be able to install
all needed Node.js-packages reproducibly. This works even in environments
without internet-connectivity, as long as the cache and the lock-file are in
reach.

Signed-off-by: Björn Esser <b.esser@pengutronix.de>
[uol: adjusted commit message, dropped CREDIT line & wrapped install into call
of world/execute]
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
---
v3 --> v4: adjusted commit message
Range-diff of v5 against v4:
2:  c78fde2a6233 ! 2:  8b898ee41bae host-yarn: new package
    @@ Commit message
         reach.

         Signed-off-by: Björn Esser <b.esser@pengutronix.de>
    -    [uol: adjusted commit message]
    +    [uol: adjusted commit message, dropped CREDIT line & wrapped install into call
    +    of world/execute]
         Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>

      ## rules/host-yarn.in (new) ##
    @@ rules/host-yarn.make (new)
     +#
     +# Copyright (C) 2017 by Juergen Borleis <jbe@pengutronix.de>
     +#
    -+# See CREDITS for details about who has contributed to this project.
    -+#
     +# For further information about the PTXdist project and license conditions
     +# see the README file.
     +#
    @@ rules/host-yarn.make (new)
     +
     +$(STATEDIR)/host-yarn.install:
     +	@$(call targetinfo)
    -+	@install -pm 0755 $(HOST_YARN_SOURCE) $(PTXDIST_SYSROOT_HOST)/bin/yarn
    ++	@$(call world/execute, HOST_YARN, \
    ++		install -vDm 0755 $(HOST_YARN_SOURCE) \
    ++		$(HOST_YARN_PKGDIR)/bin/yarn)
     +	@$(call touch)
     +
     +# vim: syntax=make

 rules/host-yarn.in   |  6 +++++
 rules/host-yarn.make | 61 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 67 insertions(+)
 create mode 100644 rules/host-yarn.in
 create mode 100644 rules/host-yarn.make

diff --git a/rules/host-yarn.in b/rules/host-yarn.in
new file mode 100644
index 000000000000..d98dd6c34620
--- /dev/null
+++ b/rules/host-yarn.in
@@ -0,0 +1,6 @@
+## SECTION=hosttools_noprompt
+
+config HOST_YARN
+	tristate
+	default y if ALLYES
+	select HOST_NODEJS
diff --git a/rules/host-yarn.make b/rules/host-yarn.make
new file mode 100644
index 000000000000..16e04c05aee8
--- /dev/null
+++ b/rules/host-yarn.make
@@ -0,0 +1,61 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2017 by Juergen Borleis <jbe@pengutronix.de>
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+# 2019-May-05, Daniel Arnold, Updated to yarn 1.15.2
+# 2020-January-09, Björn Esser, Updated to yarn 1.21.1
+
+#
+# We provide this package
+#
+HOST_PACKAGES-$(PTXCONF_HOST_YARN) += host-yarn
+
+#
+# Paths and names
+#
+HOST_YARN_VERSION	:= 1.21.1
+HOST_YARN_MD5		:= cf49e663e0f56aa15f1740c77354ebe2
+HOST_YARN		:= yarn-$(HOST_YARN_VERSION)
+HOST_YARN_SUFFIX	:= js
+HOST_YARN_URL		:= https://github.com/yarnpkg/yarn/releases/download/v$(HOST_YARN_VERSION)/$(HOST_YARN).$(HOST_YARN_SUFFIX)
+HOST_YARN_SOURCE	:= $(SRCDIR)/$(HOST_YARN).$(HOST_YARN_SUFFIX)
+
+# ----------------------------------------------------------------------------
+# Extract (nothing to be done here)
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/host-yarn.extract:
+	@$(call targetinfo)
+	@$(call touch)
+
+# ----------------------------------------------------------------------------
+# Prepare (nothing to be done here)
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/host-yarn.prepare:
+	@$(call targetinfo)
+	@$(call touch)
+
+# ----------------------------------------------------------------------------
+# Compile (nothing to be done here)
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/host-yarn.compile:
+	@$(call targetinfo)
+	@$(call touch)
+
+# ----------------------------------------------------------------------------
+# Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/host-yarn.install:
+	@$(call targetinfo)
+	@$(call world/execute, HOST_YARN, \
+		install -vDm 0755 $(HOST_YARN_SOURCE) \
+		$(HOST_YARN_PKGDIR)/bin/yarn)
+	@$(call touch)
+
+# vim: syntax=make
-- 
2.25.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

* [ptxdist] [PATCH v5 3/3] nodejs_packages: new package
  2020-02-04  7:53 [ptxdist] [PATCH v5 1/3] nodejs: version bump 6.9.5 -> 12.14.1 LTS Ulrich Ölmann
  2020-02-04  7:53 ` [ptxdist] [PATCH v5 2/3] host-yarn: new package Ulrich Ölmann
@ 2020-02-04  7:53 ` Ulrich Ölmann
  2020-02-14 12:46   ` Michael Olbrich
  2020-02-17  9:40 ` [ptxdist] [PATCH v5 1/3] nodejs: version bump 6.9.5 -> 12.14.1 LTS Michael Olbrich
  2020-02-21  8:22 ` Juergen Borleis
  3 siblings, 1 reply; 11+ messages in thread
From: Ulrich Ölmann @ 2020-02-04  7:53 UTC (permalink / raw)
  To: PTXdist Development Mailing List

From: Björn Esser <b.esser@pengutronix.de>

This is a dummy package to specify and install required Node.js packages for the
target system.

The management of those packages and their dependencies is handled with
Yarn (run through host-nodejs) to maintain a reproducible offline cache that is
stored in local_src/nodejs_packages.

Signed-off-by: Björn Esser <b.esser@pengutronix.de>
[uol: adjusted commit message and Kconfig menu file's help texts, integrated
Kconfig symbol NODEJS_PACKAGES_LICENSE, fixed NODEJS_PACKAGES_URL, removed one
square bracket in a shell test and wrapped install/cp into call of execute and
world/execute]
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
---
v3 --> v4: adjusted commit message and Kconfig menu file's help texts & fixed
           NODEJS_PACKAGES_URL
Range-diff of v5 against v4:
3:  ccd2b44a8d92 ! 3:  1a73ebbd6e7e nodejs_packages: new package
    @@ Commit message
         stored in local_src/nodejs_packages.

         Signed-off-by: Björn Esser <b.esser@pengutronix.de>
    -    [uol: adjusted commit message and Kconfig menu file's help texts & fixed
    -    NODEJS_PACKAGES_URL]
    +    [uol: adjusted commit message and Kconfig menu file's help texts, integrated
    +    Kconfig symbol NODEJS_PACKAGES_LICENSE, fixed NODEJS_PACKAGES_URL, removed one
    +    square bracket in a shell test and wrapped install/cp into call of execute and
    +    world/execute]
         Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>

      ## rules/nodejs_packages.in (new) ##
    @@ rules/nodejs_packages.in (new)
     +
     +	  [1] https://legacy.yarnpkg.com/en/docs/dependency-versions/
     +
    ++config NODEJS_PACKAGES_LICENSE
    ++	string
    ++	prompt "Licenses of to be installed Node.js packages"
    ++	default "unknown"
    ++	help
    ++	  Manually compiled list of licenses that the to be installed Node.js
    ++	  packages are distributed under, see description of the variable
    ++	  *_LICENSE in [1].
    ++
    ++	  ATTENTION: be aware of the fact that Node.js packages usually depend
    ++	  on additional Node.js packages that Yarn installs as well and that
    ++	  this propagates recursively resulting in an unknown number of Node.js
    ++	  packages on the target with an unknown set of licenses that they may
    ++	  be utilized under. Hence you carefully need to examine all of them
    ++	  individually to create a reliable list of licenses.
    ++
    ++	  [1] https://www.ptxdist.org/doc/dev_manual.html#some-notes-about-licenses
    ++
     +config NODEJS_PACKAGES_OFFLINE
     +	bool
    -+	prompt "lock offline cache for offline/production use"
    ++	prompt "Lock offline cache for offline/production use"
     +	help
    -+	  This option locks the offline cache for installing the nodejs packages
    -+	  and allows their installation during the build of the BSP without any
    -+	  need for internet connectivity.
    ++	  This option locks the offline cache for installing the Node.js
    ++	  packages and allows their installation during the build of the BSP
    ++	  without any need for internet connectivity.
     +
     +	  Enabling this option is highly recommended for production use.
     +
    @@ rules/nodejs_packages.make (new)
     +NODEJS_PACKAGES_URL	:= lndir://$(PTXDIST_WORKSPACE)/$(NODEJS_PACKAGES_LOCAL)
     +NODEJS_PACKAGES_DIR	:= $(BUILDDIR)/$(NODEJS_PACKAGES)
     +NODEJS_PACKAGES_CACHE	:= $(PTXDIST_WORKSPACE)/$(NODEJS_PACKAGES_LOCAL)/yarn_cache
    -+NODEJS_PACKAGES_LICENSE	:= unknown
    ++NODEJS_PACKAGES_LICENSE	:= $(call remove_quotes, $(PTXCONF_NODEJS_PACKAGES_LICENSE))
     +
     +NODEJS_PACKAGES_LIST	:= $(call remove_quotes, $(PTXCONF_NODEJS_PACKAGES_LIST))
     +
    @@ rules/nodejs_packages.make (new)
     +		\"license\": \"UNLICENSED\", \
     +		\"private\": true \
     +	}" > $(NODEJS_PACKAGES_DIR)/package.json
    -+	if [[ ! -f $(YARN_LOCK) ]]; then \
    ++	if [ ! -f $(YARN_LOCK) ]; then \
     +		touch $(YARN_LOCK); \
     +		ln -fs $(YARN_LOCK) $(NODEJS_PACKAGES_DIR)/yarn.lock; \
     +	fi
    @@ rules/nodejs_packages.make (new)
     +
     +$(STATEDIR)/nodejs_packages.install:
     +	@$(call targetinfo)
    -+	install -dm 0755 $(NODEJS_PACKAGES_PKGDIR)/usr/lib
    -+	cp -pr $(NODEJS_PACKAGES_DIR)/node_modules $(NODEJS_PACKAGES_PKGDIR)/usr/lib
    ++	@$(call world/execute, HOST_UA_NODESET, \
    ++		install -dm 0755 $(NODEJS_PACKAGES_PKGDIR)/usr/lib)
    ++	@$(call execute, HOST_UA_NODESET, \
    ++		cp -pr $(NODEJS_PACKAGES_DIR)/node_modules \
    ++			$(NODEJS_PACKAGES_PKGDIR)/usr/lib)
     +	@$(call touch)
     +
     +# ----------------------------------------------------------------------------

 rules/nodejs_packages.in   | 73 ++++++++++++++++++++++++++++++
 rules/nodejs_packages.make | 93 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 166 insertions(+)
 create mode 100644 rules/nodejs_packages.in
 create mode 100644 rules/nodejs_packages.make

diff --git a/rules/nodejs_packages.in b/rules/nodejs_packages.in
new file mode 100644
index 000000000000..aea44205da41
--- /dev/null
+++ b/rules/nodejs_packages.in
@@ -0,0 +1,73 @@
+## SECTION=bytecode_engines
+
+menuconfig NODEJS_PACKAGES
+	tristate
+	select HOST_YARN
+	select NODEJS
+	prompt "Node.js packages (target)     "
+	help
+	  Reproducibly install Node.js packages that will be available
+	  system-wide on the target.
+
+	  You MUST specify at least one Node.js package in the submenu that is
+	  shown after enabling this option.
+
+
+if NODEJS_PACKAGES
+
+config NODEJS_PACKAGES_LIST
+	string
+	prompt "Node.js packages to install"
+	help
+	  A white-space separated list of Node.js packages including their
+	  versions (e.g. express@4.17.x or socket.io@'>=2.1.0 <=2.3.0'). NPM
+	  semvers are fully supported, see [1].
+
+	  The packages are managed with Yarn and are guaranteed to be
+	  reproducible and immutable as long as the download location stays
+	  accessible or the offline cache is not altered.
+
+	  If the list of Node.js packages to be installed has been populated for
+	  the first time or if it has been modified later on one needs to
+	  (re-)build this package to download the desired Node.js packages and
+	  update the offline cache. Afterwards it is highly recommended to
+	  commit the path '${PTXDIST_WORKSPACE}/local_src/nodejs_packages/' into
+	  the version control system and to lock the package cache.
+
+	  As a prerequisite the path '${PTXDIST_WORKSPACE}/local_src/nodejs_
+	  packages/' must exist in the BSP *before* building this package.
+
+	  [1] https://legacy.yarnpkg.com/en/docs/dependency-versions/
+
+config NODEJS_PACKAGES_LICENSE
+	string
+	prompt "Licenses of to be installed Node.js packages"
+	default "unknown"
+	help
+	  Manually compiled list of licenses that the to be installed Node.js
+	  packages are distributed under, see description of the variable
+	  *_LICENSE in [1].
+
+	  ATTENTION: be aware of the fact that Node.js packages usually depend
+	  on additional Node.js packages that Yarn installs as well and that
+	  this propagates recursively resulting in an unknown number of Node.js
+	  packages on the target with an unknown set of licenses that they may
+	  be utilized under. Hence you carefully need to examine all of them
+	  individually to create a reliable list of licenses.
+
+	  [1] https://www.ptxdist.org/doc/dev_manual.html#some-notes-about-licenses
+
+config NODEJS_PACKAGES_OFFLINE
+	bool
+	prompt "Lock offline cache for offline/production use"
+	help
+	  This option locks the offline cache for installing the Node.js
+	  packages and allows their installation during the build of the BSP
+	  without any need for internet connectivity.
+
+	  Enabling this option is highly recommended for production use.
+
+	  Do NOT forget to commit the path '${PTXDIST_WORKSPACE}/local_src/
+	  nodejs_packages/' into the BSP's version control system!
+
+endif
diff --git a/rules/nodejs_packages.make b/rules/nodejs_packages.make
new file mode 100644
index 000000000000..cdde30f38b0c
--- /dev/null
+++ b/rules/nodejs_packages.make
@@ -0,0 +1,93 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2020 by Bjoern Esser <bes@pengutronix.de>
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+PACKAGES-$(PTXCONF_NODEJS_PACKAGES) += nodejs_packages
+
+#
+# Paths and names
+#
+NODEJS_PACKAGES_VERSION	:= 0.0.1
+NODEJS_PACKAGES		:= nodejs_packages-$(NODEJS_PACKAGES_VERSION)
+NODEJS_PACKAGES_LOCAL	:= local_src/nodejs_packages
+NODEJS_PACKAGES_URL	:= lndir://$(PTXDIST_WORKSPACE)/$(NODEJS_PACKAGES_LOCAL)
+NODEJS_PACKAGES_DIR	:= $(BUILDDIR)/$(NODEJS_PACKAGES)
+NODEJS_PACKAGES_CACHE	:= $(PTXDIST_WORKSPACE)/$(NODEJS_PACKAGES_LOCAL)/yarn_cache
+NODEJS_PACKAGES_LICENSE	:= $(call remove_quotes, $(PTXCONF_NODEJS_PACKAGES_LICENSE))
+
+NODEJS_PACKAGES_LIST	:= $(call remove_quotes, $(PTXCONF_NODEJS_PACKAGES_LIST))
+
+YARN_LOCK	:= $(PTXDIST_WORKSPACE)/$(NODEJS_PACKAGES_LOCAL)/yarn.lock
+YARN_OPTS	:= \
+	--cwd "$(NODEJS_PACKAGES_DIR)" \
+	--cache-folder "$(NODEJS_PACKAGES_CACHE)" \
+	--link-duplicates \
+	--production=true
+
+ifdef PTXCONF_NODEJS_PACKAGES_OFFLINE
+YARN_OPTS	+= \
+	--frozen-lockfile \
+	--offline
+endif
+
+# ----------------------------------------------------------------------------
+# Compile
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/nodejs_packages.compile:
+	@$(call targetinfo)
+	mkdir -p $(NODEJS_PACKAGES_CACHE)
+	printf "{ \
+		\"name\": \"nodejs_packages\", \
+		\"version\": \"$(NODEJS_PACKAGES_VERSION)\", \
+		\"license\": \"UNLICENSED\", \
+		\"private\": true \
+	}" > $(NODEJS_PACKAGES_DIR)/package.json
+	if [ ! -f $(YARN_LOCK) ]; then \
+		touch $(YARN_LOCK); \
+		ln -fs $(YARN_LOCK) $(NODEJS_PACKAGES_DIR)/yarn.lock; \
+	fi
+	yarn $(YARN_OPTS) add $(NODEJS_PACKAGES_LIST)
+	find $(NODEJS_PACKAGES_CACHE) -type f -name '.yarn-tarball.tgz' -delete
+	@$(call touch)
+
+# ----------------------------------------------------------------------------
+# Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/nodejs_packages.install:
+	@$(call targetinfo)
+	@$(call world/execute, HOST_UA_NODESET, \
+		install -dm 0755 $(NODEJS_PACKAGES_PKGDIR)/usr/lib)
+	@$(call execute, HOST_UA_NODESET, \
+		cp -pr $(NODEJS_PACKAGES_DIR)/node_modules \
+			$(NODEJS_PACKAGES_PKGDIR)/usr/lib)
+	@$(call touch)
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/nodejs_packages.targetinstall:
+	@$(call targetinfo)
+
+	@$(call install_init, nodejs_packages)
+	@$(call install_fixup, nodejs_packages,PRIORITY,optional)
+	@$(call install_fixup, nodejs_packages,SECTION,base)
+	@$(call install_fixup, nodejs_packages,AUTHOR,"Bjoern Esser <bes@pengutronix.de>")
+	@$(call install_fixup, nodejs_packages,DESCRIPTION,missing)
+
+	$(call install_tree, nodejs_packages, 0, 0, -, /usr/lib/node_modules/)
+
+	@$(call install_finish, nodejs_packages)
+
+	@$(call touch)
+
+# vim: syntax=make
-- 
2.25.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] [PATCH v5 3/3] nodejs_packages: new package
  2020-02-04  7:53 ` [ptxdist] [PATCH v5 3/3] nodejs_packages: " Ulrich Ölmann
@ 2020-02-14 12:46   ` Michael Olbrich
  2020-03-18 15:48     ` Ulrich Ölmann
  0 siblings, 1 reply; 11+ messages in thread
From: Michael Olbrich @ 2020-02-14 12:46 UTC (permalink / raw)
  To: ptxdist

On Tue, Feb 04, 2020 at 08:53:59AM +0100, Ulrich Ölmann wrote:
> From: Björn Esser <b.esser@pengutronix.de>
> 
> This is a dummy package to specify and install required Node.js packages for the
> target system.
> 
> The management of those packages and their dependencies is handled with
> Yarn (run through host-nodejs) to maintain a reproducible offline cache that is
> stored in local_src/nodejs_packages.
> 
> Signed-off-by: Björn Esser <b.esser@pengutronix.de>
> [uol: adjusted commit message and Kconfig menu file's help texts, integrated
> Kconfig symbol NODEJS_PACKAGES_LICENSE, fixed NODEJS_PACKAGES_URL, removed one
> square bracket in a shell test and wrapped install/cp into call of execute and
> world/execute]
> Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
> ---
> v3 --> v4: adjusted commit message and Kconfig menu file's help texts & fixed
>            NODEJS_PACKAGES_URL
> Range-diff of v5 against v4:
> 3:  ccd2b44a8d92 ! 3:  1a73ebbd6e7e nodejs_packages: new package
>     @@ Commit message
>          stored in local_src/nodejs_packages.
> 
>          Signed-off-by: Björn Esser <b.esser@pengutronix.de>
>     -    [uol: adjusted commit message and Kconfig menu file's help texts & fixed
>     -    NODEJS_PACKAGES_URL]
>     +    [uol: adjusted commit message and Kconfig menu file's help texts, integrated
>     +    Kconfig symbol NODEJS_PACKAGES_LICENSE, fixed NODEJS_PACKAGES_URL, removed one
>     +    square bracket in a shell test and wrapped install/cp into call of execute and
>     +    world/execute]
>          Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
> 
>       ## rules/nodejs_packages.in (new) ##
>     @@ rules/nodejs_packages.in (new)
>      +
>      +	  [1] https://legacy.yarnpkg.com/en/docs/dependency-versions/
>      +
>     ++config NODEJS_PACKAGES_LICENSE
>     ++	string
>     ++	prompt "Licenses of to be installed Node.js packages"
>     ++	default "unknown"
>     ++	help
>     ++	  Manually compiled list of licenses that the to be installed Node.js
>     ++	  packages are distributed under, see description of the variable
>     ++	  *_LICENSE in [1].
>     ++
>     ++	  ATTENTION: be aware of the fact that Node.js packages usually depend
>     ++	  on additional Node.js packages that Yarn installs as well and that
>     ++	  this propagates recursively resulting in an unknown number of Node.js
>     ++	  packages on the target with an unknown set of licenses that they may
>     ++	  be utilized under. Hence you carefully need to examine all of them
>     ++	  individually to create a reliable list of licenses.
>     ++
>     ++	  [1] https://www.ptxdist.org/doc/dev_manual.html#some-notes-about-licenses
>     ++
>      +config NODEJS_PACKAGES_OFFLINE
>      +	bool
>     -+	prompt "lock offline cache for offline/production use"
>     ++	prompt "Lock offline cache for offline/production use"
>      +	help
>     -+	  This option locks the offline cache for installing the nodejs packages
>     -+	  and allows their installation during the build of the BSP without any
>     -+	  need for internet connectivity.
>     ++	  This option locks the offline cache for installing the Node.js
>     ++	  packages and allows their installation during the build of the BSP
>     ++	  without any need for internet connectivity.
>      +
>      +	  Enabling this option is highly recommended for production use.
>      +
>     @@ rules/nodejs_packages.make (new)
>      +NODEJS_PACKAGES_URL	:= lndir://$(PTXDIST_WORKSPACE)/$(NODEJS_PACKAGES_LOCAL)
>      +NODEJS_PACKAGES_DIR	:= $(BUILDDIR)/$(NODEJS_PACKAGES)
>      +NODEJS_PACKAGES_CACHE	:= $(PTXDIST_WORKSPACE)/$(NODEJS_PACKAGES_LOCAL)/yarn_cache
>     -+NODEJS_PACKAGES_LICENSE	:= unknown
>     ++NODEJS_PACKAGES_LICENSE	:= $(call remove_quotes, $(PTXCONF_NODEJS_PACKAGES_LICENSE))
>      +
>      +NODEJS_PACKAGES_LIST	:= $(call remove_quotes, $(PTXCONF_NODEJS_PACKAGES_LIST))
>      +
>     @@ rules/nodejs_packages.make (new)
>      +		\"license\": \"UNLICENSED\", \
>      +		\"private\": true \
>      +	}" > $(NODEJS_PACKAGES_DIR)/package.json
>     -+	if [[ ! -f $(YARN_LOCK) ]]; then \
>     ++	if [ ! -f $(YARN_LOCK) ]; then \
>      +		touch $(YARN_LOCK); \
>      +		ln -fs $(YARN_LOCK) $(NODEJS_PACKAGES_DIR)/yarn.lock; \
>      +	fi
>     @@ rules/nodejs_packages.make (new)
>      +
>      +$(STATEDIR)/nodejs_packages.install:
>      +	@$(call targetinfo)
>     -+	install -dm 0755 $(NODEJS_PACKAGES_PKGDIR)/usr/lib
>     -+	cp -pr $(NODEJS_PACKAGES_DIR)/node_modules $(NODEJS_PACKAGES_PKGDIR)/usr/lib
>     ++	@$(call world/execute, HOST_UA_NODESET, \
>     ++		install -dm 0755 $(NODEJS_PACKAGES_PKGDIR)/usr/lib)
>     ++	@$(call execute, HOST_UA_NODESET, \
>     ++		cp -pr $(NODEJS_PACKAGES_DIR)/node_modules \
>     ++			$(NODEJS_PACKAGES_PKGDIR)/usr/lib)
>      +	@$(call touch)
>      +
>      +# ----------------------------------------------------------------------------
> 
>  rules/nodejs_packages.in   | 73 ++++++++++++++++++++++++++++++
>  rules/nodejs_packages.make | 93 ++++++++++++++++++++++++++++++++++++++
>  2 files changed, 166 insertions(+)
>  create mode 100644 rules/nodejs_packages.in
>  create mode 100644 rules/nodejs_packages.make
> 
> diff --git a/rules/nodejs_packages.in b/rules/nodejs_packages.in
> new file mode 100644
> index 000000000000..aea44205da41
> --- /dev/null
> +++ b/rules/nodejs_packages.in
> @@ -0,0 +1,73 @@
> +## SECTION=bytecode_engines
> +
> +menuconfig NODEJS_PACKAGES
> +	tristate
> +	select HOST_YARN
> +	select NODEJS
> +	prompt "Node.js packages (target)     "
> +	help
> +	  Reproducibly install Node.js packages that will be available
> +	  system-wide on the target.
> +
> +	  You MUST specify at least one Node.js package in the submenu that is
> +	  shown after enabling this option.
> +
> +
> +if NODEJS_PACKAGES
> +
> +config NODEJS_PACKAGES_LIST
> +	string
> +	prompt "Node.js packages to install"
> +	help
> +	  A white-space separated list of Node.js packages including their
> +	  versions (e.g. express@4.17.x or socket.io@'>=2.1.0 <=2.3.0'). NPM
> +	  semvers are fully supported, see [1].
> +
> +	  The packages are managed with Yarn and are guaranteed to be
> +	  reproducible and immutable as long as the download location stays
> +	  accessible or the offline cache is not altered.
> +
> +	  If the list of Node.js packages to be installed has been populated for
> +	  the first time or if it has been modified later on one needs to
> +	  (re-)build this package to download the desired Node.js packages and
> +	  update the offline cache. Afterwards it is highly recommended to
> +	  commit the path '${PTXDIST_WORKSPACE}/local_src/nodejs_packages/' into
> +	  the version control system and to lock the package cache.
> +
> +	  As a prerequisite the path '${PTXDIST_WORKSPACE}/local_src/nodejs_
> +	  packages/' must exist in the BSP *before* building this package.
> +
> +	  [1] https://legacy.yarnpkg.com/en/docs/dependency-versions/
> +
> +config NODEJS_PACKAGES_LICENSE
> +	string
> +	prompt "Licenses of to be installed Node.js packages"
> +	default "unknown"
> +	help
> +	  Manually compiled list of licenses that the to be installed Node.js
> +	  packages are distributed under, see description of the variable
> +	  *_LICENSE in [1].
> +
> +	  ATTENTION: be aware of the fact that Node.js packages usually depend
> +	  on additional Node.js packages that Yarn installs as well and that
> +	  this propagates recursively resulting in an unknown number of Node.js
> +	  packages on the target with an unknown set of licenses that they may
> +	  be utilized under. Hence you carefully need to examine all of them
> +	  individually to create a reliable list of licenses.
> +
> +	  [1] https://www.ptxdist.org/doc/dev_manual.html#some-notes-about-licenses
> +
> +config NODEJS_PACKAGES_OFFLINE
> +	bool
> +	prompt "Lock offline cache for offline/production use"
> +	help
> +	  This option locks the offline cache for installing the Node.js
> +	  packages and allows their installation during the build of the BSP
> +	  without any need for internet connectivity.
> +
> +	  Enabling this option is highly recommended for production use.
> +
> +	  Do NOT forget to commit the path '${PTXDIST_WORKSPACE}/local_src/
> +	  nodejs_packages/' into the BSP's version control system!
> +
> +endif
> diff --git a/rules/nodejs_packages.make b/rules/nodejs_packages.make
> new file mode 100644
> index 000000000000..cdde30f38b0c
> --- /dev/null
> +++ b/rules/nodejs_packages.make
> @@ -0,0 +1,93 @@
> +# -*-makefile-*-
> +#
> +# Copyright (C) 2020 by Bjoern Esser <bes@pengutronix.de>
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +#
> +# We provide this package
> +#
> +PACKAGES-$(PTXCONF_NODEJS_PACKAGES) += nodejs_packages
> +
> +#
> +# Paths and names
> +#
> +NODEJS_PACKAGES_VERSION	:= 0.0.1
> +NODEJS_PACKAGES		:= nodejs_packages-$(NODEJS_PACKAGES_VERSION)
> +NODEJS_PACKAGES_LOCAL	:= local_src/nodejs_packages
> +NODEJS_PACKAGES_URL	:= lndir://$(PTXDIST_WORKSPACE)/$(NODEJS_PACKAGES_LOCAL)
> +NODEJS_PACKAGES_DIR	:= $(BUILDDIR)/$(NODEJS_PACKAGES)
> +NODEJS_PACKAGES_CACHE	:= $(PTXDIST_WORKSPACE)/$(NODEJS_PACKAGES_LOCAL)/yarn_cache
> +NODEJS_PACKAGES_LICENSE	:= $(call remove_quotes, $(PTXCONF_NODEJS_PACKAGES_LICENSE))
> +
> +NODEJS_PACKAGES_LIST	:= $(call remove_quotes, $(PTXCONF_NODEJS_PACKAGES_LIST))
> +
> +YARN_LOCK	:= $(PTXDIST_WORKSPACE)/$(NODEJS_PACKAGES_LOCAL)/yarn.lock
> +YARN_OPTS	:= \
> +	--cwd "$(NODEJS_PACKAGES_DIR)" \
> +	--cache-folder "$(NODEJS_PACKAGES_CACHE)" \
> +	--link-duplicates \
> +	--production=true
> +
> +ifdef PTXCONF_NODEJS_PACKAGES_OFFLINE
> +YARN_OPTS	+= \
> +	--frozen-lockfile \
> +	--offline
> +endif
> +
> +# ----------------------------------------------------------------------------
> +# Compile
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/nodejs_packages.compile:
> +	@$(call targetinfo)
> +	mkdir -p $(NODEJS_PACKAGES_CACHE)
> +	printf "{ \
> +		\"name\": \"nodejs_packages\", \
> +		\"version\": \"$(NODEJS_PACKAGES_VERSION)\", \
> +		\"license\": \"UNLICENSED\", \
> +		\"private\": true \
> +	}" > $(NODEJS_PACKAGES_DIR)/package.json
> +	if [ ! -f $(YARN_LOCK) ]; then \
> +		touch $(YARN_LOCK); \
> +		ln -fs $(YARN_LOCK) $(NODEJS_PACKAGES_DIR)/yarn.lock; \
> +	fi

I think we should fail here if NODEJS_PACKAGES_OFFLINE is set and the lock
file is missing. Or will yarn produce a sensible error message in this
case?

> +	yarn $(YARN_OPTS) add $(NODEJS_PACKAGES_LIST)
> +	find $(NODEJS_PACKAGES_CACHE) -type f -name '.yarn-tarball.tgz' -delete
> +	@$(call touch)
> +
> +# ----------------------------------------------------------------------------
> +# Install
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/nodejs_packages.install:
> +	@$(call targetinfo)
> +	@$(call world/execute, HOST_UA_NODESET, \
> +		install -dm 0755 $(NODEJS_PACKAGES_PKGDIR)/usr/lib)

add -v to make it visible at runtime.

> +	@$(call execute, HOST_UA_NODESET, \
> +		cp -pr $(NODEJS_PACKAGES_DIR)/node_modules \
> +			$(NODEJS_PACKAGES_PKGDIR)/usr/lib)

Here as well.

Michael

> +	@$(call touch)
> +
> +# ----------------------------------------------------------------------------
> +# Target-Install
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/nodejs_packages.targetinstall:
> +	@$(call targetinfo)
> +
> +	@$(call install_init, nodejs_packages)
> +	@$(call install_fixup, nodejs_packages,PRIORITY,optional)
> +	@$(call install_fixup, nodejs_packages,SECTION,base)
> +	@$(call install_fixup, nodejs_packages,AUTHOR,"Bjoern Esser <bes@pengutronix.de>")
> +	@$(call install_fixup, nodejs_packages,DESCRIPTION,missing)
> +
> +	$(call install_tree, nodejs_packages, 0, 0, -, /usr/lib/node_modules/)
> +
> +	@$(call install_finish, nodejs_packages)
> +
> +	@$(call touch)
> +
> +# vim: syntax=make
> -- 
> 2.25.0
> 
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] [PATCH v5 1/3] nodejs: version bump 6.9.5 -> 12.14.1 LTS
  2020-02-04  7:53 [ptxdist] [PATCH v5 1/3] nodejs: version bump 6.9.5 -> 12.14.1 LTS Ulrich Ölmann
  2020-02-04  7:53 ` [ptxdist] [PATCH v5 2/3] host-yarn: new package Ulrich Ölmann
  2020-02-04  7:53 ` [ptxdist] [PATCH v5 3/3] nodejs_packages: " Ulrich Ölmann
@ 2020-02-17  9:40 ` Michael Olbrich
  2020-03-18 15:44   ` Ulrich Ölmann
  2020-02-21  8:22 ` Juergen Borleis
  3 siblings, 1 reply; 11+ messages in thread
From: Michael Olbrich @ 2020-02-17  9:40 UTC (permalink / raw)
  To: ptxdist

On Tue, Feb 04, 2020 at 08:53:57AM +0100, Ulrich Ölmann wrote:
> From: Björn Esser <b.esser@pengutronix.de>
> 
> We also need to build a host-nodejs package first, as there
> are some tools needed to be executable on the host system
> during the intermediate cross-build process.
> 
> This package drops support for NPM, as we will be managing
> Node.js packages with Yarn, which will be implemented in the
> following commits.
> 
> The patches that are shipped along with this version of the
> package have been taken from the SRPM of the Node.js-package
> in Fedora. See:
> 
> https://src.fedoraproject.org/rpms/nodejs/c/f0e2a1ed4615?branch=master
> 
> Signed-off-by: Björn Esser <b.esser@pengutronix.de>
> [uol: adjusted commit message, dropped CREDIT lines, removed shell usage &
> inserted line break in build command]
> Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>

/usr/bin/node has an rpath that does not exist: /usr/bin/lib.target

Michael

> ---
> v1 --> v2: fix configure flags for host-nodejs
> v2 --> v3: add missing patches, remove obsolete patches
> Range-diff of v5 against v4:
> 1:  e08d21cc0be1 ! 1:  440fed72eaf9 nodejs: version bump 6.9.5 -> 12.14.1 LTS
>     @@ Commit message
>          https://src.fedoraproject.org/rpms/nodejs/c/f0e2a1ed4615?branch=master
> 
>          Signed-off-by: Björn Esser <b.esser@pengutronix.de>
>     +    [uol: adjusted commit message, dropped CREDIT lines, removed shell usage &
>     +    inserted line break in build command]
>     +    Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
> 
>       ## patches/node-v12.14.1/0001-Disable-running-gyp-on-shared-deps.patch (new) ##
>      @@
>     @@ rules/host-nodejs.make
>       #
>       # Copyright (C) 2015 by Michael Grzeschik <mgr@pengutronix.de>
>      +# Copyright (C) 2019 by Björn Esser <bes@pengutronix.de>
>     -+#
>     -+# See CREDITS for details about who has contributed to this project.
>       #
>       # For further information about the PTXdist project and license conditions
>       # see the README file.
>     @@ rules/nodejs.make
>       #
>       # Copyright (C) 2015 by Michael Grzeschik <mgr@pengutronix.de>
>      +# Copyright (C) 2019 by Björn Esser <bes@pengutronix.de>
>     -+#
>     -+# See CREDITS for details about who has contributed to this project.
>       #
>       # For further information about the PTXdist project and license conditions
>       # see the README file.
>     @@ rules/nodejs.make: NODEJS_ARM_FLOAT_ABI = $(shell ptxd_cross_cc_v | sed -n "s/CO
>      +#	# to the pre-built host tool binaries, which are different for
>      +#	# each individual checkout of a BSP.  -_-
>      +	$(foreach f,$(NODEJS_HOST_TOOLS), \
>     -+		$(shell sed -i -e "s#<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)$(f)<(EXECUTABLE_SUFFIX)#$(PTXDIST_SYSROOT_HOST)/bin/$(f)#" $(NODEJS_DIR)/node.gyp $(NODEJS_DIR)/tools/v8_gypfiles/v8.gyp) \
>     -+	)
>     ++		sed -i -e "s#<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)$(f)<(EXECUTABLE_SUFFIX)#$(PTXDIST_SYSROOT_HOST)/bin/$(f)#" \
>     ++			$(NODEJS_DIR)/node.gyp $(NODEJS_DIR)/tools/v8_gypfiles/v8.gyp $(ptx/nl))
>      +
>      +	@$(call world/prepare, NODEJS)
>      +
> 
>  ...1-Disable-running-gyp-on-shared-deps.patch |  25 ++++
>  ...Install-both-binaries-and-use-libdir.patch |  83 ++++++++++++
>  patches/node-v12.14.1/series                  |   5 +
>  ...build-from-source-option-to-npmunbox.patch |  31 -----
>  patches/npmbox-2.6.1/series                   |   4 -
>  rules/host-nodejs.in                          |   2 +
>  rules/host-nodejs.make                        |  39 +++---
>  rules/nodejs.in                               |  54 ++------
>  rules/nodejs.make                             | 119 ++++++------------
>  9 files changed, 185 insertions(+), 177 deletions(-)
>  create mode 100644 patches/node-v12.14.1/0001-Disable-running-gyp-on-shared-deps.patch
>  create mode 100644 patches/node-v12.14.1/0002-Install-both-binaries-and-use-libdir.patch
>  create mode 100644 patches/node-v12.14.1/series
>  delete mode 100644 patches/npmbox-2.6.1/0001-npmbox-add-build-from-source-option-to-npmunbox.patch
>  delete mode 100644 patches/npmbox-2.6.1/series
> 
> diff --git a/patches/node-v12.14.1/0001-Disable-running-gyp-on-shared-deps.patch b/patches/node-v12.14.1/0001-Disable-running-gyp-on-shared-deps.patch
> new file mode 100644
> index 000000000000..58d46a8f4167
> --- /dev/null
> +++ b/patches/node-v12.14.1/0001-Disable-running-gyp-on-shared-deps.patch
> @@ -0,0 +1,25 @@
> +From: Zuzana Svetlikova <zsvetlik@redhat.com>
> +Date: Thu, 27 Apr 2017 14:25:42 +0200
> +Subject: [PATCH] Disable running gyp on shared deps
> +
> +---
> + Makefile | 6 +++---
> + 1 file changed, 3 insertions(+), 3 deletions(-)
> +
> +diff --git a/Makefile b/Makefile
> +index 56f53582d1f4..2fb80e742637 100644
> +--- a/Makefile
> ++++ b/Makefile
> +@@ -141,9 +141,9 @@ test-code-cache: with-code-cache
> + 	echo "'test-code-cache' target is a noop"
> + 
> + out/Makefile: config.gypi common.gypi node.gyp \
> +-	deps/uv/uv.gyp deps/http_parser/http_parser.gyp deps/zlib/zlib.gyp \
> +-	tools/v8_gypfiles/toolchain.gypi tools/v8_gypfiles/features.gypi \
> +-	tools/v8_gypfiles/inspector.gypi tools/v8_gypfiles/v8.gyp
> ++  deps/http_parser/http_parser.gyp \
> ++  tools/v8_gypfiles/toolchain.gypi tools/v8_gypfiles/features.gypi \
> ++  tools/v8_gypfiles/inspector.gypi tools/v8_gypfiles/v8.gyp
> + 	$(PYTHON) tools/gyp_node.py -f make
> + 
> + # node_version.h is listed because the N-API version is taken from there
> diff --git a/patches/node-v12.14.1/0002-Install-both-binaries-and-use-libdir.patch b/patches/node-v12.14.1/0002-Install-both-binaries-and-use-libdir.patch
> new file mode 100644
> index 000000000000..38c3c96503f1
> --- /dev/null
> +++ b/patches/node-v12.14.1/0002-Install-both-binaries-and-use-libdir.patch
> @@ -0,0 +1,83 @@
> +From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
> +Date: Tue, 19 Mar 2019 23:22:40 -0400
> +Subject: [PATCH] Install both binaries and use libdir.
> +
> +This allows us to build with a shared library for other users while
> +still providing the normal executable.
> +
> +Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
> +---
> + configure.py     |  7 +++++++
> + tools/install.py | 31 ++++++++++++++-----------------
> + 2 files changed, 21 insertions(+), 17 deletions(-)
> +
> +diff --git a/configure.py b/configure.py
> +index 20cce214dbb1..e2d78a2a51ef 100755
> +--- a/configure.py
> ++++ b/configure.py
> +@@ -559,6 +559,12 @@ parser.add_option('--shared',
> +     help='compile shared library for embedding node in another project. ' +
> +          '(This mode is not officially supported for regular applications)')
> + 
> ++parser.add_option('--libdir',
> ++    action='store',
> ++    dest='libdir',
> ++    default='lib',
> ++    help='a directory to install the shared library into')
> ++
> + parser.add_option('--without-v8-platform',
> +     action='store_true',
> +     dest='without_v8_platform',
> +@@ -1103,6 +1109,7 @@ def configure_node(o):
> +   if o['variables']['want_separate_host_toolset'] == 0:
> +     o['variables']['node_code_cache'] = 'yes' # For testing
> +   o['variables']['node_shared'] = b(options.shared)
> ++  o['variables']['libdir'] = options.libdir
> +   node_module_version = getmoduleversion.get_version()
> + 
> +   if sys.platform == 'darwin':
> +diff --git a/tools/install.py b/tools/install.py
> +index 655802980a6e..fe4723bf1501 100755
> +--- a/tools/install.py
> ++++ b/tools/install.py
> +@@ -121,26 +121,23 @@ def subdir_files(path, dest, action):
> + 
> + def files(action):
> +   is_windows = sys.platform == 'win32'
> +-  output_file = 'node'
> +   output_prefix = 'out/Release/'
> ++  output_libprefix = output_prefix
> + 
> +-  if 'false' == variables.get('node_shared'):
> +-    if is_windows:
> +-      output_file += '.exe'
> ++  if is_windows:
> ++    output_bin = 'node.exe'
> ++    output_lib = 'node.dll'
> +   else:
> +-    if is_windows:
> +-      output_file += '.dll'
> +-    else:
> +-      output_file = 'lib' + output_file + '.' + variables.get('shlib_suffix')
> +-      # GYP will output to lib.target except on OS X, this is hardcoded
> +-      # in its source - see the _InstallableTargetInstallPath function.
> +-      if sys.platform != 'darwin':
> +-        output_prefix += 'lib.target/'
> +-
> +-  if 'false' == variables.get('node_shared'):
> +-    action([output_prefix + output_file], 'bin/' + output_file)
> +-  else:
> +-    action([output_prefix + output_file], 'lib/' + output_file)
> ++    output_bin = 'node'
> ++    output_lib = 'libnode.' + variables.get('shlib_suffix')
> ++    # GYP will output to lib.target except on OS X, this is hardcoded
> ++    # in its source - see the _InstallableTargetInstallPath function.
> ++    if sys.platform != 'darwin':
> ++      output_libprefix += 'lib.target/'
> ++
> ++  action([output_prefix + output_bin], 'bin/' + output_bin)
> ++  if 'true' == variables.get('node_shared'):
> ++    action([output_libprefix + output_lib], variables.get('libdir') + '/' + output_lib)
> + 
> +   if 'true' == variables.get('node_use_dtrace'):
> +     action(['out/Release/node.d'], 'lib/dtrace/node.d')
> diff --git a/patches/node-v12.14.1/series b/patches/node-v12.14.1/series
> new file mode 100644
> index 000000000000..f04c4243f9ad
> --- /dev/null
> +++ b/patches/node-v12.14.1/series
> @@ -0,0 +1,5 @@
> +# generated by git-ptx-patches
> +#tag:base --start-number 1
> +0001-Disable-running-gyp-on-shared-deps.patch
> +0002-Install-both-binaries-and-use-libdir.patch
> +# b42ea3192f53366dd53d306dcc1bec97  - git-ptx-patches magic
> diff --git a/patches/npmbox-2.6.1/0001-npmbox-add-build-from-source-option-to-npmunbox.patch b/patches/npmbox-2.6.1/0001-npmbox-add-build-from-source-option-to-npmunbox.patch
> deleted file mode 100644
> index 1e34b0dd3eba..000000000000
> --- a/patches/npmbox-2.6.1/0001-npmbox-add-build-from-source-option-to-npmunbox.patch
> +++ /dev/null
> @@ -1,31 +0,0 @@
> -From: Michael Grzeschik <m.grzeschik@pengutronix.de>
> -Date: Wed, 22 Jul 2015 18:18:59 +0200
> -Subject: [PATCH] npmbox: add build from source option to npmunbox
> -
> -Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> ----
> - lib/node_modules/npmbox/npmunbox.js | 4 +++-
> - 1 file changed, 3 insertions(+), 1 deletion(-)
> -
> -diff --git a/lib/node_modules/npmbox/npmunbox.js b/lib/node_modules/npmbox/npmunbox.js
> -index 66d6ef3..1cdc375 100644
> ---- a/lib/node_modules/npmbox/npmunbox.js
> -+++ b/lib/node_modules/npmbox/npmunbox.js
> -@@ -43,6 +43,7 @@ if (args.length<1 || argv.help) {
> - 	console.log("  -O, -save-optional   npm --save-optional swtich.");
> - 	console.log("  -B, -save-bundle     npm --save-bundle swtich.");
> - 	console.log("  -E, -save-exact      npm --save-exact swtich.");
> -+	console.log("  -b, -build-from-source      npm --build-from-source swtich.");
> - 	console.log("");
> - 	process.exit(0);
> - }
> -@@ -55,7 +56,8 @@ var options = {
> - 	"save-dev": argv.D || argv["save-dev"] || false,
> - 	"save-optional": argv.O || argv["save-optional"] || false,
> - 	"save-bundle": argv.B || argv["save-bundle"] || false,
> --	"save-exact": argv.E || argv["save-exact"] || false
> -+	"save-exact": argv.E || argv["save-exact"] || false,
> -+	"build-from-source": argv.b || argv["build-from-source"] || false
> - };
> - if (argv.C || argv.prefix) options.prefix = argv.C || argv.prefix;
> - 
> diff --git a/patches/npmbox-2.6.1/series b/patches/npmbox-2.6.1/series
> deleted file mode 100644
> index 0e8cfa98b0d9..000000000000
> --- a/patches/npmbox-2.6.1/series
> +++ /dev/null
> @@ -1,4 +0,0 @@
> -# generated by git-ptx-patches
> -#tag:base --start-number 1
> -0001-npmbox-add-build-from-source-option-to-npmunbox.patch
> -# 1fc845f15dff1b0b44df5cf3183e8d63  - git-ptx-patches magic
> diff --git a/rules/host-nodejs.in b/rules/host-nodejs.in
> index 6ea0dd519c96..527e7d427bee 100644
> --- a/rules/host-nodejs.in
> +++ b/rules/host-nodejs.in
> @@ -3,4 +3,6 @@
>  config HOST_NODEJS
>  	tristate
>  	default y if ALLYES
> +	select HOST_C_ARES
>  	select HOST_OPENSSL
> +	select HOST_ZLIB
> diff --git a/rules/host-nodejs.make b/rules/host-nodejs.make
> index 432cf930c714..c24ee8572468 100644
> --- a/rules/host-nodejs.make
> +++ b/rules/host-nodejs.make
> @@ -1,6 +1,7 @@
>  # -*-makefile-*-
>  #
>  # Copyright (C) 2015 by Michael Grzeschik <mgr@pengutronix.de>
> +# Copyright (C) 2019 by Björn Esser <bes@pengutronix.de>
>  #
>  # For further information about the PTXdist project and license conditions
>  # see the README file.
> @@ -11,32 +12,27 @@
>  #
>  HOST_PACKAGES-$(PTXCONF_HOST_NODEJS) += host-nodejs
>  
> -#
> -# Paths and names
> -#
> -HOST_NODEJS_NPMBOX_VERSION	:= 2.6.1
> -HOST_NODEJS_NPMBOX_MD5		:= 2779b99e3427cd49bbf28a236d871028
> -HOST_NODEJS_NPMBOX		:= npmbox-$(HOST_NODEJS_NPMBOX_VERSION)
> -HOST_NODEJS_NPMBOX_SUFFIX	:= tar.bz2
> -HOST_NODEJS_NPMBOX_URL		:= http://www.pengutronix.de/software/ptxdist/temporary-src/$(HOST_NODEJS_NPMBOX).$(HOST_NODEJS_NPMBOX_SUFFIX)
> -HOST_NODEJS_NPMBOX_SOURCE	:= $(SRCDIR)/$(HOST_NODEJS_NPMBOX).$(HOST_NODEJS_NPMBOX_SUFFIX)
> -$(HOST_NODEJS_NPMBOX_SOURCE)	:= HOST_NODEJS_NPMBOX
> -HOST_NODEJS_NPMBOX_DIR		= $(HOST_NODEJS_PKGDIR)
> -HOST_NODEJS_NPMBOX_STRIP_LEVEL	:= 0
> -
> -HOST_NODEJS_SOURCES		+= $(HOST_NODEJS_NPMBOX_SOURCE)
> +# Always run the preprocessor locally.
> +HOST_NODEJS_COMPILE_ENV	:= \
> +	ICECC_REMOTE_CPP=0
>  
>  # ----------------------------------------------------------------------------
>  # Prepare
>  # ----------------------------------------------------------------------------
>  
> -HOST_NODEJS_CONF_TOOL := autoconf
> -HOST_NODEJS_CONF_OPT := \
> +HOST_NODEJS_CONF_TOOL	:= autoconf
> +HOST_NODEJS_CONF_OPT	:= \
>  	$(HOST_AUTOCONF) \
>  	--prefix=/ \
> +	--no-cross-compiling \
>  	--dest-os=linux \
> +	--without-dtrace \
> +	--without-etw \
> +	--without-npm \
> +	--shared \
>  	--shared-openssl \
>  	--shared-zlib \
> +	--shared-cares \
>  	--with-intl=none \
>  	--without-snapshot
>  
> @@ -47,10 +43,13 @@ HOST_NODEJS_CONF_OPT := \
>  $(STATEDIR)/host-nodejs.install:
>  	@$(call targetinfo)
>  	@$(call install, HOST_NODEJS)
> -	@sed "1s^.*^#\!/usr/bin/env node^g" \
> -		-i $(HOST_NODEJS_PKGDIR)/lib/node_modules/npm/bin/npm-cli.js
> -	@$(call extract, HOST_NODEJS_NPMBOX)
> -	@$(call world/patchin, HOST_NODEJS_NPMBOX)
> +
> +#	# Needed to cross-compile for target.
> +	@install -pm 0755 $(HOST_NODEJS_DIR)/out/Release/bytecode_builtins_list_generator $(HOST_NODEJS_PKGDIR)/bin/
> +	@install -pm 0755 $(HOST_NODEJS_DIR)/out/Release/mkcodecache $(HOST_NODEJS_PKGDIR)/bin/
> +	@install -pm 0755 $(HOST_NODEJS_DIR)/out/Release/node_mksnapshot $(HOST_NODEJS_PKGDIR)/bin/
> +	@install -pm 0755 $(HOST_NODEJS_DIR)/out/Release/torque $(HOST_NODEJS_PKGDIR)/bin/
> +
>  	@$(call touch)
>  
>  # vim: syntax=make
> diff --git a/rules/nodejs.in b/rules/nodejs.in
> index e4ac11568bcc..6d23f94ef8b7 100644
> --- a/rules/nodejs.in
> +++ b/rules/nodejs.in
> @@ -1,48 +1,20 @@
> -## SECTION=staging
> -## old section:
> -### SECTION=bytecode_engines
> +## SECTION=bytecode_engines
>  
>  menuconfig NODEJS
>  	tristate
> -	prompt "nodejs                        "
> +	prompt "Node.js                       "
>  	select HOST_NODEJS
> +	select C_ARES
> +	select LIBUV
>  	select OPENSSL
>  	select ZLIB
>  	help
> -	  evented I/O for V8 javascript
> -
> -	  Node.js is a platform built on Chrome's JavaScript runtime
> -	  for easily building fast, scalable network
> -	  applications. Node.js uses an event-driven, non-blocking I/O
> -	  model that makes it lightweight and efficient, perfect for
> -	  data-intensive real-time applications that run across
> -	  distributed devices.
> -
> -	  STAGING: remove in ptxdist-2020.06.0
> -	  Old version that need to be updated. Fails to build with gcc >= 7.x.
> -
> -
> -if NODEJS
> -
> -config NODEJS_NPM
> -	bool
> -	prompt "install npm on target"
> -
> -config NODEJS_MODULE_LIST
> -	string
> -	prompt "install nodejs packages"
> -	help
> -	  A list of Node.js packages including version (e.g. express@4.13.0).
> -	  'ptxdist make nodejs-get' will download the packages and create a
> -	  npmbox file for each package. Note: The packages are stored in
> -	  local_src/ and should be part of the BSP. Downloading a package
> -	  again may result in different content.
> -
> -config NODEJS_MODULE_MD5
> -	string
> -	prompt "nodejs packages md5 sums"
> -	help
> -	  A md5 sum for each npmbox file of the packages listed in
> -	  NODEJS_MODULE_LIST.
> -
> -endif
> +	  Node.js is an open-source, cross-platform, JavaScript runtime
> +	  environment that executes JavaScript code outside of a browser.
> +	  Node.js lets developers use JavaScript to write command line
> +	  tools and for server-side scripting—running scripts server-side
> +	  to produce dynamic web page content before the page is sent to
> +	  the user's web browser. Consequently, Node.js represents a
> +	  "JavaScript everywhere" paradigm, unifying web-application
> +	  development around a single programming language, rather than
> +	  different languages for server- and client-side scripts.
> diff --git a/rules/nodejs.make b/rules/nodejs.make
> index 03098b18080c..a9433bd0687a 100644
> --- a/rules/nodejs.make
> +++ b/rules/nodejs.make
> @@ -1,6 +1,7 @@
>  # -*-makefile-*-
>  #
>  # Copyright (C) 2015 by Michael Grzeschik <mgr@pengutronix.de>
> +# Copyright (C) 2019 by Björn Esser <bes@pengutronix.de>
>  #
>  # For further information about the PTXdist project and license conditions
>  # see the README file.
> @@ -16,19 +17,24 @@ endif
>  #
>  # Paths and names
>  #
> -NODEJS_VERSION	:= v6.9.5
> -NODEJS_MD5	:= a2a820b797fb69ffb259b479c7f5df32
> -NODEJS		:= node-$(NODEJS_VERSION)
> -NODEJS_SUFFIX	:= tar.gz
> -NODEJS_URL	:= http://nodejs.org/dist/$(NODEJS_VERSION)/$(NODEJS).$(NODEJS_SUFFIX)
> -NODEJS_SOURCE	:= $(SRCDIR)/$(NODEJS).$(NODEJS_SUFFIX)
> -NODEJS_DIR	:= $(BUILDDIR)/$(NODEJS)
> -NODEJS_LICENSE	:= unknown
> -
> -NODEJS_SRCDIR		:= $(PTXDIST_WORKSPACE)/local_src
> -NODEJS_MODULE_LIST	:= $(call remove_quotes, $(PTXCONF_NODEJS_MODULE_LIST))
> -NODEJS_NPMBOXES		:= $(foreach module,$(NODEJS_MODULE_LIST), \
> -	$(addprefix $(NODEJS_SRCDIR)/,$(addsuffix .npmbox,$(module))))
> +NODEJS_VERSION		:= v12.14.1
> +NODEJS_MD5		:= 1c78a75f5c95321f533ecccca695e814
> +NODEJS			:= node-$(NODEJS_VERSION)
> +NODEJS_SUFFIX		:= tar.xz
> +NODEJS_URL		:= http://nodejs.org/dist/$(NODEJS_VERSION)/$(NODEJS).$(NODEJS_SUFFIX)
> +NODEJS_SOURCE		:= $(SRCDIR)/$(NODEJS).$(NODEJS_SUFFIX)
> +NODEJS_DIR		:= $(BUILDDIR)/$(NODEJS)
> +NODEJS_LICENSE		:= MIT
> +NODEJS_LICENSE_FILES	:= \
> +        file://LICENSE;md5=be4d5107c64dc3d7c57e3797e1a0674b
> +
> +NODEJS_HOST_TOOLS	:= \
> +	bytecode_builtins_list_generator \
> +	gen-regexp-special-case \
> +	mkcodecache \
> +	mksnapshot \
> +	node_mksnapshot \
> +	torque
>  
>  node/env = \
>  	$(CROSS_ENV) \
> @@ -39,47 +45,6 @@ node/env = \
>  	npm_config_nodedir=$(NODEJS_DIR) \
>  	$(1)
>  
> -# remove version number from package string
> -define rmversion
> -$(shell echo $(1) | sed 's-\<\([^ @]*\)@[^ @]*\>-\1-g')
> -endef
> -
> -# ----------------------------------------------------------------------------
> -# Get
> -# ----------------------------------------------------------------------------
> -
> -nodejs-get: $(NODEJS_NPMBOXES)
> -PHONY += nodejs-get
> -
> -$(NODEJS_SRCDIR)/%.npmbox:| $(STATEDIR)/host-nodejs.install.post
> -	@$(call targetinfo)
> -	mkdir -p $(NODEJS_SRCDIR)
> -	cd $(NODEJS_SRCDIR) && \
> -		$(call node/env, npmbox $(*) --verbose)
> -
> -# Map package sources and md5sums for world/check_src
> -NODEJS_MODULE_MD5	:= $(call remove_quotes, $(PTXCONF_NODEJS_MODULE_MD5))
> -define def_mod
> -$(call rmversion,$(1))_SOURCE	:= $(addprefix $(NODEJS_SRCDIR)/,$(addsuffix .npmbox,$(1)))
> -$(call rmversion,$(1))_MD5	:= $(firstword $(NODEJS_MODULE_MD5))
> -NODEJS_MODULE_MD5 := $(filter-out $(firstword $(NODEJS_MODULE_MD5)),$(NODEJS_MODULE_MD5))
> -endef
> -$(foreach module,$(NODEJS_MODULE_LIST),$(eval $(call def_mod,$(module))))
> -
> -$(STATEDIR)/nodejs.get:
> -	@$(call targetinfo)
> -	@$(call world/get, NODEJS)
> -	@$(call world/check_src, NODEJS)
> -	@$(foreach npmbox,$(NODEJS_NPMBOXES), \
> -		if [ ! -e $(npmbox) ]; then \
> -			echo "NodeJS modules must be downloaded with 'ptxdist make nodejs-get'"; \
> -			echo ; \
> -			exit 1; \
> -		fi;)
> -	@$(foreach module,$(NODEJS_MODULE_LIST), \
> -		$(call world/check_src, $(call rmversion,$(module)))$(ptx/nl))
> -	@$(call touch)
> -
>  # ----------------------------------------------------------------------------
>  # Prepare
>  # ----------------------------------------------------------------------------
> @@ -99,33 +64,37 @@ NODEJS_ARM_FLOAT_ABI = $(shell ptxd_cross_cc_v | sed -n "s/COLLECT_GCC_OPTIONS=.
>  NODEJS_ARM_FPU = $(shell ptxd_cross_cc_v | sed -n "s/COLLECT_GCC_OPTIONS=.*'-mfpu=\([^']*\)'.*/\1/p" | tail -n1)
>  endif
>  
> -NODEJS_CONF_TOOL := autoconf
> -# Use '=' to delay $(shell ...) calls until this is needed
> -NODEJS_CONF_OPT = \
> +NODEJS_CONF_OPT := \
>  	--prefix=/usr \
>  	--dest-cpu=$(NODEJS_ARCH) \
> +	--no-cross-compiling \
>  	--dest-os=linux \
>  	$(call ptx/ifdef,PTXCONF_ARCH_ARM,--with-arm-float-abi=$(NODEJS_ARM_FLOAT_ABI)) \
>  	$(call ptx/ifdef,PTXCONF_ARCH_ARM,--with-arm-fpu=$(NODEJS_ARM_FPU)) \
>  	--without-dtrace \
> -	$(call ptx/ifdef,PTXCONF_NODEJS_NPM,,--without-npm) \
> +	--without-etw \
> +	--without-npm \
> +	--shared \
> +	--shared-libuv \
>  	--shared-openssl \
>  	--shared-zlib \
> +	--shared-cares \
>  	--with-intl=none \
>  	--without-snapshot
>  
> -# ----------------------------------------------------------------------------
> -# Install
> -# ----------------------------------------------------------------------------
> -
> -$(STATEDIR)/nodejs.install:
> +$(STATEDIR)/nodejs.prepare:
>  	@$(call targetinfo)
> -	@$(call install, NODEJS)
> -	@$(foreach npmbox, $(NODEJS_NPMBOXES), \
> -		cd $(NODEJS_PKGDIR)/usr/lib/ && \
> -		$(call node/env, npmunbox -build-from-source $(npmbox))$(ptx/nl))
> -	@$(call touch)
>  
> +#	# Using a patch here isn't enough, as we need absolute paths
> +#	# to the pre-built host tool binaries, which are different for
> +#	# each individual checkout of a BSP.  -_-
> +	$(foreach f,$(NODEJS_HOST_TOOLS), \
> +		sed -i -e "s#<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)$(f)<(EXECUTABLE_SUFFIX)#$(PTXDIST_SYSROOT_HOST)/bin/$(f)#" \
> +			$(NODEJS_DIR)/node.gyp $(NODEJS_DIR)/tools/v8_gypfiles/v8.gyp $(ptx/nl))
> +
> +	@$(call world/prepare, NODEJS)
> +
> +	@$(call touch)
>  
>  # ----------------------------------------------------------------------------
>  # Target-Install
> @@ -141,23 +110,11 @@ $(STATEDIR)/nodejs.targetinstall:
>  	@$(call install_fixup, nodejs,DESCRIPTION,missing)
>  
>  	@$(call install_copy, nodejs, 0, 0, 0755, -, /usr/bin/node)
> +	@$(call install_lib, nodejs, 0, 0, 0644, libnode)
>  
>  #	# the place node searches for packages
>  	@$(call install_link, nodejs, node_modules, /usr/lib/node)
>  
> -ifdef PTXCONF_NODEJS_NPM
> -	@$(call install_link, nodejs, ../lib/node_modules/npm/bin/npm-cli.js, /usr/bin/npm)
> -	@$(call install_tree, nodejs, 0, 0, -, /usr/lib/node_modules/npm/lib/)
> -	@$(call install_tree, nodejs, 0, 0, -, /usr/lib/node_modules/npm/bin)
> -	@$(call install_tree, nodejs, 0, 0, -, /usr/lib/node_modules/npm/scripts)
> -	@$(call install_tree, nodejs, 0, 0, -, /usr/lib/node_modules/npm/node_modules)
> -	@$(call install_copy, nodejs, 0, 0, 0644, -, /usr/lib/node_modules/npm/package.json)
> -endif
> -
> -ifneq ($(NODEJS_MODULE_LIST),)
> -	@$(foreach module, $(call rmversion, $(NODEJS_MODULE_LIST)), \
> -		$(call install_tree, nodejs, 0, 0, -, /usr/lib/node_modules/$(module))$(ptx/nl))
> -endif
>  	@$(call install_finish, nodejs)
>  
>  	@$(call touch)
> -- 
> 2.25.0
> 
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] [PATCH v5 1/3] nodejs: version bump 6.9.5 -> 12.14.1 LTS
  2020-02-04  7:53 [ptxdist] [PATCH v5 1/3] nodejs: version bump 6.9.5 -> 12.14.1 LTS Ulrich Ölmann
                   ` (2 preceding siblings ...)
  2020-02-17  9:40 ` [ptxdist] [PATCH v5 1/3] nodejs: version bump 6.9.5 -> 12.14.1 LTS Michael Olbrich
@ 2020-02-21  8:22 ` Juergen Borleis
  2020-03-18 15:45   ` Ulrich Ölmann
  3 siblings, 1 reply; 11+ messages in thread
From: Juergen Borleis @ 2020-02-21  8:22 UTC (permalink / raw)
  To: ptxdist; +Cc: Ulrich Ölmann

Hello Ulrich,

Am Dienstag, den 04.02.2020, 08:53 +0100 schrieb Ulrich Ölmann:
> […]
> diff --git a/rules/nodejs.in b/rules/nodejs.in
> index e4ac11568bcc..6d23f94ef8b7 100644
> --- a/rules/nodejs.in
> +++ b/rules/nodejs.in
> @@ -1,48 +1,20 @@
> -## SECTION=staging
> -## old section:
> -### SECTION=bytecode_engines
> +## SECTION=bytecode_engines
>  
>  menuconfig NODEJS
>  	tristate
> -	prompt "nodejs                        "
> +	prompt "Node.js                       "
>  	select HOST_NODEJS
> +	select C_ARES
> +	select LIBUV
>  	select OPENSSL
>  	select ZLIB
>  	help
> -	  evented I/O for V8 javascript
> -
> -	  Node.js is a platform built on Chrome's JavaScript runtime
> -	  for easily building fast, scalable network
> -	  applications. Node.js uses an event-driven, non-blocking I/O
> -	  model that makes it lightweight and efficient, perfect for
> -	  data-intensive real-time applications that run across
> -	  distributed devices.
> -
> -	  STAGING: remove in ptxdist-2020.06.0
> -	  Old version that need to be updated. Fails to build with gcc >= 7.x.
> -
> -
> -if NODEJS
> -
> -config NODEJS_NPM
> -	bool
> -	prompt "install npm on target"
> […]

Since you remove all sub-menu entries, you should switch the whole entry from
"menuconfig" to "config" as well.

jb

-- 
Pengutronix e.K.                       | Juergen Borleis             |
Steuerwalder Str. 21                   | https://www.pengutronix.de/ |
31137 Hildesheim, Germany              | Phone: +49-5121-206917-5128 |
Amtsgericht Hildesheim, HRA 2686       | Fax:   +49-5121-206917-5555 |


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] [PATCH v5 2/3] host-yarn: new package
  2020-02-04  7:53 ` [ptxdist] [PATCH v5 2/3] host-yarn: new package Ulrich Ölmann
@ 2020-02-21  8:26   ` Juergen Borleis
  2020-03-18 15:46     ` Ulrich Ölmann
  0 siblings, 1 reply; 11+ messages in thread
From: Juergen Borleis @ 2020-02-21  8:26 UTC (permalink / raw)
  To: ptxdist; +Cc: Ulrich Ölmann

Am Dienstag, den 04.02.2020, 08:53 +0100 schrieb Ulrich Ölmann:
> […]
> diff --git a/rules/host-yarn.make b/rules/host-yarn.make
> new file mode 100644
> index 000000000000..16e04c05aee8
> --- /dev/null
> +++ b/rules/host-yarn.make
> @@ -0,0 +1,61 @@
> +# -*-makefile-*-
> +#
> +# Copyright (C) 2017 by Juergen Borleis <jbe@pengutronix.de>
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +# 2019-May-05, Daniel Arnold, Updated to yarn 1.15.2
> +# 2020-January-09, Björn Esser, Updated to yarn 1.21.1
> +
> +#
> +# We provide this package
> +#
> +HOST_PACKAGES-$(PTXCONF_HOST_YARN) += host-yarn
> +
> +#
> +# Paths and names
> +#
> +HOST_YARN_VERSION	:= 1.21.1
> +HOST_YARN_MD5		:= cf49e663e0f56aa15f1740c77354ebe2
> +HOST_YARN		:= yarn-$(HOST_YARN_VERSION)
> +HOST_YARN_SUFFIX	:= js
> +HOST_YARN_URL		:= https://github.com/yarnpkg/yarn/releases/download/v$(HOST_YARN_VERSION)/$(HOST_YARN).$(HOST_YARN_SUFFIX)
> +HOST_YARN_SOURCE	:= $(SRCDIR)/$(HOST_YARN).$(HOST_YARN_SUFFIX)

Don't forget the:

HOST_YARN_LICENSE	:= BSD-2-Clause

jb

-- 
Pengutronix e.K.                       | Juergen Borleis             |
Steuerwalder Str. 21                   | https://www.pengutronix.de/ |
31137 Hildesheim, Germany              | Phone: +49-5121-206917-5128 |
Amtsgericht Hildesheim, HRA 2686       | Fax:   +49-5121-206917-5555 |


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] [PATCH v5 1/3] nodejs: version bump 6.9.5 -> 12.14.1 LTS
  2020-02-17  9:40 ` [ptxdist] [PATCH v5 1/3] nodejs: version bump 6.9.5 -> 12.14.1 LTS Michael Olbrich
@ 2020-03-18 15:44   ` Ulrich Ölmann
  0 siblings, 0 replies; 11+ messages in thread
From: Ulrich Ölmann @ 2020-03-18 15:44 UTC (permalink / raw)
  To: ptxdist

On Mon, Feb 17 2020 at 10:40 +0100, Michael Olbrich <m.olbrich@pengutronix.de> wrote:
> On Tue, Feb 04, 2020 at 08:53:57AM +0100, Ulrich Ölmann wrote:
>> From: Björn Esser <b.esser@pengutronix.de>
>> 
>> We also need to build a host-nodejs package first, as there
>> are some tools needed to be executable on the host system
>> during the intermediate cross-build process.
>> 
>> This package drops support for NPM, as we will be managing
>> Node.js packages with Yarn, which will be implemented in the
>> following commits.
>> 
>> The patches that are shipped along with this version of the
>> package have been taken from the SRPM of the Node.js-package
>> in Fedora. See:
>> 
>> https://src.fedoraproject.org/rpms/nodejs/c/f0e2a1ed4615?branch=master
>> 
>> Signed-off-by: Björn Esser <b.esser@pengutronix.de>
>> [uol: adjusted commit message, dropped CREDIT lines, removed shell usage &
>> inserted line break in build command]
>> Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
>
> /usr/bin/node has an rpath that does not exist: /usr/bin/lib.target

Added a corresponding patch in v6 of the patch series.

Best regards
Ulrich

> Michael
>
>> ---
>> v1 --> v2: fix configure flags for host-nodejs
>> v2 --> v3: add missing patches, remove obsolete patches
>> Range-diff of v5 against v4:
>> 1:  e08d21cc0be1 ! 1:  440fed72eaf9 nodejs: version bump 6.9.5 -> 12.14.1 LTS
>>     @@ Commit message
>>          https://src.fedoraproject.org/rpms/nodejs/c/f0e2a1ed4615?branch=master
>> 
>>          Signed-off-by: Björn Esser <b.esser@pengutronix.de>
>>     +    [uol: adjusted commit message, dropped CREDIT lines, removed shell usage &
>>     +    inserted line break in build command]
>>     +    Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
>> 
>>       ## patches/node-v12.14.1/0001-Disable-running-gyp-on-shared-deps.patch (new) ##
>>      @@
>>     @@ rules/host-nodejs.make
>>       #
>>       # Copyright (C) 2015 by Michael Grzeschik <mgr@pengutronix.de>
>>      +# Copyright (C) 2019 by Björn Esser <bes@pengutronix.de>
>>     -+#
>>     -+# See CREDITS for details about who has contributed to this project.
>>       #
>>       # For further information about the PTXdist project and license conditions
>>       # see the README file.
>>     @@ rules/nodejs.make
>>       #
>>       # Copyright (C) 2015 by Michael Grzeschik <mgr@pengutronix.de>
>>      +# Copyright (C) 2019 by Björn Esser <bes@pengutronix.de>
>>     -+#
>>     -+# See CREDITS for details about who has contributed to this project.
>>       #
>>       # For further information about the PTXdist project and license conditions
>>       # see the README file.
>>     @@ rules/nodejs.make: NODEJS_ARM_FLOAT_ABI = $(shell ptxd_cross_cc_v | sed -n "s/CO
>>      +#	# to the pre-built host tool binaries, which are different for
>>      +#	# each individual checkout of a BSP.  -_-
>>      +	$(foreach f,$(NODEJS_HOST_TOOLS), \
>>     -+		$(shell sed -i -e "s#<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)$(f)<(EXECUTABLE_SUFFIX)#$(PTXDIST_SYSROOT_HOST)/bin/$(f)#" $(NODEJS_DIR)/node.gyp $(NODEJS_DIR)/tools/v8_gypfiles/v8.gyp) \
>>     -+	)
>>     ++		sed -i -e "s#<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)$(f)<(EXECUTABLE_SUFFIX)#$(PTXDIST_SYSROOT_HOST)/bin/$(f)#" \
>>     ++			$(NODEJS_DIR)/node.gyp $(NODEJS_DIR)/tools/v8_gypfiles/v8.gyp $(ptx/nl))
>>      +
>>      +	@$(call world/prepare, NODEJS)
>>      +
>> 
>>  ...1-Disable-running-gyp-on-shared-deps.patch |  25 ++++
>>  ...Install-both-binaries-and-use-libdir.patch |  83 ++++++++++++
>>  patches/node-v12.14.1/series                  |   5 +
>>  ...build-from-source-option-to-npmunbox.patch |  31 -----
>>  patches/npmbox-2.6.1/series                   |   4 -
>>  rules/host-nodejs.in                          |   2 +
>>  rules/host-nodejs.make                        |  39 +++---
>>  rules/nodejs.in                               |  54 ++------
>>  rules/nodejs.make                             | 119 ++++++------------
>>  9 files changed, 185 insertions(+), 177 deletions(-)
>>  create mode 100644 patches/node-v12.14.1/0001-Disable-running-gyp-on-shared-deps.patch
>>  create mode 100644 patches/node-v12.14.1/0002-Install-both-binaries-and-use-libdir.patch
>>  create mode 100644 patches/node-v12.14.1/series
>>  delete mode 100644 patches/npmbox-2.6.1/0001-npmbox-add-build-from-source-option-to-npmunbox.patch
>>  delete mode 100644 patches/npmbox-2.6.1/series
>> 
>> diff --git a/patches/node-v12.14.1/0001-Disable-running-gyp-on-shared-deps.patch b/patches/node-v12.14.1/0001-Disable-running-gyp-on-shared-deps.patch
>> new file mode 100644
>> index 000000000000..58d46a8f4167
>> --- /dev/null
>> +++ b/patches/node-v12.14.1/0001-Disable-running-gyp-on-shared-deps.patch
>> @@ -0,0 +1,25 @@
>> +From: Zuzana Svetlikova <zsvetlik@redhat.com>
>> +Date: Thu, 27 Apr 2017 14:25:42 +0200
>> +Subject: [PATCH] Disable running gyp on shared deps
>> +
>> +---
>> + Makefile | 6 +++---
>> + 1 file changed, 3 insertions(+), 3 deletions(-)
>> +
>> +diff --git a/Makefile b/Makefile
>> +index 56f53582d1f4..2fb80e742637 100644
>> +--- a/Makefile
>> ++++ b/Makefile
>> +@@ -141,9 +141,9 @@ test-code-cache: with-code-cache
>> + 	echo "'test-code-cache' target is a noop"
>> + 
>> + out/Makefile: config.gypi common.gypi node.gyp \
>> +-	deps/uv/uv.gyp deps/http_parser/http_parser.gyp deps/zlib/zlib.gyp \
>> +-	tools/v8_gypfiles/toolchain.gypi tools/v8_gypfiles/features.gypi \
>> +-	tools/v8_gypfiles/inspector.gypi tools/v8_gypfiles/v8.gyp
>> ++  deps/http_parser/http_parser.gyp \
>> ++  tools/v8_gypfiles/toolchain.gypi tools/v8_gypfiles/features.gypi \
>> ++  tools/v8_gypfiles/inspector.gypi tools/v8_gypfiles/v8.gyp
>> + 	$(PYTHON) tools/gyp_node.py -f make
>> + 
>> + # node_version.h is listed because the N-API version is taken from there
>> diff --git a/patches/node-v12.14.1/0002-Install-both-binaries-and-use-libdir.patch b/patches/node-v12.14.1/0002-Install-both-binaries-and-use-libdir.patch
>> new file mode 100644
>> index 000000000000..38c3c96503f1
>> --- /dev/null
>> +++ b/patches/node-v12.14.1/0002-Install-both-binaries-and-use-libdir.patch
>> @@ -0,0 +1,83 @@
>> +From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
>> +Date: Tue, 19 Mar 2019 23:22:40 -0400
>> +Subject: [PATCH] Install both binaries and use libdir.
>> +
>> +This allows us to build with a shared library for other users while
>> +still providing the normal executable.
>> +
>> +Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
>> +---
>> + configure.py     |  7 +++++++
>> + tools/install.py | 31 ++++++++++++++-----------------
>> + 2 files changed, 21 insertions(+), 17 deletions(-)
>> +
>> +diff --git a/configure.py b/configure.py
>> +index 20cce214dbb1..e2d78a2a51ef 100755
>> +--- a/configure.py
>> ++++ b/configure.py
>> +@@ -559,6 +559,12 @@ parser.add_option('--shared',
>> +     help='compile shared library for embedding node in another project. ' +
>> +          '(This mode is not officially supported for regular applications)')
>> + 
>> ++parser.add_option('--libdir',
>> ++    action='store',
>> ++    dest='libdir',
>> ++    default='lib',
>> ++    help='a directory to install the shared library into')
>> ++
>> + parser.add_option('--without-v8-platform',
>> +     action='store_true',
>> +     dest='without_v8_platform',
>> +@@ -1103,6 +1109,7 @@ def configure_node(o):
>> +   if o['variables']['want_separate_host_toolset'] == 0:
>> +     o['variables']['node_code_cache'] = 'yes' # For testing
>> +   o['variables']['node_shared'] = b(options.shared)
>> ++  o['variables']['libdir'] = options.libdir
>> +   node_module_version = getmoduleversion.get_version()
>> + 
>> +   if sys.platform == 'darwin':
>> +diff --git a/tools/install.py b/tools/install.py
>> +index 655802980a6e..fe4723bf1501 100755
>> +--- a/tools/install.py
>> ++++ b/tools/install.py
>> +@@ -121,26 +121,23 @@ def subdir_files(path, dest, action):
>> + 
>> + def files(action):
>> +   is_windows = sys.platform == 'win32'
>> +-  output_file = 'node'
>> +   output_prefix = 'out/Release/'
>> ++  output_libprefix = output_prefix
>> + 
>> +-  if 'false' == variables.get('node_shared'):
>> +-    if is_windows:
>> +-      output_file += '.exe'
>> ++  if is_windows:
>> ++    output_bin = 'node.exe'
>> ++    output_lib = 'node.dll'
>> +   else:
>> +-    if is_windows:
>> +-      output_file += '.dll'
>> +-    else:
>> +-      output_file = 'lib' + output_file + '.' + variables.get('shlib_suffix')
>> +-      # GYP will output to lib.target except on OS X, this is hardcoded
>> +-      # in its source - see the _InstallableTargetInstallPath function.
>> +-      if sys.platform != 'darwin':
>> +-        output_prefix += 'lib.target/'
>> +-
>> +-  if 'false' == variables.get('node_shared'):
>> +-    action([output_prefix + output_file], 'bin/' + output_file)
>> +-  else:
>> +-    action([output_prefix + output_file], 'lib/' + output_file)
>> ++    output_bin = 'node'
>> ++    output_lib = 'libnode.' + variables.get('shlib_suffix')
>> ++    # GYP will output to lib.target except on OS X, this is hardcoded
>> ++    # in its source - see the _InstallableTargetInstallPath function.
>> ++    if sys.platform != 'darwin':
>> ++      output_libprefix += 'lib.target/'
>> ++
>> ++  action([output_prefix + output_bin], 'bin/' + output_bin)
>> ++  if 'true' == variables.get('node_shared'):
>> ++    action([output_libprefix + output_lib], variables.get('libdir') + '/' + output_lib)
>> + 
>> +   if 'true' == variables.get('node_use_dtrace'):
>> +     action(['out/Release/node.d'], 'lib/dtrace/node.d')
>> diff --git a/patches/node-v12.14.1/series b/patches/node-v12.14.1/series
>> new file mode 100644
>> index 000000000000..f04c4243f9ad
>> --- /dev/null
>> +++ b/patches/node-v12.14.1/series
>> @@ -0,0 +1,5 @@
>> +# generated by git-ptx-patches
>> +#tag:base --start-number 1
>> +0001-Disable-running-gyp-on-shared-deps.patch
>> +0002-Install-both-binaries-and-use-libdir.patch
>> +# b42ea3192f53366dd53d306dcc1bec97  - git-ptx-patches magic
>> diff --git a/patches/npmbox-2.6.1/0001-npmbox-add-build-from-source-option-to-npmunbox.patch b/patches/npmbox-2.6.1/0001-npmbox-add-build-from-source-option-to-npmunbox.patch
>> deleted file mode 100644
>> index 1e34b0dd3eba..000000000000
>> --- a/patches/npmbox-2.6.1/0001-npmbox-add-build-from-source-option-to-npmunbox.patch
>> +++ /dev/null
>> @@ -1,31 +0,0 @@
>> -From: Michael Grzeschik <m.grzeschik@pengutronix.de>
>> -Date: Wed, 22 Jul 2015 18:18:59 +0200
>> -Subject: [PATCH] npmbox: add build from source option to npmunbox
>> -
>> -Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
>> ----
>> - lib/node_modules/npmbox/npmunbox.js | 4 +++-
>> - 1 file changed, 3 insertions(+), 1 deletion(-)
>> -
>> -diff --git a/lib/node_modules/npmbox/npmunbox.js b/lib/node_modules/npmbox/npmunbox.js
>> -index 66d6ef3..1cdc375 100644
>> ---- a/lib/node_modules/npmbox/npmunbox.js
>> -+++ b/lib/node_modules/npmbox/npmunbox.js
>> -@@ -43,6 +43,7 @@ if (args.length<1 || argv.help) {
>> - 	console.log("  -O, -save-optional   npm --save-optional swtich.");
>> - 	console.log("  -B, -save-bundle     npm --save-bundle swtich.");
>> - 	console.log("  -E, -save-exact      npm --save-exact swtich.");
>> -+	console.log("  -b, -build-from-source      npm --build-from-source swtich.");
>> - 	console.log("");
>> - 	process.exit(0);
>> - }
>> -@@ -55,7 +56,8 @@ var options = {
>> - 	"save-dev": argv.D || argv["save-dev"] || false,
>> - 	"save-optional": argv.O || argv["save-optional"] || false,
>> - 	"save-bundle": argv.B || argv["save-bundle"] || false,
>> --	"save-exact": argv.E || argv["save-exact"] || false
>> -+	"save-exact": argv.E || argv["save-exact"] || false,
>> -+	"build-from-source": argv.b || argv["build-from-source"] || false
>> - };
>> - if (argv.C || argv.prefix) options.prefix = argv.C || argv.prefix;
>> - 
>> diff --git a/patches/npmbox-2.6.1/series b/patches/npmbox-2.6.1/series
>> deleted file mode 100644
>> index 0e8cfa98b0d9..000000000000
>> --- a/patches/npmbox-2.6.1/series
>> +++ /dev/null
>> @@ -1,4 +0,0 @@
>> -# generated by git-ptx-patches
>> -#tag:base --start-number 1
>> -0001-npmbox-add-build-from-source-option-to-npmunbox.patch
>> -# 1fc845f15dff1b0b44df5cf3183e8d63  - git-ptx-patches magic
>> diff --git a/rules/host-nodejs.in b/rules/host-nodejs.in
>> index 6ea0dd519c96..527e7d427bee 100644
>> --- a/rules/host-nodejs.in
>> +++ b/rules/host-nodejs.in
>> @@ -3,4 +3,6 @@
>>  config HOST_NODEJS
>>  	tristate
>>  	default y if ALLYES
>> +	select HOST_C_ARES
>>  	select HOST_OPENSSL
>> +	select HOST_ZLIB
>> diff --git a/rules/host-nodejs.make b/rules/host-nodejs.make
>> index 432cf930c714..c24ee8572468 100644
>> --- a/rules/host-nodejs.make
>> +++ b/rules/host-nodejs.make
>> @@ -1,6 +1,7 @@
>>  # -*-makefile-*-
>>  #
>>  # Copyright (C) 2015 by Michael Grzeschik <mgr@pengutronix.de>
>> +# Copyright (C) 2019 by Björn Esser <bes@pengutronix.de>
>>  #
>>  # For further information about the PTXdist project and license conditions
>>  # see the README file.
>> @@ -11,32 +12,27 @@
>>  #
>>  HOST_PACKAGES-$(PTXCONF_HOST_NODEJS) += host-nodejs
>>  
>> -#
>> -# Paths and names
>> -#
>> -HOST_NODEJS_NPMBOX_VERSION	:= 2.6.1
>> -HOST_NODEJS_NPMBOX_MD5		:= 2779b99e3427cd49bbf28a236d871028
>> -HOST_NODEJS_NPMBOX		:= npmbox-$(HOST_NODEJS_NPMBOX_VERSION)
>> -HOST_NODEJS_NPMBOX_SUFFIX	:= tar.bz2
>> -HOST_NODEJS_NPMBOX_URL		:= http://www.pengutronix.de/software/ptxdist/temporary-src/$(HOST_NODEJS_NPMBOX).$(HOST_NODEJS_NPMBOX_SUFFIX)
>> -HOST_NODEJS_NPMBOX_SOURCE	:= $(SRCDIR)/$(HOST_NODEJS_NPMBOX).$(HOST_NODEJS_NPMBOX_SUFFIX)
>> -$(HOST_NODEJS_NPMBOX_SOURCE)	:= HOST_NODEJS_NPMBOX
>> -HOST_NODEJS_NPMBOX_DIR		= $(HOST_NODEJS_PKGDIR)
>> -HOST_NODEJS_NPMBOX_STRIP_LEVEL	:= 0
>> -
>> -HOST_NODEJS_SOURCES		+= $(HOST_NODEJS_NPMBOX_SOURCE)
>> +# Always run the preprocessor locally.
>> +HOST_NODEJS_COMPILE_ENV	:= \
>> +	ICECC_REMOTE_CPP=0
>>  
>>  # ----------------------------------------------------------------------------
>>  # Prepare
>>  # ----------------------------------------------------------------------------
>>  
>> -HOST_NODEJS_CONF_TOOL := autoconf
>> -HOST_NODEJS_CONF_OPT := \
>> +HOST_NODEJS_CONF_TOOL	:= autoconf
>> +HOST_NODEJS_CONF_OPT	:= \
>>  	$(HOST_AUTOCONF) \
>>  	--prefix=/ \
>> +	--no-cross-compiling \
>>  	--dest-os=linux \
>> +	--without-dtrace \
>> +	--without-etw \
>> +	--without-npm \
>> +	--shared \
>>  	--shared-openssl \
>>  	--shared-zlib \
>> +	--shared-cares \
>>  	--with-intl=none \
>>  	--without-snapshot
>>  
>> @@ -47,10 +43,13 @@ HOST_NODEJS_CONF_OPT := \
>>  $(STATEDIR)/host-nodejs.install:
>>  	@$(call targetinfo)
>>  	@$(call install, HOST_NODEJS)
>> -	@sed "1s^.*^#\!/usr/bin/env node^g" \
>> -		-i $(HOST_NODEJS_PKGDIR)/lib/node_modules/npm/bin/npm-cli.js
>> -	@$(call extract, HOST_NODEJS_NPMBOX)
>> -	@$(call world/patchin, HOST_NODEJS_NPMBOX)
>> +
>> +#	# Needed to cross-compile for target.
>> +	@install -pm 0755 $(HOST_NODEJS_DIR)/out/Release/bytecode_builtins_list_generator $(HOST_NODEJS_PKGDIR)/bin/
>> +	@install -pm 0755 $(HOST_NODEJS_DIR)/out/Release/mkcodecache $(HOST_NODEJS_PKGDIR)/bin/
>> +	@install -pm 0755 $(HOST_NODEJS_DIR)/out/Release/node_mksnapshot $(HOST_NODEJS_PKGDIR)/bin/
>> +	@install -pm 0755 $(HOST_NODEJS_DIR)/out/Release/torque $(HOST_NODEJS_PKGDIR)/bin/
>> +
>>  	@$(call touch)
>>  
>>  # vim: syntax=make
>> diff --git a/rules/nodejs.in b/rules/nodejs.in
>> index e4ac11568bcc..6d23f94ef8b7 100644
>> --- a/rules/nodejs.in
>> +++ b/rules/nodejs.in
>> @@ -1,48 +1,20 @@
>> -## SECTION=staging
>> -## old section:
>> -### SECTION=bytecode_engines
>> +## SECTION=bytecode_engines
>>  
>>  menuconfig NODEJS
>>  	tristate
>> -	prompt "nodejs                        "
>> +	prompt "Node.js                       "
>>  	select HOST_NODEJS
>> +	select C_ARES
>> +	select LIBUV
>>  	select OPENSSL
>>  	select ZLIB
>>  	help
>> -	  evented I/O for V8 javascript
>> -
>> -	  Node.js is a platform built on Chrome's JavaScript runtime
>> -	  for easily building fast, scalable network
>> -	  applications. Node.js uses an event-driven, non-blocking I/O
>> -	  model that makes it lightweight and efficient, perfect for
>> -	  data-intensive real-time applications that run across
>> -	  distributed devices.
>> -
>> -	  STAGING: remove in ptxdist-2020.06.0
>> -	  Old version that need to be updated. Fails to build with gcc >= 7.x.
>> -
>> -
>> -if NODEJS
>> -
>> -config NODEJS_NPM
>> -	bool
>> -	prompt "install npm on target"
>> -
>> -config NODEJS_MODULE_LIST
>> -	string
>> -	prompt "install nodejs packages"
>> -	help
>> -	  A list of Node.js packages including version (e.g. express@4.13.0).
>> -	  'ptxdist make nodejs-get' will download the packages and create a
>> -	  npmbox file for each package. Note: The packages are stored in
>> -	  local_src/ and should be part of the BSP. Downloading a package
>> -	  again may result in different content.
>> -
>> -config NODEJS_MODULE_MD5
>> -	string
>> -	prompt "nodejs packages md5 sums"
>> -	help
>> -	  A md5 sum for each npmbox file of the packages listed in
>> -	  NODEJS_MODULE_LIST.
>> -
>> -endif
>> +	  Node.js is an open-source, cross-platform, JavaScript runtime
>> +	  environment that executes JavaScript code outside of a browser.
>> +	  Node.js lets developers use JavaScript to write command line
>> +	  tools and for server-side scripting—running scripts server-side
>> +	  to produce dynamic web page content before the page is sent to
>> +	  the user's web browser. Consequently, Node.js represents a
>> +	  "JavaScript everywhere" paradigm, unifying web-application
>> +	  development around a single programming language, rather than
>> +	  different languages for server- and client-side scripts.
>> diff --git a/rules/nodejs.make b/rules/nodejs.make
>> index 03098b18080c..a9433bd0687a 100644
>> --- a/rules/nodejs.make
>> +++ b/rules/nodejs.make
>> @@ -1,6 +1,7 @@
>>  # -*-makefile-*-
>>  #
>>  # Copyright (C) 2015 by Michael Grzeschik <mgr@pengutronix.de>
>> +# Copyright (C) 2019 by Björn Esser <bes@pengutronix.de>
>>  #
>>  # For further information about the PTXdist project and license conditions
>>  # see the README file.
>> @@ -16,19 +17,24 @@ endif
>>  #
>>  # Paths and names
>>  #
>> -NODEJS_VERSION	:= v6.9.5
>> -NODEJS_MD5	:= a2a820b797fb69ffb259b479c7f5df32
>> -NODEJS		:= node-$(NODEJS_VERSION)
>> -NODEJS_SUFFIX	:= tar.gz
>> -NODEJS_URL	:= http://nodejs.org/dist/$(NODEJS_VERSION)/$(NODEJS).$(NODEJS_SUFFIX)
>> -NODEJS_SOURCE	:= $(SRCDIR)/$(NODEJS).$(NODEJS_SUFFIX)
>> -NODEJS_DIR	:= $(BUILDDIR)/$(NODEJS)
>> -NODEJS_LICENSE	:= unknown
>> -
>> -NODEJS_SRCDIR		:= $(PTXDIST_WORKSPACE)/local_src
>> -NODEJS_MODULE_LIST	:= $(call remove_quotes, $(PTXCONF_NODEJS_MODULE_LIST))
>> -NODEJS_NPMBOXES		:= $(foreach module,$(NODEJS_MODULE_LIST), \
>> -	$(addprefix $(NODEJS_SRCDIR)/,$(addsuffix .npmbox,$(module))))
>> +NODEJS_VERSION		:= v12.14.1
>> +NODEJS_MD5		:= 1c78a75f5c95321f533ecccca695e814
>> +NODEJS			:= node-$(NODEJS_VERSION)
>> +NODEJS_SUFFIX		:= tar.xz
>> +NODEJS_URL		:= http://nodejs.org/dist/$(NODEJS_VERSION)/$(NODEJS).$(NODEJS_SUFFIX)
>> +NODEJS_SOURCE		:= $(SRCDIR)/$(NODEJS).$(NODEJS_SUFFIX)
>> +NODEJS_DIR		:= $(BUILDDIR)/$(NODEJS)
>> +NODEJS_LICENSE		:= MIT
>> +NODEJS_LICENSE_FILES	:= \
>> +        file://LICENSE;md5=be4d5107c64dc3d7c57e3797e1a0674b
>> +
>> +NODEJS_HOST_TOOLS	:= \
>> +	bytecode_builtins_list_generator \
>> +	gen-regexp-special-case \
>> +	mkcodecache \
>> +	mksnapshot \
>> +	node_mksnapshot \
>> +	torque
>>  
>>  node/env = \
>>  	$(CROSS_ENV) \
>> @@ -39,47 +45,6 @@ node/env = \
>>  	npm_config_nodedir=$(NODEJS_DIR) \
>>  	$(1)
>>  
>> -# remove version number from package string
>> -define rmversion
>> -$(shell echo $(1) | sed 's-\<\([^ @]*\)@[^ @]*\>-\1-g')
>> -endef
>> -
>> -# ----------------------------------------------------------------------------
>> -# Get
>> -# ----------------------------------------------------------------------------
>> -
>> -nodejs-get: $(NODEJS_NPMBOXES)
>> -PHONY += nodejs-get
>> -
>> -$(NODEJS_SRCDIR)/%.npmbox:| $(STATEDIR)/host-nodejs.install.post
>> -	@$(call targetinfo)
>> -	mkdir -p $(NODEJS_SRCDIR)
>> -	cd $(NODEJS_SRCDIR) && \
>> -		$(call node/env, npmbox $(*) --verbose)
>> -
>> -# Map package sources and md5sums for world/check_src
>> -NODEJS_MODULE_MD5	:= $(call remove_quotes, $(PTXCONF_NODEJS_MODULE_MD5))
>> -define def_mod
>> -$(call rmversion,$(1))_SOURCE	:= $(addprefix $(NODEJS_SRCDIR)/,$(addsuffix .npmbox,$(1)))
>> -$(call rmversion,$(1))_MD5	:= $(firstword $(NODEJS_MODULE_MD5))
>> -NODEJS_MODULE_MD5 := $(filter-out $(firstword $(NODEJS_MODULE_MD5)),$(NODEJS_MODULE_MD5))
>> -endef
>> -$(foreach module,$(NODEJS_MODULE_LIST),$(eval $(call def_mod,$(module))))
>> -
>> -$(STATEDIR)/nodejs.get:
>> -	@$(call targetinfo)
>> -	@$(call world/get, NODEJS)
>> -	@$(call world/check_src, NODEJS)
>> -	@$(foreach npmbox,$(NODEJS_NPMBOXES), \
>> -		if [ ! -e $(npmbox) ]; then \
>> -			echo "NodeJS modules must be downloaded with 'ptxdist make nodejs-get'"; \
>> -			echo ; \
>> -			exit 1; \
>> -		fi;)
>> -	@$(foreach module,$(NODEJS_MODULE_LIST), \
>> -		$(call world/check_src, $(call rmversion,$(module)))$(ptx/nl))
>> -	@$(call touch)
>> -
>>  # ----------------------------------------------------------------------------
>>  # Prepare
>>  # ----------------------------------------------------------------------------
>> @@ -99,33 +64,37 @@ NODEJS_ARM_FLOAT_ABI = $(shell ptxd_cross_cc_v | sed -n "s/COLLECT_GCC_OPTIONS=.
>>  NODEJS_ARM_FPU = $(shell ptxd_cross_cc_v | sed -n "s/COLLECT_GCC_OPTIONS=.*'-mfpu=\([^']*\)'.*/\1/p" | tail -n1)
>>  endif
>>  
>> -NODEJS_CONF_TOOL := autoconf
>> -# Use '=' to delay $(shell ...) calls until this is needed
>> -NODEJS_CONF_OPT = \
>> +NODEJS_CONF_OPT := \
>>  	--prefix=/usr \
>>  	--dest-cpu=$(NODEJS_ARCH) \
>> +	--no-cross-compiling \
>>  	--dest-os=linux \
>>  	$(call ptx/ifdef,PTXCONF_ARCH_ARM,--with-arm-float-abi=$(NODEJS_ARM_FLOAT_ABI)) \
>>  	$(call ptx/ifdef,PTXCONF_ARCH_ARM,--with-arm-fpu=$(NODEJS_ARM_FPU)) \
>>  	--without-dtrace \
>> -	$(call ptx/ifdef,PTXCONF_NODEJS_NPM,,--without-npm) \
>> +	--without-etw \
>> +	--without-npm \
>> +	--shared \
>> +	--shared-libuv \
>>  	--shared-openssl \
>>  	--shared-zlib \
>> +	--shared-cares \
>>  	--with-intl=none \
>>  	--without-snapshot
>>  
>> -# ----------------------------------------------------------------------------
>> -# Install
>> -# ----------------------------------------------------------------------------
>> -
>> -$(STATEDIR)/nodejs.install:
>> +$(STATEDIR)/nodejs.prepare:
>>  	@$(call targetinfo)
>> -	@$(call install, NODEJS)
>> -	@$(foreach npmbox, $(NODEJS_NPMBOXES), \
>> -		cd $(NODEJS_PKGDIR)/usr/lib/ && \
>> -		$(call node/env, npmunbox -build-from-source $(npmbox))$(ptx/nl))
>> -	@$(call touch)
>>  
>> +#	# Using a patch here isn't enough, as we need absolute paths
>> +#	# to the pre-built host tool binaries, which are different for
>> +#	# each individual checkout of a BSP.  -_-
>> +	$(foreach f,$(NODEJS_HOST_TOOLS), \
>> +		sed -i -e "s#<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)$(f)<(EXECUTABLE_SUFFIX)#$(PTXDIST_SYSROOT_HOST)/bin/$(f)#" \
>> +			$(NODEJS_DIR)/node.gyp $(NODEJS_DIR)/tools/v8_gypfiles/v8.gyp $(ptx/nl))
>> +
>> +	@$(call world/prepare, NODEJS)
>> +
>> +	@$(call touch)
>>  
>>  # ----------------------------------------------------------------------------
>>  # Target-Install
>> @@ -141,23 +110,11 @@ $(STATEDIR)/nodejs.targetinstall:
>>  	@$(call install_fixup, nodejs,DESCRIPTION,missing)
>>  
>>  	@$(call install_copy, nodejs, 0, 0, 0755, -, /usr/bin/node)
>> +	@$(call install_lib, nodejs, 0, 0, 0644, libnode)
>>  
>>  #	# the place node searches for packages
>>  	@$(call install_link, nodejs, node_modules, /usr/lib/node)
>>  
>> -ifdef PTXCONF_NODEJS_NPM
>> -	@$(call install_link, nodejs, ../lib/node_modules/npm/bin/npm-cli.js, /usr/bin/npm)
>> -	@$(call install_tree, nodejs, 0, 0, -, /usr/lib/node_modules/npm/lib/)
>> -	@$(call install_tree, nodejs, 0, 0, -, /usr/lib/node_modules/npm/bin)
>> -	@$(call install_tree, nodejs, 0, 0, -, /usr/lib/node_modules/npm/scripts)
>> -	@$(call install_tree, nodejs, 0, 0, -, /usr/lib/node_modules/npm/node_modules)
>> -	@$(call install_copy, nodejs, 0, 0, 0644, -, /usr/lib/node_modules/npm/package.json)
>> -endif
>> -
>> -ifneq ($(NODEJS_MODULE_LIST),)
>> -	@$(foreach module, $(call rmversion, $(NODEJS_MODULE_LIST)), \
>> -		$(call install_tree, nodejs, 0, 0, -, /usr/lib/node_modules/$(module))$(ptx/nl))
>> -endif
>>  	@$(call install_finish, nodejs)
>>  
>>  	@$(call touch)
>> -- 
>> 2.25.0
>> 
>> 
>> _______________________________________________
>> ptxdist mailing list
>> ptxdist@pengutronix.de
-- 
Pengutronix e.K.                           | Ulrich Ölmann               |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] [PATCH v5 1/3] nodejs: version bump 6.9.5 -> 12.14.1 LTS
  2020-02-21  8:22 ` Juergen Borleis
@ 2020-03-18 15:45   ` Ulrich Ölmann
  0 siblings, 0 replies; 11+ messages in thread
From: Ulrich Ölmann @ 2020-03-18 15:45 UTC (permalink / raw)
  To: ptxdist, jbe

On Fri, Feb 21 2020 at 09:22 +0100, Juergen Borleis <jbe@pengutronix.de> wrote:
> Am Dienstag, den 04.02.2020, 08:53 +0100 schrieb Ulrich Ölmann:
>> […]
>> diff --git a/rules/nodejs.in b/rules/nodejs.in
>> index e4ac11568bcc..6d23f94ef8b7 100644
>> --- a/rules/nodejs.in
>> +++ b/rules/nodejs.in
>> @@ -1,48 +1,20 @@
>> -## SECTION=staging
>> -## old section:
>> -### SECTION=bytecode_engines
>> +## SECTION=bytecode_engines
>>  
>>  menuconfig NODEJS
>>  	tristate
>> -	prompt "nodejs                        "
>> +	prompt "Node.js                       "
>>  	select HOST_NODEJS
>> +	select C_ARES
>> +	select LIBUV
>>  	select OPENSSL
>>  	select ZLIB
>>  	help
>> -	  evented I/O for V8 javascript
>> -
>> -	  Node.js is a platform built on Chrome's JavaScript runtime
>> -	  for easily building fast, scalable network
>> -	  applications. Node.js uses an event-driven, non-blocking I/O
>> -	  model that makes it lightweight and efficient, perfect for
>> -	  data-intensive real-time applications that run across
>> -	  distributed devices.
>> -
>> -	  STAGING: remove in ptxdist-2020.06.0
>> -	  Old version that need to be updated. Fails to build with gcc >= 7.x.
>> -
>> -
>> -if NODEJS
>> -
>> -config NODEJS_NPM
>> -	bool
>> -	prompt "install npm on target"
>> […]
>
> Since you remove all sub-menu entries, you should switch the whole entry from
> "menuconfig" to "config" as well.

Switched to "config" in v6 of the patch series.

Best regards
Ulrich
-- 
Pengutronix e.K.                           | Ulrich Ölmann               |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] [PATCH v5 2/3] host-yarn: new package
  2020-02-21  8:26   ` Juergen Borleis
@ 2020-03-18 15:46     ` Ulrich Ölmann
  0 siblings, 0 replies; 11+ messages in thread
From: Ulrich Ölmann @ 2020-03-18 15:46 UTC (permalink / raw)
  To: ptxdist, jbe

On Fri, Feb 21 2020 at 09:26 +0100, Juergen Borleis <jbe@pengutronix.de> wrote:
> Am Dienstag, den 04.02.2020, 08:53 +0100 schrieb Ulrich Ölmann:
>> […]
>> diff --git a/rules/host-yarn.make b/rules/host-yarn.make
>> new file mode 100644
>> index 000000000000..16e04c05aee8
>> --- /dev/null
>> +++ b/rules/host-yarn.make
>> @@ -0,0 +1,61 @@
>> +# -*-makefile-*-
>> +#
>> +# Copyright (C) 2017 by Juergen Borleis <jbe@pengutronix.de>
>> +#
>> +# For further information about the PTXdist project and license conditions
>> +# see the README file.
>> +#
>> +# 2019-May-05, Daniel Arnold, Updated to yarn 1.15.2
>> +# 2020-January-09, Björn Esser, Updated to yarn 1.21.1
>> +
>> +#
>> +# We provide this package
>> +#
>> +HOST_PACKAGES-$(PTXCONF_HOST_YARN) += host-yarn
>> +
>> +#
>> +# Paths and names
>> +#
>> +HOST_YARN_VERSION	:= 1.21.1
>> +HOST_YARN_MD5		:= cf49e663e0f56aa15f1740c77354ebe2
>> +HOST_YARN		:= yarn-$(HOST_YARN_VERSION)
>> +HOST_YARN_SUFFIX	:= js
>> +HOST_YARN_URL		:= https://github.com/yarnpkg/yarn/releases/download/v$(HOST_YARN_VERSION)/$(HOST_YARN).$(HOST_YARN_SUFFIX)
>> +HOST_YARN_SOURCE	:= $(SRCDIR)/$(HOST_YARN).$(HOST_YARN_SUFFIX)
>
> Don't forget the:
>
> HOST_YARN_LICENSE	:= BSD-2-Clause

Added the license in v6 of the patch series.

Best regards
Ulrich
-- 
Pengutronix e.K.                           | Ulrich Ölmann               |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] [PATCH v5 3/3] nodejs_packages: new package
  2020-02-14 12:46   ` Michael Olbrich
@ 2020-03-18 15:48     ` Ulrich Ölmann
  0 siblings, 0 replies; 11+ messages in thread
From: Ulrich Ölmann @ 2020-03-18 15:48 UTC (permalink / raw)
  To: ptxdist

On Fri, Feb 14 2020 at 13:46 +0100, Michael Olbrich <m.olbrich@pengutronix.de> wrote:
> On Tue, Feb 04, 2020 at 08:53:59AM +0100, Ulrich Ölmann wrote:
>> From: Björn Esser <b.esser@pengutronix.de>
>>
>> This is a dummy package to specify and install required Node.js packages for the
>> target system.
>>
>> The management of those packages and their dependencies is handled with
>> Yarn (run through host-nodejs) to maintain a reproducible offline cache that is
>> stored in local_src/nodejs_packages.
>>
>> Signed-off-by: Björn Esser <b.esser@pengutronix.de>
>> [uol: adjusted commit message and Kconfig menu file's help texts, integrated
>> Kconfig symbol NODEJS_PACKAGES_LICENSE, fixed NODEJS_PACKAGES_URL, removed one
>> square bracket in a shell test and wrapped install/cp into call of execute and
>> world/execute]
>> Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
>> ---
>> v3 --> v4: adjusted commit message and Kconfig menu file's help texts & fixed
>>            NODEJS_PACKAGES_URL
>> Range-diff of v5 against v4:
>> 3:  ccd2b44a8d92 ! 3:  1a73ebbd6e7e nodejs_packages: new package
>>     @@ Commit message
>>          stored in local_src/nodejs_packages.
>>
>>          Signed-off-by: Björn Esser <b.esser@pengutronix.de>
>>     -    [uol: adjusted commit message and Kconfig menu file's help texts & fixed
>>     -    NODEJS_PACKAGES_URL]
>>     +    [uol: adjusted commit message and Kconfig menu file's help texts, integrated
>>     +    Kconfig symbol NODEJS_PACKAGES_LICENSE, fixed NODEJS_PACKAGES_URL, removed one
>>     +    square bracket in a shell test and wrapped install/cp into call of execute and
>>     +    world/execute]
>>          Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
>>
>>       ## rules/nodejs_packages.in (new) ##
>>     @@ rules/nodejs_packages.in (new)
>>      +
>>      +	  [1] https://legacy.yarnpkg.com/en/docs/dependency-versions/
>>      +
>>     ++config NODEJS_PACKAGES_LICENSE
>>     ++	string
>>     ++	prompt "Licenses of to be installed Node.js packages"
>>     ++	default "unknown"
>>     ++	help
>>     ++	  Manually compiled list of licenses that the to be installed Node.js
>>     ++	  packages are distributed under, see description of the variable
>>     ++	  *_LICENSE in [1].
>>     ++
>>     ++	  ATTENTION: be aware of the fact that Node.js packages usually depend
>>     ++	  on additional Node.js packages that Yarn installs as well and that
>>     ++	  this propagates recursively resulting in an unknown number of Node.js
>>     ++	  packages on the target with an unknown set of licenses that they may
>>     ++	  be utilized under. Hence you carefully need to examine all of them
>>     ++	  individually to create a reliable list of licenses.
>>     ++
>>     ++	  [1] https://www.ptxdist.org/doc/dev_manual.html#some-notes-about-licenses
>>     ++
>>      +config NODEJS_PACKAGES_OFFLINE
>>      +	bool
>>     -+	prompt "lock offline cache for offline/production use"
>>     ++	prompt "Lock offline cache for offline/production use"
>>      +	help
>>     -+	  This option locks the offline cache for installing the nodejs packages
>>     -+	  and allows their installation during the build of the BSP without any
>>     -+	  need for internet connectivity.
>>     ++	  This option locks the offline cache for installing the Node.js
>>     ++	  packages and allows their installation during the build of the BSP
>>     ++	  without any need for internet connectivity.
>>      +
>>      +	  Enabling this option is highly recommended for production use.
>>      +
>>     @@ rules/nodejs_packages.make (new)
>>      +NODEJS_PACKAGES_URL	:= lndir://$(PTXDIST_WORKSPACE)/$(NODEJS_PACKAGES_LOCAL)
>>      +NODEJS_PACKAGES_DIR	:= $(BUILDDIR)/$(NODEJS_PACKAGES)
>>      +NODEJS_PACKAGES_CACHE	:= $(PTXDIST_WORKSPACE)/$(NODEJS_PACKAGES_LOCAL)/yarn_cache
>>     -+NODEJS_PACKAGES_LICENSE	:= unknown
>>     ++NODEJS_PACKAGES_LICENSE	:= $(call remove_quotes, $(PTXCONF_NODEJS_PACKAGES_LICENSE))
>>      +
>>      +NODEJS_PACKAGES_LIST	:= $(call remove_quotes, $(PTXCONF_NODEJS_PACKAGES_LIST))
>>      +
>>     @@ rules/nodejs_packages.make (new)
>>      +		\"license\": \"UNLICENSED\", \
>>      +		\"private\": true \
>>      +	}" > $(NODEJS_PACKAGES_DIR)/package.json
>>     -+	if [[ ! -f $(YARN_LOCK) ]]; then \
>>     ++	if [ ! -f $(YARN_LOCK) ]; then \
>>      +		touch $(YARN_LOCK); \
>>      +		ln -fs $(YARN_LOCK) $(NODEJS_PACKAGES_DIR)/yarn.lock; \
>>      +	fi
>>     @@ rules/nodejs_packages.make (new)
>>      +
>>      +$(STATEDIR)/nodejs_packages.install:
>>      +	@$(call targetinfo)
>>     -+	install -dm 0755 $(NODEJS_PACKAGES_PKGDIR)/usr/lib
>>     -+	cp -pr $(NODEJS_PACKAGES_DIR)/node_modules $(NODEJS_PACKAGES_PKGDIR)/usr/lib
>>     ++	@$(call world/execute, HOST_UA_NODESET, \
>>     ++		install -dm 0755 $(NODEJS_PACKAGES_PKGDIR)/usr/lib)
>>     ++	@$(call execute, HOST_UA_NODESET, \
>>     ++		cp -pr $(NODEJS_PACKAGES_DIR)/node_modules \
>>     ++			$(NODEJS_PACKAGES_PKGDIR)/usr/lib)
>>      +	@$(call touch)
>>      +
>>      +# ----------------------------------------------------------------------------
>>
>>  rules/nodejs_packages.in   | 73 ++++++++++++++++++++++++++++++
>>  rules/nodejs_packages.make | 93 ++++++++++++++++++++++++++++++++++++++
>>  2 files changed, 166 insertions(+)
>>  create mode 100644 rules/nodejs_packages.in
>>  create mode 100644 rules/nodejs_packages.make
>>
>> diff --git a/rules/nodejs_packages.in b/rules/nodejs_packages.in
>> new file mode 100644
>> index 000000000000..aea44205da41
>> --- /dev/null
>> +++ b/rules/nodejs_packages.in
>> @@ -0,0 +1,73 @@
>> +## SECTION=bytecode_engines
>> +
>> +menuconfig NODEJS_PACKAGES
>> +	tristate
>> +	select HOST_YARN
>> +	select NODEJS
>> +	prompt "Node.js packages (target)     "
>> +	help
>> +	  Reproducibly install Node.js packages that will be available
>> +	  system-wide on the target.
>> +
>> +	  You MUST specify at least one Node.js package in the submenu that is
>> +	  shown after enabling this option.
>> +
>> +
>> +if NODEJS_PACKAGES
>> +
>> +config NODEJS_PACKAGES_LIST
>> +	string
>> +	prompt "Node.js packages to install"
>> +	help
>> +	  A white-space separated list of Node.js packages including their
>> +	  versions (e.g. express@4.17.x or socket.io@'>=2.1.0 <=2.3.0'). NPM
>> +	  semvers are fully supported, see [1].
>> +
>> +	  The packages are managed with Yarn and are guaranteed to be
>> +	  reproducible and immutable as long as the download location stays
>> +	  accessible or the offline cache is not altered.
>> +
>> +	  If the list of Node.js packages to be installed has been populated for
>> +	  the first time or if it has been modified later on one needs to
>> +	  (re-)build this package to download the desired Node.js packages and
>> +	  update the offline cache. Afterwards it is highly recommended to
>> +	  commit the path '${PTXDIST_WORKSPACE}/local_src/nodejs_packages/' into
>> +	  the version control system and to lock the package cache.
>> +
>> +	  As a prerequisite the path '${PTXDIST_WORKSPACE}/local_src/nodejs_
>> +	  packages/' must exist in the BSP *before* building this package.
>> +
>> +	  [1] https://legacy.yarnpkg.com/en/docs/dependency-versions/
>> +
>> +config NODEJS_PACKAGES_LICENSE
>> +	string
>> +	prompt "Licenses of to be installed Node.js packages"
>> +	default "unknown"
>> +	help
>> +	  Manually compiled list of licenses that the to be installed Node.js
>> +	  packages are distributed under, see description of the variable
>> +	  *_LICENSE in [1].
>> +
>> +	  ATTENTION: be aware of the fact that Node.js packages usually depend
>> +	  on additional Node.js packages that Yarn installs as well and that
>> +	  this propagates recursively resulting in an unknown number of Node.js
>> +	  packages on the target with an unknown set of licenses that they may
>> +	  be utilized under. Hence you carefully need to examine all of them
>> +	  individually to create a reliable list of licenses.
>> +
>> +	  [1] https://www.ptxdist.org/doc/dev_manual.html#some-notes-about-licenses
>> +
>> +config NODEJS_PACKAGES_OFFLINE
>> +	bool
>> +	prompt "Lock offline cache for offline/production use"
>> +	help
>> +	  This option locks the offline cache for installing the Node.js
>> +	  packages and allows their installation during the build of the BSP
>> +	  without any need for internet connectivity.
>> +
>> +	  Enabling this option is highly recommended for production use.
>> +
>> +	  Do NOT forget to commit the path '${PTXDIST_WORKSPACE}/local_src/
>> +	  nodejs_packages/' into the BSP's version control system!
>> +
>> +endif
>> diff --git a/rules/nodejs_packages.make b/rules/nodejs_packages.make
>> new file mode 100644
>> index 000000000000..cdde30f38b0c
>> --- /dev/null
>> +++ b/rules/nodejs_packages.make
>> @@ -0,0 +1,93 @@
>> +# -*-makefile-*-
>> +#
>> +# Copyright (C) 2020 by Bjoern Esser <bes@pengutronix.de>
>> +#
>> +# For further information about the PTXdist project and license conditions
>> +# see the README file.
>> +#
>> +
>> +#
>> +# We provide this package
>> +#
>> +PACKAGES-$(PTXCONF_NODEJS_PACKAGES) += nodejs_packages
>> +
>> +#
>> +# Paths and names
>> +#
>> +NODEJS_PACKAGES_VERSION	:= 0.0.1
>> +NODEJS_PACKAGES		:= nodejs_packages-$(NODEJS_PACKAGES_VERSION)
>> +NODEJS_PACKAGES_LOCAL	:= local_src/nodejs_packages
>> +NODEJS_PACKAGES_URL	:= lndir://$(PTXDIST_WORKSPACE)/$(NODEJS_PACKAGES_LOCAL)
>> +NODEJS_PACKAGES_DIR	:= $(BUILDDIR)/$(NODEJS_PACKAGES)
>> +NODEJS_PACKAGES_CACHE	:= $(PTXDIST_WORKSPACE)/$(NODEJS_PACKAGES_LOCAL)/yarn_cache
>> +NODEJS_PACKAGES_LICENSE	:= $(call remove_quotes, $(PTXCONF_NODEJS_PACKAGES_LICENSE))
>> +
>> +NODEJS_PACKAGES_LIST	:= $(call remove_quotes, $(PTXCONF_NODEJS_PACKAGES_LIST))
>> +
>> +YARN_LOCK	:= $(PTXDIST_WORKSPACE)/$(NODEJS_PACKAGES_LOCAL)/yarn.lock
>> +YARN_OPTS	:= \
>> +	--cwd "$(NODEJS_PACKAGES_DIR)" \
>> +	--cache-folder "$(NODEJS_PACKAGES_CACHE)" \
>> +	--link-duplicates \
>> +	--production=true
>> +
>> +ifdef PTXCONF_NODEJS_PACKAGES_OFFLINE
>> +YARN_OPTS	+= \
>> +	--frozen-lockfile \
>> +	--offline
>> +endif
>> +
>> +# ----------------------------------------------------------------------------
>> +# Compile
>> +# ----------------------------------------------------------------------------
>> +
>> +$(STATEDIR)/nodejs_packages.compile:
>> +	@$(call targetinfo)
>> +	mkdir -p $(NODEJS_PACKAGES_CACHE)
>> +	printf "{ \
>> +		\"name\": \"nodejs_packages\", \
>> +		\"version\": \"$(NODEJS_PACKAGES_VERSION)\", \
>> +		\"license\": \"UNLICENSED\", \
>> +		\"private\": true \
>> +	}" > $(NODEJS_PACKAGES_DIR)/package.json
>> +	if [ ! -f $(YARN_LOCK) ]; then \
>> +		touch $(YARN_LOCK); \
>> +		ln -fs $(YARN_LOCK) $(NODEJS_PACKAGES_DIR)/yarn.lock; \
>> +	fi
>
> I think we should fail here if NODEJS_PACKAGES_OFFLINE is set and the lock
> file is missing. Or will yarn produce a sensible error message in this
> case?

Unfortunately Yarn is not stumbling across a missing lock file so I
added a check for PTXdist to bail out in that case in v6 of the patch
series.

>> +	yarn $(YARN_OPTS) add $(NODEJS_PACKAGES_LIST)
>> +	find $(NODEJS_PACKAGES_CACHE) -type f -name '.yarn-tarball.tgz' -delete
>> +	@$(call touch)
>> +
>> +# ----------------------------------------------------------------------------
>> +# Install
>> +# ----------------------------------------------------------------------------
>> +
>> +$(STATEDIR)/nodejs_packages.install:
>> +	@$(call targetinfo)
>> +	@$(call world/execute, HOST_UA_NODESET, \
>> +		install -dm 0755 $(NODEJS_PACKAGES_PKGDIR)/usr/lib)
>
> add -v to make it visible at runtime.

Did that in v6 of the patch series.

>> +	@$(call execute, HOST_UA_NODESET, \
>> +		cp -pr $(NODEJS_PACKAGES_DIR)/node_modules \
>> +			$(NODEJS_PACKAGES_PKGDIR)/usr/lib)
>
> Here as well.

See v6 of the patch series.

Best regards
Ulrich


> Michael
>
>> +	@$(call touch)
>> +
>> +# ----------------------------------------------------------------------------
>> +# Target-Install
>> +# ----------------------------------------------------------------------------
>> +
>> +$(STATEDIR)/nodejs_packages.targetinstall:
>> +	@$(call targetinfo)
>> +
>> +	@$(call install_init, nodejs_packages)
>> +	@$(call install_fixup, nodejs_packages,PRIORITY,optional)
>> +	@$(call install_fixup, nodejs_packages,SECTION,base)
>> +	@$(call install_fixup, nodejs_packages,AUTHOR,"Bjoern Esser <bes@pengutronix.de>")
>> +	@$(call install_fixup, nodejs_packages,DESCRIPTION,missing)
>> +
>> +	$(call install_tree, nodejs_packages, 0, 0, -, /usr/lib/node_modules/)
>> +
>> +	@$(call install_finish, nodejs_packages)
>> +
>> +	@$(call touch)
>> +
>> +# vim: syntax=make
>> --
>> 2.25.0
>>
>>
>> _______________________________________________
>> ptxdist mailing list
>> ptxdist@pengutronix.de
-- 
Pengutronix e.K.                           | Ulrich Ölmann               |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

end of thread, other threads:[~2020-03-18 15:48 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-04  7:53 [ptxdist] [PATCH v5 1/3] nodejs: version bump 6.9.5 -> 12.14.1 LTS Ulrich Ölmann
2020-02-04  7:53 ` [ptxdist] [PATCH v5 2/3] host-yarn: new package Ulrich Ölmann
2020-02-21  8:26   ` Juergen Borleis
2020-03-18 15:46     ` Ulrich Ölmann
2020-02-04  7:53 ` [ptxdist] [PATCH v5 3/3] nodejs_packages: " Ulrich Ölmann
2020-02-14 12:46   ` Michael Olbrich
2020-03-18 15:48     ` Ulrich Ölmann
2020-02-17  9:40 ` [ptxdist] [PATCH v5 1/3] nodejs: version bump 6.9.5 -> 12.14.1 LTS Michael Olbrich
2020-03-18 15:44   ` Ulrich Ölmann
2020-02-21  8:22 ` Juergen Borleis
2020-03-18 15:45   ` Ulrich Ölmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox