[buildout]
extends =
  ../git/buildout.cfg
  ../pkgconfig/buildout.cfg
  ../openssl/buildout.cfg
  ../python-2.7/buildout.cfg
  ../zlib/buildout.cfg

parts =
  nodejs

[nodejs]
# Server-side Javascript.
<= nodejs-0.4

[nodejs-0.4]
recipe = hexagonit.recipe.cmmi
url = http://nodejs.org/dist/node-v0.4.12.tar.gz
md5sum = a6375eaa43db5356bf443e25b828ae16
configure-options =
  --openssl-includes=${openssl:location}/include
  --openssl-libpath=${openssl:location}/lib
make-options = -j1
environment =
  PATH=${pkgconfig:location}/bin:${python2.7:location}/bin:%(PATH)s
  PKG_CONFIG_PATH=${openssl:location}/lib/pkgconfig/
  CPPFLAGS=-I${zlib:location}/include
  LDFLAGS=-Wl,-rpath=${openssl:location}/lib -L${zlib:location}/lib -Wl,-rpath=${zlib:location}/lib

[npm]
# Node.js Package Manager
recipe = plone.recipe.command
location = ${buildout:parts-directory}/${:_buildout_section_name_}
stop-on-error = true
commit = 3136abc5c6b3ed332c4700ece24450fada63639b
branch = upstream
origin = https://github.com/isaacs/npm.git
git-bin = ${git:location}/bin/git
command = (${:git-bin} clone --quiet ${:origin} ${:location} && cd ${:location} && ${:git-bin} reset --hard ${:commit} && ${:location}/configure --prefix=${:location} &&${:git-bin} submodule update --init --recursive && ${nodejs:location}/bin/node cli.js install npm -g -f) || (rm -fr ${:location}; exit 1)
update-command =