NAME="nodejs"
DESC="JavaScript runtime built on Chrome's V8 JavaScript engine"
VERSION="20.11.1"

FILES=("https://nodejs.org/dist/v${VERSION}/node-v${VERSION}.tar.xz")
HASHES=("3b2fe4d7a4c8dadb58563d822de6c4f4")

DEPENDS=(
  "brotli" "c-ares" "icu"
  "nghttp2" "libuv" "openssl"
  "zlib"
)
BUILD=("procps-ng" "python3")

PACKAGE() {
  tar xf "node-v${VERSION}.tar.xz"
  cd "node-v${VERSION}"

  ./configure --prefix=/usr        \
            --shared-cares         \
            --shared-libuv         \
            --shared-openssl       \
            --shared-nghttp2       \
            --shared-zlib          \
            --with-intl=system-icu
  make && make DESTDIR="${ROOTDIR}" install
  ln -sf node "${ROOTDIR}/usr/share/doc/node-${VERSION}"

  cd .. && rm -r "node-v${VERSION}"
}
