]> code.ossystems Code Review - openembedded-core.git/commitdiff
npm.bbclass: Allow nodedir to be overridden by NPM_NODEDIR
authorMike Crowe <mac@mcrowe.com>
Thu, 13 May 2021 14:25:03 +0000 (15:25 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 14 May 2021 06:57:21 +0000 (07:57 +0100)
Node modules may need to be built against multiple Node
versions. Setting nodedir in the NPM configuration stops older ways of
doing this, such as setting npm_config_target and npm_config_disturl,
from working.

Signed-off-by: Mike Crowe <mac@mcrowe.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/npm.bbclass

index 55a6985fb029e6ff38557025645c9b39e9474028..8f8712a0242fe0473f38e9245845229bfae1a6f5 100644 (file)
@@ -247,8 +247,10 @@ python npm_do_compile() {
         # Add node-gyp configuration
         configs.append(("arch", d.getVar("NPM_ARCH")))
         configs.append(("release", "true"))
-        sysroot = d.getVar("RECIPE_SYSROOT_NATIVE")
-        nodedir = os.path.join(sysroot, d.getVar("prefix_native").strip("/"))
+        nodedir = d.getVar("NPM_NODEDIR")
+        if not nodedir:
+            sysroot = d.getVar("RECIPE_SYSROOT_NATIVE")
+            nodedir = os.path.join(sysroot, d.getVar("prefix_native").strip("/"))
         configs.append(("nodedir", nodedir))
         configs.append(("python", d.getVar("PYTHON")))