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

parts =
  nodejs

[nodejs]
<= nodejs-8.9.4

[nodejs-12.18.3]
<= nodejs-base
openssl_location = ${openssl:location}
version = v12.18.3
md5sum = 28bf6a4d98b238403fa58a0805f4a979

[nodejs-10.19.0]
<= nodejs-base
openssl_location = ${openssl:location}
version = v10.19.0
md5sum = 9e433c753d839d2d2a6341861501674f

[nodejs-10.6.0]
<= nodejs-base
openssl_location = ${openssl:location}
version = v10.6.0
md5sum = 9df233b86244ebda1ded1f91694fbe86

[nodejs-8.9.4]
<= nodejs-base
version = v8.9.4
md5sum = 4ddc1daff327d7e6f63da57fdfc24f55

[nodejs-8.6.0]
<= nodejs-base
version = v8.6.0
md5sum = 0c95e08220667d8a18b97ecec8218ac6

[nodejs-8.12.0]
<= nodejs-base
version = v8.12.0
md5sum = 5690333b77964edf81945fc724f6ea85

[nodejs-base]
# Server-side Javascript.
version =
md5sum =
openssl_location = ${openssl-1.0:location}

recipe = slapos.recipe.cmmi
shared = true
url = https://nodejs.org/dist/${:version}/node-${:version}.tar.gz
configure-options =
  --shared-openssl
  --shared-openssl-includes=${:openssl_location}/include
  --shared-openssl-libpath=${:openssl_location}/lib
environment =
  HOME=@@LOCATION@@
  PATH=${pkgconfig: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
  LD_LIBRARY_PATH=${:openssl_location}/lib

[nodejs-8.6.0-output]
# Shared binary location to ease migration
recipe = plone.recipe.command
stop-on-error = true
update-command = ${:command}
command = ${coreutils-output:test} -x ${:node} -a -x ${:npm}
node = ${nodejs-8.6.0:location}/bin/node
npm = ${nodejs-8.6.0:location}/bin/npm

[nodejs-5]
# Server-side Javascript.
recipe = slapos.recipe.cmmi
version = v5.9.1
url = http://nodejs.org/dist/${:version}/node-${:version}.tar.gz
md5sum = 346c9325912271dc7614fe955c75c3a6
configure-options =
  --shared-openssl
  --shared-openssl-includes=${openssl:location}/include
  --shared-openssl-libpath=${openssl:location}/lib
environment =
  HOME=${buildout:parts-directory}/${:_buildout_section_name_}
  PATH=${pkgconfig: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

[nodejs-4]
# Server-side Javascript.
recipe = slapos.recipe.cmmi
version = v4.4.1
url = http://nodejs.org/dist/${:version}/node-${:version}.tar.gz
md5sum = ef756c3e773f08bccada08eb37ee699c
configure-options =
  --shared-openssl
  --shared-openssl-includes=${openssl:location}/include
  --shared-openssl-libpath=${openssl:location}/lib
environment =
  HOME=${buildout:parts-directory}/${:_buildout_section_name_}
  PATH=${pkgconfig: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

[nodejs-0.6]
# Server-side Javascript.
recipe = slapos.recipe.cmmi
url = http://nodejs.org/dist/v0.6.21/node-v0.6.21.tar.gz
md5sum = 0da985a0bf820400af92363b9f453fe4
configure-options =
  --openssl-includes=${openssl:location}/include
  --openssl-libpath=${openssl:location}/lib
environment =
  HOME=${buildout:parts-directory}/${:_buildout_section_name_}
  PATH=${pkgconfig: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

[nodejs-0.4]
recipe = slapos.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
environment =
  PATH=${pkgconfig: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
# Deprecated. Included in node >= 0.6.3.
recipe = plone.recipe.command
location = ${buildout:parts-directory}/${:_buildout_section_name_}
stop-on-error = true
commit = 3136abc5c6b3ed332c4700ece24450fada63639b
origin = https://github.com/isaacs/npm.git
git-bin = ${git:location}/bin/git
node-bin = ${nodejs-0.4:location}/bin/node
command = (GIT_SSL_NO_VERIFY=true ${:git-bin} clone --quiet ${:origin} ${:location} && cd ${:location} && ${:git-bin} reset --hard ${:commit} && ${:location}/configure --prefix=${:location} && GIT_SSL_NO_VERIFY=true ${:git-bin} submodule update --init --recursive && ${:node-bin} cli.js install npm@1.0.106 -g -f) || (rm -fr ${:location}; exit 1)
update-command =
