Skip to content

Latest commit

 

History

History
173 lines (130 loc) · 3.83 KB

README.md

File metadata and controls

173 lines (130 loc) · 3.83 KB

meta-nodejs

OpenEmbedded layer for latest stable Node.js and io.js releases.

Flattr this git repo

Node versions

Stable releases of Node.js:

  • 5.0
  • 4.2 (LTS)
  • 4.1
  • 4.0
  • 0.12
  • 0.10
  • 0.8

Stable releases of io.js:

  • 3.3
  • 3.2
  • 3.1
  • 3.0
  • 2.5
  • 2.4
  • 2.3
  • 2.2
  • 2.1
  • 2.0
  • 1.8
  • 1.7
  • 1.6
  • 1.5
  • 1.4
  • 1.3
  • 1.2
  • 1.1
  • 1.0

Available Packages

  • nodejs
  • nodejs-npm
  • nodejs-dtrace
  • nodejs-systemtap
  • nodejs-wafadmin (only with Node.js 0.8)
  • iojs
  • iojs-npm
  • iojs-dtrace
  • iojs-systemtap

Installation

  1. Add meta-nodejs layer to sources/layers.txt

      meta-nodejs,git://github.com/imyller/meta-nodejs.git,master,HEAD
    
  2. Add meta-nodejs layer to EXTRALAYERS in conf/bblayers.conf

    	EXTRALAYERS +=" \
    		${TOPDIR}/sources/meta-nodejs \
    	"

Setting the preferred Node provider

It is recommended that you define the preferred provider of Node engine in your local.conf. For example:

PREFERRED_PROVIDER_node = "nodejs"
PREFERRED_PROVIDER_node-native = "nodejs-native"

With preferred provider selected you can use package name node in your recipe DEPENDS and RDEPENDS.

Usage

Building Node Packages

To build latest stable Node.js package:

If you have set PREFERRED_PROVIDER_node:

	bitbake node 	

or if you want to build Node.js:

	bitbake nodejs

or if you want to build io.js:

	bitbake iojs

Resolve build conflicts between nodejs and iojs

If you have built both nodejs and iojs to same root fs, you can resolve the conflict by running:

	bitbake iojs nodejs iojs-native nodejs-native -c cleanall -f

Node as a dependency

Add Node.js or io.js as a dependency in recipe with RDEPENDS (for runtime) or DEPENDS (for build):

	DEPENDS += " node"			# Only if you have set the PREFERRED_PROVIDER_node	
	RDEPENDS_${PN} += " node"	# Only if you have set the PREFERRED_PROVIDER_node	

or

	DEPENDS += " nodejs"
	RDEPENDS_${PN} += " nodejs"

or

	DEPENDS += " iojs"
	RDEPENDS_${PN} += " iojs"

npm install buildable recipes

Inherit npm-install build task classes in your recipe. This will automatically add node to your RDEPENDS_${PN} and node-native to DEPENDS.

Bitbake classes

meta-nodejs layer adds two new classes: npm and npm-install.

npm class

npm class defines following functions:

  • oe_runnpm: call cross-compiling npm
  • oe_runnpm_native: call native-compiling npm

For example:

  inherit npm

  do_install() {
	oe_runnpm install     # Installs dependencies defined in package.json
  }

Variables

  • NPM_FLAGS: Extra command line arguments for npm calls made by oe_runnpm()
  • NPM_ARCH: Override npm target architecture (defaults to TARGET_ARCH)

npm-install class

npm-install class inherits npm class and adds following build tasks (listed in their run order):

  • npm_install: runs npm install in source directory
  • npm_shrinkwrap: runs npm shrinkwrap in source directory
  • npm_dedupe: runs npm dedupe in source directory

You can disable one or more of these build tasks in the recipe with do_<taskname>[noexec] = "1":

  do_npm_shrinkwrap[noexec] = "1"

Variables

  • NPM_INSTALL_FLAGS: Extra command line arguments for npm calls made in npm_install task
  • NPM_INSTALL: Parameters for npm install command (such as specific package names)