diff options
-rw-r--r-- | meta/classes/npm.bbclass | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/meta/classes/npm.bbclass b/meta/classes/npm.bbclass index 9843e87350..d0d3d8fa03 100644 --- a/meta/classes/npm.bbclass +++ b/meta/classes/npm.bbclass | |||
@@ -3,6 +3,17 @@ S = "${WORKDIR}/npmpkg" | |||
3 | 3 | ||
4 | NPM_INSTALLDIR = "${D}${libdir}/node_modules/${PN}" | 4 | NPM_INSTALLDIR = "${D}${libdir}/node_modules/${PN}" |
5 | 5 | ||
6 | # function maps arch names to npm arch names | ||
7 | def npm_oe_arch_map(target_arch, d): | ||
8 | import re | ||
9 | if re.match('p(pc|owerpc)(|64)', target_arch): return 'ppc' | ||
10 | elif re.match('i.86$', target_arch): return 'ia32' | ||
11 | elif re.match('x86_64$', target_arch): return 'x64' | ||
12 | elif re.match('arm64$', target_arch): return 'arm' | ||
13 | return target_arch | ||
14 | |||
15 | NPM_ARCH ?= "${@npm_oe_arch_map(d.getVar('TARGET_ARCH', True), d)}" | ||
16 | |||
6 | npm_do_compile() { | 17 | npm_do_compile() { |
7 | # changing the home directory to the working directory, the .npmrc will | 18 | # changing the home directory to the working directory, the .npmrc will |
8 | # be created in this directory | 19 | # be created in this directory |
@@ -12,7 +23,7 @@ npm_do_compile() { | |||
12 | # clear cache before every build | 23 | # clear cache before every build |
13 | npm cache clear | 24 | npm cache clear |
14 | # Install pkg into ${S} without going to the registry | 25 | # Install pkg into ${S} without going to the registry |
15 | npm --arch=${TARGET_ARCH} --production --no-registry install | 26 | npm --arch=${NPM_ARCH} --target_arch=${NPM_ARCH} --production --no-registry install |
16 | } | 27 | } |
17 | 28 | ||
18 | npm_do_install() { | 29 | npm_do_install() { |