[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
  ../python3/buildout.cfg

parts =
  nodejs

#[nodejs]
#<= nodejs-X.Y.Z

# nodejs 16 needs gcc > 8.3
[nodejs-16.13.2]
<= nodejs-base
openssl_location = ${openssl:location}
version = v16.13.2
md5sum = ae3a05fc273536f83c685a7425a7882d
patches =
  https://raw.githubusercontent.com/nxhack/openwrt-node-packages/9e3ab4cc9fd5f19c25ccd6f19be5a9b47e2c6933/node/patches/v16.x/010-execvp-arg-list-too-long.patch#17bb14ea3a1b5b4832e3680e4edfeded
patch-options = -p1
PATH = ${pkgconfig:location}/bin:${python3:location}/bin:${patch:location}/bin/:%(PATH)s

[nodejs-14.16.0]
<= nodejs-base
openssl_location = ${openssl:location}
version = v14.16.0
md5sum = 7dc3666f407bf4e12a01ce1be2883d31

[nodejs-12.18.3]
<= nodejs-base
openssl_location = ${openssl:location}
version = v12.18.3
md5sum = 28bf6a4d98b238403fa58a0805f4a979
PATH = ${pkgconfig:location}/bin:${python2.7:location}/bin:%(PATH)s

[nodejs-8.9.4]
<= nodejs-base
version = v8.9.4
md5sum = 4ddc1daff327d7e6f63da57fdfc24f55
PATH = ${pkgconfig:location}/bin:${python2.7:location}/bin:%(PATH)s

[nodejs-8.6.0]
<= nodejs-base
version = v8.6.0
md5sum = 0c95e08220667d8a18b97ecec8218ac6
PATH = ${pkgconfig:location}/bin:${python2.7:location}/bin:%(PATH)s

[nodejs-8.12.0]
<= nodejs-base
version = v8.12.0
md5sum = 5690333b77964edf81945fc724f6ea85
PATH = ${pkgconfig:location}/bin:${python2.7:location}/bin:%(PATH)s

[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
PATH = ${pkgconfig:location}/bin:%(PATH)s
environment =
  HOME=@@LOCATION@@
  PATH=${:PATH}
  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