* [Buildroot] [PATCH 0/2] Update host-nodejs and build vuejs from source
@ 2022-09-13 17:40 Thomas Claveirole
2022-09-13 17:40 ` [Buildroot] [PATCH 1/2] package/nodejs: introduce BR2_PACKAGE_HOST_NODEJS_COREPACK Thomas Claveirole
2022-09-13 17:40 ` [Buildroot] [PATCH 2/2] package/vuejs: bump to version 3.2.39 Thomas Claveirole
0 siblings, 2 replies; 10+ messages in thread
From: Thomas Claveirole @ 2022-09-13 17:40 UTC (permalink / raw)
To: buildroot; +Cc: Thomas Claveirole, Martin Bark, Johan Oudinet, Daniel Price
In order to bump vuejs, I wanted to get rid of the infamous:
VUEJS_SITE = https://registry.npmjs.org/vue/-
in vuejs.mk, and rely instead on host-nodejs to build the JavaScript
library from its source archive on GitHub. However, it turns out
Vue.js relies on pnpm [1], another package manager...
... Fortunately, Node.js comes with Corepack [2], a transparent
wrapper that takes care of pnpm, but one has to enable it at install
time. Hence, here is a series of two patches: one to add an option to
host-nodejs to enable and install Corepack, and one to bump vuejs to
its latest version, building it from its official source archive.
[1] https://pnpm.io/
[2] https://nodejs.org/api/corepack.html
Thomas Claveirole (2):
package/nodejs: introduce BR2_PACKAGE_HOST_NODEJS_COREPACK
package/vuejs: bump to version 3.2.39
DEVELOPERS | 1 +
package/nodejs/Config.in.host | 23 ++++++++++++++++---
package/nodejs/nodejs.mk | 21 +++++++++++++----
...ode-build-commit-to-v3.2.39-f79c4236.patch | 13 +++++++++++
package/vuejs/Config.in | 4 ++++
package/vuejs/vuejs.hash | 2 +-
package/vuejs/vuejs.mk | 14 +++++++----
7 files changed, 66 insertions(+), 12 deletions(-)
create mode 100644 package/vuejs/0001-hardcode-build-commit-to-v3.2.39-f79c4236.patch
--
2.37.2
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 1/2] package/nodejs: introduce BR2_PACKAGE_HOST_NODEJS_COREPACK
2022-09-13 17:40 [Buildroot] [PATCH 0/2] Update host-nodejs and build vuejs from source Thomas Claveirole
@ 2022-09-13 17:40 ` Thomas Claveirole
2022-09-25 19:47 ` Thomas Petazzoni
2023-04-16 19:48 ` Yann E. MORIN
2022-09-13 17:40 ` [Buildroot] [PATCH 2/2] package/vuejs: bump to version 3.2.39 Thomas Claveirole
1 sibling, 2 replies; 10+ messages in thread
From: Thomas Claveirole @ 2022-09-13 17:40 UTC (permalink / raw)
To: buildroot; +Cc: Thomas Claveirole, Martin Bark, Johan Oudinet, Daniel Price
Corepack is a zero-runtime-dependency Node.js script that acts as a
bridge between Node.js projects and the package managers. It ships
with Node.js but is disabled by default.
Some JavaScript packages, such as vuejs and vuejs-router can benefit
from having Corepack installed on the host. Therefore, add an option
to enable Corepack with host-nodejs.
Signed-off-by: Thomas Claveirole <thomas.claveirole@green-communications.fr>
---
package/nodejs/Config.in.host | 23 ++++++++++++++++++++---
package/nodejs/nodejs.mk | 21 +++++++++++++++++----
2 files changed, 37 insertions(+), 7 deletions(-)
diff --git a/package/nodejs/Config.in.host b/package/nodejs/Config.in.host
index 4ceaf0c73e..316a02d9d6 100644
--- a/package/nodejs/Config.in.host
+++ b/package/nodejs/Config.in.host
@@ -1,3 +1,7 @@
+comment "host nodejs needs a host gcc >= 8"
+ depends on BR2_PACKAGE_HOST_QEMU_USER_ARCH_SUPPORTS
+ depends on !BR2_HOST_GCC_AT_LEAST_8
+
config BR2_PACKAGE_HOST_NODEJS
bool "host nodejs"
depends on BR2_PACKAGE_HOST_QEMU_USER_ARCH_SUPPORTS
@@ -13,6 +17,19 @@ config BR2_PACKAGE_HOST_NODEJS
http://nodejs.org/
-comment "host nodejs needs a host gcc >= 8"
- depends on BR2_PACKAGE_HOST_QEMU_USER_ARCH_SUPPORTS
- depends on !BR2_HOST_GCC_AT_LEAST_8
+if BR2_PACKAGE_HOST_NODEJS
+
+config BR2_PACKAGE_HOST_NODEJS_COREPACK
+ bool "Corepack"
+ help
+ Enable Corepack with host nodejs.
+
+ Corepack is a zero-runtime-dependency Node.js script that
+ acts as a bridge between Node.js projects and the package
+ managers they are intended to be used with during
+ development. In practical terms, Corepack will let you use
+ Yarn and pnpm without having to install them - just like
+ what currently happens with npm, which is shipped by Node.js
+ by default.
+
+endif
diff --git a/package/nodejs/nodejs.mk b/package/nodejs/nodejs.mk
index 3154dcd7ec..1a95e1351f 100644
--- a/package/nodejs/nodejs.mk
+++ b/package/nodejs/nodejs.mk
@@ -117,6 +117,12 @@ define HOST_NODEJS_BUILD_CMDS
$(HOST_NODEJS_MAKE_OPTS)
endef
+ifeq ($(BR2_PACKAGE_HOST_NODEJS_COREPACK),y)
+define HOST_NODEJS_ENABLE_COREPACK
+ $(COREPACK) enable
+endef
+endif
+
define HOST_NODEJS_INSTALL_CMDS
$(HOST_MAKE_ENV) PYTHON=$(HOST_DIR)/bin/python3 \
$(MAKE) -C $(@D) install \
@@ -125,6 +131,7 @@ define HOST_NODEJS_INSTALL_CMDS
$(foreach f,$(NODEJS_HOST_TOOLS), \
$(INSTALL) -m755 -D $(@D)/out/Release/$(f) $(HOST_DIR)/bin/$(f)
)
+ $(HOST_NODEJS_ENABLE_COREPACK)
endef
ifeq ($(BR2_i386),y)
@@ -235,8 +242,7 @@ endef
NODEJS_MODULES_LIST= $(call qstrip,\
$(BR2_PACKAGE_NODEJS_MODULES_ADDITIONAL))
-# Define NPM for other packages to use
-NPM = $(TARGET_CONFIGURE_OPTS) \
+NODEJS_BIN_ENV = $(TARGET_CONFIGURE_OPTS) \
LDFLAGS="$(NODEJS_LDFLAGS)" \
LD="$(TARGET_CXX)" \
npm_config_arch=$(NODEJS_CPU) \
@@ -244,8 +250,15 @@ NPM = $(TARGET_CONFIGURE_OPTS) \
npm_config_build_from_source=true \
npm_config_nodedir=$(BUILD_DIR)/nodejs-$(NODEJS_VERSION) \
npm_config_prefix=$(TARGET_DIR)/usr \
- npm_config_cache=$(BUILD_DIR)/.npm-cache \
- $(HOST_DIR)/bin/npm
+ npm_config_cache=$(BUILD_DIR)/.npm-cache
+
+# Define various packaging tools for other packages to use
+NPM = $(NODEJS_BIN_ENV) $(HOST_DIR)/bin/npm
+ifeq ($(BR2_PACKAGE_HOST_NODEJS_COREPACK),y)
+COREPACK = $(NODEJS_BIN_ENV) $(HOST_DIR)/bin/corepack
+PNPM = $(NODEJS_BIN_ENV) $(HOST_DIR)/bin/pnpm
+YARN = $(NODEJS_BIN_ENV) $(HOST_DIR)/bin/yarn
+endif
#
# We can only call NPM if there's something to install.
--
2.37.2
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 2/2] package/vuejs: bump to version 3.2.39
2022-09-13 17:40 [Buildroot] [PATCH 0/2] Update host-nodejs and build vuejs from source Thomas Claveirole
2022-09-13 17:40 ` [Buildroot] [PATCH 1/2] package/nodejs: introduce BR2_PACKAGE_HOST_NODEJS_COREPACK Thomas Claveirole
@ 2022-09-13 17:40 ` Thomas Claveirole
1 sibling, 0 replies; 10+ messages in thread
From: Thomas Claveirole @ 2022-09-13 17:40 UTC (permalink / raw)
To: buildroot; +Cc: Thomas Claveirole, Martin Bark, Johan Oudinet, Daniel Price
Signed-off-by: Thomas Claveirole <thomas.claveirole@green-communications.fr>
---
DEVELOPERS | 1 +
...hardcode-build-commit-to-v3.2.39-f79c4236.patch | 13 +++++++++++++
package/vuejs/Config.in | 4 ++++
package/vuejs/vuejs.hash | 2 +-
package/vuejs/vuejs.mk | 14 ++++++++++----
5 files changed, 29 insertions(+), 5 deletions(-)
create mode 100644 package/vuejs/0001-hardcode-build-commit-to-v3.2.39-f79c4236.patch
diff --git a/DEVELOPERS b/DEVELOPERS
index a707b0e5e1..fd32716282 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2818,6 +2818,7 @@ F: package/x265/
N: Thomas Claveirole <thomas.claveirole@green-communications.fr>
F: package/fcgiwrap/
F: package/openlayers/
+F: package/vuejs/
F: package/vuejs-router/
N: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
diff --git a/package/vuejs/0001-hardcode-build-commit-to-v3.2.39-f79c4236.patch b/package/vuejs/0001-hardcode-build-commit-to-v3.2.39-f79c4236.patch
new file mode 100644
index 0000000000..11a84e5c83
--- /dev/null
+++ b/package/vuejs/0001-hardcode-build-commit-to-v3.2.39-f79c4236.patch
@@ -0,0 +1,13 @@
+diff --git a/scripts/build.js b/scripts/build.js
+index efa5d7f0..f577dc61 100644
+--- a/scripts/build.js
++++ b/scripts/build.js
+@@ -31,7 +31,7 @@ const sourceMap = args.sourcemap || args.s
+ const isRelease = args.release
+ const buildTypes = args.t || args.types || isRelease
+ const buildAllMatching = args.all || args.a
+-const commit = execa.sync('git', ['rev-parse', 'HEAD']).stdout.slice(0, 7)
++const commit = "f79c4236"
+
+ run()
+
diff --git a/package/vuejs/Config.in b/package/vuejs/Config.in
index 6456d288f9..5413de0a01 100644
--- a/package/vuejs/Config.in
+++ b/package/vuejs/Config.in
@@ -1,5 +1,9 @@
config BR2_PACKAGE_VUEJS
bool "vuejs"
+ depends on BR2_PACKAGE_HOST_QEMU_USER_ARCH_SUPPORTS # host-nodejs
+ depends on BR2_HOST_GCC_AT_LEAST_8 # host-nodejs
+ select BR2_PACKAGE_HOST_NODEJS
+ select BR2_PACKAGE_HOST_NODEJS_COREPACK
help
VueJS web application framework.
diff --git a/package/vuejs/vuejs.hash b/package/vuejs/vuejs.hash
index c53364e97d..5218cce0b2 100644
--- a/package/vuejs/vuejs.hash
+++ b/package/vuejs/vuejs.hash
@@ -1,3 +1,3 @@
# Locally computed
-sha256 042033a2a8e6d45f750924953f03c34058d5afd9cc1571fbaf1827eaf04f6943 vue-3.2.33.tgz
+sha256 de7ce8e2493ac8f78f7cc0c31a4c7c3874ca9392bfa38dfb1ef5471e65adde31 vuejs-3.2.39.tar.gz
sha256 1bb85cc9b13b81ef41c81c51866172fc345e0503c86726a6755b796590b70175 LICENSE
diff --git a/package/vuejs/vuejs.mk b/package/vuejs/vuejs.mk
index d544124bbc..3e80d5519b 100644
--- a/package/vuejs/vuejs.mk
+++ b/package/vuejs/vuejs.mk
@@ -4,15 +4,21 @@
#
################################################################################
-VUEJS_VERSION = 3.2.33
-VUEJS_SOURCE = vue-$(VUEJS_VERSION).tgz
-VUEJS_SITE = https://registry.npmjs.org/vue/-
+VUEJS_VERSION = 3.2.39
+VUEJS_SITE = $(call github,vuejs,core,v$(VUEJS_VERSION))
VUEJS_LICENSE = MIT
VUEJS_LICENSE_FILES = LICENSE
+VUEJS_DEPENDENCIES = host-nodejs
+
+# See https://github.com/vuejs/core/blob/main/.github/contributing.md#development-setup
+define VUEJS_BUILD_CMDS
+ cd $(@D) && $(PNPM) install && $(NPM) run build -- vue -f global
+endef
+
# Install .prod.js as .js
define VUEJS_INSTALL_TARGET_CMDS
- $(INSTALL) -m 644 -D $(@D)/dist/vue.global.prod.js \
+ $(INSTALL) -m 644 -D $(@D)/packages/vue/dist/vue.global.prod.js \
$(TARGET_DIR)/var/www/vue.js
endef
--
2.37.2
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [Buildroot] [PATCH 1/2] package/nodejs: introduce BR2_PACKAGE_HOST_NODEJS_COREPACK
2022-09-13 17:40 ` [Buildroot] [PATCH 1/2] package/nodejs: introduce BR2_PACKAGE_HOST_NODEJS_COREPACK Thomas Claveirole
@ 2022-09-25 19:47 ` Thomas Petazzoni
2022-09-25 19:53 ` Thomas Petazzoni
2023-04-16 19:48 ` Yann E. MORIN
1 sibling, 1 reply; 10+ messages in thread
From: Thomas Petazzoni @ 2022-09-25 19:47 UTC (permalink / raw)
To: Thomas Claveirole; +Cc: Daniel Price, Martin Bark, Johan Oudinet, buildroot
On Tue, 13 Sep 2022 19:40:38 +0200
Thomas Claveirole <thomas.claveirole@green-communications.fr> wrote:
> +ifeq ($(BR2_PACKAGE_HOST_NODEJS_COREPACK),y)
> +define HOST_NODEJS_ENABLE_COREPACK
> + $(COREPACK) enable
> +endef
> +endif
Could you explain in a bit more details what this "corepack enable"
actually does?
Indeed, I was documenting myself a little bit on pnpm, and
https://pnpm.io/installation says that "corepack enable" will
"automatically install pnpm on your system".
So is "corepack enable" download extra stuff? If so, it's not great at
all to have this executed as part of the installation step of a
package. Or is pnpm shipped as part of nodejs, and that simply installs
it?
Thanks!
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Buildroot] [PATCH 1/2] package/nodejs: introduce BR2_PACKAGE_HOST_NODEJS_COREPACK
2022-09-25 19:47 ` Thomas Petazzoni
@ 2022-09-25 19:53 ` Thomas Petazzoni
2022-09-26 9:04 ` Thomas Claveirole
0 siblings, 1 reply; 10+ messages in thread
From: Thomas Petazzoni @ 2022-09-25 19:53 UTC (permalink / raw)
To: Thomas Claveirole; +Cc: Daniel Price, Martin Bark, Johan Oudinet, buildroot
On Sun, 25 Sep 2022 21:47:00 +0200
Thomas Petazzoni <thomas.petazzoni@bootlin.com> wrote:
> So is "corepack enable" download extra stuff? If so, it's not great at
> all to have this executed as part of the installation step of a
> package. Or is pnpm shipped as part of nodejs, and that simply installs
> it?
Replying to myself: "corepack enable" does not download stuff. I tried
in a Docker container with no network access, and it did this work,
which apparently consists in just creating a bunch of symlinks.
So that sounds good.
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Buildroot] [PATCH 1/2] package/nodejs: introduce BR2_PACKAGE_HOST_NODEJS_COREPACK
2022-09-25 19:53 ` Thomas Petazzoni
@ 2022-09-26 9:04 ` Thomas Claveirole
2022-09-26 10:01 ` Thomas Petazzoni
0 siblings, 1 reply; 10+ messages in thread
From: Thomas Claveirole @ 2022-09-26 9:04 UTC (permalink / raw)
To: Thomas Petazzoni; +Cc: Daniel Price, Martin Bark, Johan Oudinet, buildroot
[-- Attachment #1.1: Type: text/plain, Size: 1090 bytes --]
> Replying to myself: "corepack enable" does not download stuff. [...]
It sounds good indeed. To be honest, all this Node packaging gets a bit over
my head and I am not sure how it works exactly (the whole JavaScript packaging
ecosystem just looks crazy to me). I usually just use compiled JavaScript
files and almost never compile them myself.
I thought that using host-nodejs to compile JavaScript packages was a new
Buildroot policy, but apparently according to [1] and [2] we prefer to stick
to precompiled JavaScript files? If so, I will send a v2 patch for the vuejs
package (... when I find some time.)
[1] https://lore.kernel.org/buildroot/20220919114617.67d80b53@windsurf/
[2] https://lore.kernel.org/buildroot/20220924170516.4a0323dc@windsurf/
(As for my opinion, should it have any relevance: I also prefer that Buildroot
relies on pre-compiled files, at least as long as it cannot do some vendoring
for Node packages. Downloading stuff outside of Buildroot's download system
is quite annoying.)
--
Thomas Claveirole <thomas.claveirole@green-communications.fr>
[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 150 bytes --]
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Buildroot] [PATCH 1/2] package/nodejs: introduce BR2_PACKAGE_HOST_NODEJS_COREPACK
2022-09-26 9:04 ` Thomas Claveirole
@ 2022-09-26 10:01 ` Thomas Petazzoni
2022-09-26 10:17 ` Johan Oudinet
0 siblings, 1 reply; 10+ messages in thread
From: Thomas Petazzoni @ 2022-09-26 10:01 UTC (permalink / raw)
To: Thomas Claveirole; +Cc: Daniel Price, Martin Bark, Johan Oudinet, buildroot
Hello Thomas,
On Mon, 26 Sep 2022 11:04:38 +0200
Thomas Claveirole <thomas.claveirole@green-communications.fr> wrote:
> > Replying to myself: "corepack enable" does not download stuff. [...]
>
> It sounds good indeed. To be honest, all this Node packaging gets a bit over
> my head and I am not sure how it works exactly (the whole JavaScript packaging
> ecosystem just looks crazy to me).
You're not the only one with the same feeling :-)
> I thought that using host-nodejs to compile JavaScript packages was a new
> Buildroot policy, but apparently according to [1] and [2] we prefer to stick
> to precompiled JavaScript files? If so, I will send a v2 patch for the vuejs
> package (... when I find some time.)
>
> [1] https://lore.kernel.org/buildroot/20220919114617.67d80b53@windsurf/
> [2] https://lore.kernel.org/buildroot/20220924170516.4a0323dc@windsurf/
>
> (As for my opinion, should it have any relevance: I also prefer that Buildroot
> relies on pre-compiled files, at least as long as it cannot do some vendoring
> for Node packages. Downloading stuff outside of Buildroot's download system
> is quite annoying.)
So, as explained in
https://lore.kernel.org/buildroot/20220919114617.67d80b53@windsurf/
(which you pointed above), if we want to build from source these JS
stuff, we need two things:
- Be able to use a pre-built NodeJS on the host, because adding a
dependency on building host-nodejs from source is really too heavy
to build just a few JS files. I have submitted yesterday a RFC patch
series that implements this.
- Be able to vendor JS dependencies. I already started working on it,
and it does work with npm, but my test package (forge) only
provides a package.json to describe dependencies, so they are not
locked and therefore not reproducible. However, it looks like many
other packages, including vuejs, provide a pnpm-lock.yaml, which
apparently allow a reproducible fetching of dependencies. Which is
why I got into what pnpm is, and how to install it, and got to your
corepack-related patch :-)
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Buildroot] [PATCH 1/2] package/nodejs: introduce BR2_PACKAGE_HOST_NODEJS_COREPACK
2022-09-26 10:01 ` Thomas Petazzoni
@ 2022-09-26 10:17 ` Johan Oudinet
2022-09-26 10:24 ` Thomas Petazzoni
0 siblings, 1 reply; 10+ messages in thread
From: Johan Oudinet @ 2022-09-26 10:17 UTC (permalink / raw)
To: Thomas Petazzoni; +Cc: Daniel Price, Thomas Claveirole, Martin Bark, buildroot
Hi Thomas, All,
On Mon, Sep 26, 2022 at 12:01 PM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
> - Be able to vendor JS dependencies. I already started working on it,
> and it does work with npm, but my test package (forge) only
> provides a package.json to describe dependencies, so they are not
> locked and therefore not reproducible.
That's a good point. I'll report this issue to forge developers. Every
npm packages should have a package-lock.json file in their repository.
--
Johan
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Buildroot] [PATCH 1/2] package/nodejs: introduce BR2_PACKAGE_HOST_NODEJS_COREPACK
2022-09-26 10:17 ` Johan Oudinet
@ 2022-09-26 10:24 ` Thomas Petazzoni
0 siblings, 0 replies; 10+ messages in thread
From: Thomas Petazzoni @ 2022-09-26 10:24 UTC (permalink / raw)
To: Johan Oudinet; +Cc: Daniel Price, Thomas Claveirole, Martin Bark, buildroot
On Mon, 26 Sep 2022 12:17:04 +0200
Johan Oudinet <johan.oudinet@gmail.com> wrote:
> That's a good point. I'll report this issue to forge developers. Every
> npm packages should have a package-lock.json file in their repository.
See https://github.com/digitalbazaar/forge/issues/1005.
Best regards,
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Buildroot] [PATCH 1/2] package/nodejs: introduce BR2_PACKAGE_HOST_NODEJS_COREPACK
2022-09-13 17:40 ` [Buildroot] [PATCH 1/2] package/nodejs: introduce BR2_PACKAGE_HOST_NODEJS_COREPACK Thomas Claveirole
2022-09-25 19:47 ` Thomas Petazzoni
@ 2023-04-16 19:48 ` Yann E. MORIN
1 sibling, 0 replies; 10+ messages in thread
From: Yann E. MORIN @ 2023-04-16 19:48 UTC (permalink / raw)
To: Thomas Claveirole; +Cc: Daniel Price, Martin Bark, Johan Oudinet, buildroot
Thomas C., All,
On 2022-09-13 19:40 +0200, Thomas Claveirole spake thusly:
> Corepack is a zero-runtime-dependency Node.js script that acts as a
> bridge between Node.js projects and the package managers. It ships
> with Node.js but is disabled by default.
>
> Some JavaScript packages, such as vuejs and vuejs-router can benefit
> from having Corepack installed on the host. Therefore, add an option
> to enable Corepack with host-nodejs.
>
> Signed-off-by: Thomas Claveirole <thomas.claveirole@green-communications.fr>
My understanding of the thread, is that this patch was introduced to be
able to build vuejs, which you bumped in the following patch.
Yet, the consensus was that we could bump vuejs and use the pre-compiled
variant, instead of needing to build host-nodejs.
However, nothing prevents us from merging the corepack feature, and
still update to the precompiled vuejs anyway.
Given the feedback from Thomas P. in the thread, I understand that
corepack is indeed working as expected, and is not actually requiring
download during the host-nodejs build itself (using it may trigger
download in the package that calls it, but that's another issue).
So, for those who perfer to always build from source at the expense of
build time (like I am), having corepack will be a useful addition.
Applied to master, thanks.
Regards,
Yann E. MORIN.
> ---
> package/nodejs/Config.in.host | 23 ++++++++++++++++++++---
> package/nodejs/nodejs.mk | 21 +++++++++++++++++----
> 2 files changed, 37 insertions(+), 7 deletions(-)
>
> diff --git a/package/nodejs/Config.in.host b/package/nodejs/Config.in.host
> index 4ceaf0c73e..316a02d9d6 100644
> --- a/package/nodejs/Config.in.host
> +++ b/package/nodejs/Config.in.host
> @@ -1,3 +1,7 @@
> +comment "host nodejs needs a host gcc >= 8"
> + depends on BR2_PACKAGE_HOST_QEMU_USER_ARCH_SUPPORTS
> + depends on !BR2_HOST_GCC_AT_LEAST_8
> +
> config BR2_PACKAGE_HOST_NODEJS
> bool "host nodejs"
> depends on BR2_PACKAGE_HOST_QEMU_USER_ARCH_SUPPORTS
> @@ -13,6 +17,19 @@ config BR2_PACKAGE_HOST_NODEJS
>
> http://nodejs.org/
>
> -comment "host nodejs needs a host gcc >= 8"
> - depends on BR2_PACKAGE_HOST_QEMU_USER_ARCH_SUPPORTS
> - depends on !BR2_HOST_GCC_AT_LEAST_8
> +if BR2_PACKAGE_HOST_NODEJS
> +
> +config BR2_PACKAGE_HOST_NODEJS_COREPACK
> + bool "Corepack"
> + help
> + Enable Corepack with host nodejs.
> +
> + Corepack is a zero-runtime-dependency Node.js script that
> + acts as a bridge between Node.js projects and the package
> + managers they are intended to be used with during
> + development. In practical terms, Corepack will let you use
> + Yarn and pnpm without having to install them - just like
> + what currently happens with npm, which is shipped by Node.js
> + by default.
> +
> +endif
> diff --git a/package/nodejs/nodejs.mk b/package/nodejs/nodejs.mk
> index 3154dcd7ec..1a95e1351f 100644
> --- a/package/nodejs/nodejs.mk
> +++ b/package/nodejs/nodejs.mk
> @@ -117,6 +117,12 @@ define HOST_NODEJS_BUILD_CMDS
> $(HOST_NODEJS_MAKE_OPTS)
> endef
>
> +ifeq ($(BR2_PACKAGE_HOST_NODEJS_COREPACK),y)
> +define HOST_NODEJS_ENABLE_COREPACK
> + $(COREPACK) enable
> +endef
> +endif
> +
> define HOST_NODEJS_INSTALL_CMDS
> $(HOST_MAKE_ENV) PYTHON=$(HOST_DIR)/bin/python3 \
> $(MAKE) -C $(@D) install \
> @@ -125,6 +131,7 @@ define HOST_NODEJS_INSTALL_CMDS
> $(foreach f,$(NODEJS_HOST_TOOLS), \
> $(INSTALL) -m755 -D $(@D)/out/Release/$(f) $(HOST_DIR)/bin/$(f)
> )
> + $(HOST_NODEJS_ENABLE_COREPACK)
> endef
>
> ifeq ($(BR2_i386),y)
> @@ -235,8 +242,7 @@ endef
> NODEJS_MODULES_LIST= $(call qstrip,\
> $(BR2_PACKAGE_NODEJS_MODULES_ADDITIONAL))
>
> -# Define NPM for other packages to use
> -NPM = $(TARGET_CONFIGURE_OPTS) \
> +NODEJS_BIN_ENV = $(TARGET_CONFIGURE_OPTS) \
> LDFLAGS="$(NODEJS_LDFLAGS)" \
> LD="$(TARGET_CXX)" \
> npm_config_arch=$(NODEJS_CPU) \
> @@ -244,8 +250,15 @@ NPM = $(TARGET_CONFIGURE_OPTS) \
> npm_config_build_from_source=true \
> npm_config_nodedir=$(BUILD_DIR)/nodejs-$(NODEJS_VERSION) \
> npm_config_prefix=$(TARGET_DIR)/usr \
> - npm_config_cache=$(BUILD_DIR)/.npm-cache \
> - $(HOST_DIR)/bin/npm
> + npm_config_cache=$(BUILD_DIR)/.npm-cache
> +
> +# Define various packaging tools for other packages to use
> +NPM = $(NODEJS_BIN_ENV) $(HOST_DIR)/bin/npm
> +ifeq ($(BR2_PACKAGE_HOST_NODEJS_COREPACK),y)
> +COREPACK = $(NODEJS_BIN_ENV) $(HOST_DIR)/bin/corepack
> +PNPM = $(NODEJS_BIN_ENV) $(HOST_DIR)/bin/pnpm
> +YARN = $(NODEJS_BIN_ENV) $(HOST_DIR)/bin/yarn
> +endif
>
> #
> # We can only call NPM if there's something to install.
> --
> 2.37.2
>
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2023-04-16 19:48 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-13 17:40 [Buildroot] [PATCH 0/2] Update host-nodejs and build vuejs from source Thomas Claveirole
2022-09-13 17:40 ` [Buildroot] [PATCH 1/2] package/nodejs: introduce BR2_PACKAGE_HOST_NODEJS_COREPACK Thomas Claveirole
2022-09-25 19:47 ` Thomas Petazzoni
2022-09-25 19:53 ` Thomas Petazzoni
2022-09-26 9:04 ` Thomas Claveirole
2022-09-26 10:01 ` Thomas Petazzoni
2022-09-26 10:17 ` Johan Oudinet
2022-09-26 10:24 ` Thomas Petazzoni
2023-04-16 19:48 ` Yann E. MORIN
2022-09-13 17:40 ` [Buildroot] [PATCH 2/2] package/vuejs: bump to version 3.2.39 Thomas Claveirole
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).