diff options
| author | Brendan Le Foll <brendan.le.foll@intel.com> | 2016-02-25 15:06:57 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-02-28 11:32:57 +0000 |
| commit | 28d17cf9422ca16beb582dda4b387f0ff06949f9 (patch) | |
| tree | 96703d4c4c82cb866f6e095e091799e06fadf165 | |
| parent | bc5a1d1684ad8627c2ffb8065460004132274607 (diff) | |
| download | poky-28d17cf9422ca16beb582dda4b387f0ff06949f9.tar.gz | |
npm.bbclass: Add npm class to match fetcher
npm class supports the npm fetcher, helping doing the basic compile/install
stages of an npm package
(From OE-Core rev: 4d2ad3e39242c947612023f4429bc8fb430551b5)
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>
| -rw-r--r-- | meta/classes/npm.bbclass | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/meta/classes/npm.bbclass b/meta/classes/npm.bbclass new file mode 100644 index 0000000000..be76056c55 --- /dev/null +++ b/meta/classes/npm.bbclass | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | DEPENDS_prepend = "nodejs-native " | ||
| 2 | S = "${WORKDIR}/npmpkg" | ||
| 3 | |||
| 4 | npm_do_compile() { | ||
| 5 | # changing the home directory to the working directory, the .npmrc will | ||
| 6 | # be created in this directory | ||
| 7 | export HOME=${WORKDIR} | ||
| 8 | npm config set dev false | ||
| 9 | npm set cache ${WORKDIR}/npm_cache | ||
| 10 | # clear cache before every build | ||
| 11 | npm cache clear | ||
| 12 | # Install pkg into ${S} without going to the registry | ||
| 13 | npm --arch=${TARGET_ARCH} --production --no-registry install | ||
| 14 | } | ||
| 15 | |||
| 16 | npm_do_install() { | ||
| 17 | mkdir -p ${D}${libdir}/node_modules/${PN}/ | ||
| 18 | cp -a ${S}/* ${D}${libdir}/node_modules/${PN}/ --no-preserve=ownership | ||
| 19 | } | ||
| 20 | |||
| 21 | FILES_${PN} += " \ | ||
| 22 | ${libdir}/node_modules/${PN} \ | ||
| 23 | " | ||
| 24 | |||
| 25 | EXPORT_FUNCTIONS do_compile do_install | ||
