function build (nodeModules, dep) {
	const {target, script} = dep
	log(`executing "${script}" from ${target}`)

	return Observable.create((observer) => {
		// some packages do expect a defined `npm_execpath` env
		// eg. https://github.com/chrisa/node-dtrace-provider/blob/v0.6.0/scripts/install.js#L19
		const env = {npm_execpath: '', ...process.env}

		env.PATH = [
			path.join(nodeModules, target, 'node_modules', '.bin'),
			path.resolve(__dirname, '..', 'node_modules', '.bin'),
			process.env.PATH
		].join(path.delimiter)

		const childProcess = spawn(config.sh, [config.shFlag, script], {
			cwd: path.join(nodeModules, target, 'package'),
			env,
			stdio: 'inherit'
			// shell: true // does break `dtrace-provider@0.6.0` build
		})
		childProcess.on('error', (error) => {
			observer.error(error)
		})
		childProcess.on('close', (code) => {
			observer.next(code)
			observer.complete()
		})
	})
}
build a dependency by executing the given lifecycle script.
@param  {String} nodeModules - absolute path of the `node_modules` directory.
@param  {Object} dep - dependency to be built.
@param  {String} dep.target - relative location of the target directory.
@param  {String} dep.script - script to be executed (usually using `sh`).
@return {Observable} - observable sequence of the returned exit code.