[gnome-continuous-yocto/gnomeostree-3.28-rocko: 510/8267] npm: add target_arch flag to npm
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-continuous-yocto/gnomeostree-3.28-rocko: 510/8267] npm: add target_arch flag to npm
- Date: Sat, 16 Dec 2017 20:31:41 +0000 (UTC)
commit 899358a586f03daee8568c5d6906a5d992859264
Author: Brendan Le Foll <brendan le foll intel com>
Date: Tue May 24 12:12:16 2016 +0100
npm: add target_arch flag to npm
npm takes a target_arch flag which needs to be set to do some gyp compilations
correctly. It also doesn't use the same mapping as OE for target arch so a
small function is required to make the mapping work. Function is taken from
meta-nodejs
(From OE-Core rev: f402225311e4bbb62ba9781ab274420abaac0fb4)
Signed-off-by: Brendan Le Foll <brendan le foll intel com>
Signed-off-by: Ross Burton <ross burton intel com>
Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>
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 9843e87..d0d3d8f 100644
--- a/meta/classes/npm.bbclass
+++ b/meta/classes/npm.bbclass
@@ -3,6 +3,17 @@ S = "${WORKDIR}/npmpkg"
NPM_INSTALLDIR = "${D}${libdir}/node_modules/${PN}"
+# function maps arch names to npm arch names
+def npm_oe_arch_map(target_arch, d):
+ import re
+ if re.match('p(pc|owerpc)(|64)', target_arch): return 'ppc'
+ elif re.match('i.86$', target_arch): return 'ia32'
+ elif re.match('x86_64$', target_arch): return 'x64'
+ elif re.match('arm64$', target_arch): return 'arm'
+ return target_arch
+
+NPM_ARCH ?= "${@npm_oe_arch_map(d.getVar('TARGET_ARCH', True), d)}"
+
npm_do_compile() {
# changing the home directory to the working directory, the .npmrc will
# be created in this directory
@@ -12,7 +23,7 @@ npm_do_compile() {
# clear cache before every build
npm cache clear
# Install pkg into ${S} without going to the registry
- npm --arch=${TARGET_ARCH} --production --no-registry install
+ npm --arch=${NPM_ARCH} --target_arch=${NPM_ARCH} --production --no-registry install
}
npm_do_install() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]