From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1515537-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 9060215ACFC
	for <garchives@archives.gentoo.org>; Fri,  5 May 2023 03:06:20 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 8B278E095E;
	Fri,  5 May 2023 03:06:19 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 5E4A1E095E
	for <gentoo-commits@lists.gentoo.org>; Fri,  5 May 2023 03:06:19 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 59DAF340D38
	for <gentoo-commits@lists.gentoo.org>; Fri,  5 May 2023 03:06:18 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 9D1F3A55
	for <gentoo-commits@lists.gentoo.org>; Fri,  5 May 2023 03:06:16 +0000 (UTC)
From: "William Hubbs" <williamh@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" <williamh@gentoo.org>
Message-ID: <1683255954.94c19a7cf8eca9e8e1157207bd7fa6fdb6f4323c.williamh@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: net-libs/nodejs/
X-VCS-Repository: repo/gentoo
X-VCS-Files: net-libs/nodejs/Manifest net-libs/nodejs/nodejs-20.1.0.ebuild
X-VCS-Directories: net-libs/nodejs/
X-VCS-Committer: williamh
X-VCS-Committer-Name: William Hubbs
X-VCS-Revision: 94c19a7cf8eca9e8e1157207bd7fa6fdb6f4323c
X-VCS-Branch: master
Date: Fri,  5 May 2023 03:06:16 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 914e880f-15e9-44fe-a870-96ca5ac86785
X-Archives-Hash: 107eac6d53b56c1e2bcb04318475b831

commit:     94c19a7cf8eca9e8e1157207bd7fa6fdb6f4323c
Author:     William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Fri May  5 03:05:32 2023 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri May  5 03:05:54 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=94c19a7c

net-libs/nodejs: add 20.1.0

Signed-off-by: William Hubbs <williamh <AT> gentoo.org>

 net-libs/nodejs/Manifest             |   1 +
 net-libs/nodejs/nodejs-20.1.0.ebuild | 252 +++++++++++++++++++++++++++++++++++
 2 files changed, 253 insertions(+)

diff --git a/net-libs/nodejs/Manifest b/net-libs/nodejs/Manifest
index 8bff0dfd255b..c1e843f8bdd4 100644
--- a/net-libs/nodejs/Manifest
+++ b/net-libs/nodejs/Manifest
@@ -2,3 +2,4 @@ DIST node-v14.21.3.tar.xz 34508116 BLAKE2B 6fa001be10499ff2dfc920690dda9df25423f
 DIST node-v16.20.0.tar.xz 35546884 BLAKE2B 5bdb1fb7365e07f13d0a58a8d052d11efaadcf1b0792af0517b78b1ecf01e50eabe26e31588ae410ee63b7494a4eb9d23f70d4dd157a452d0bbf8bd548865255 SHA512 b155acdff0244307afcc334844f113b5c321f7764ebb69326d60a6a79d0e0d38d55257a38b815f5933aa4071e6a788e01c466476ef012cec648c84d74adda406
 DIST node-v18.16.0.tar.xz 40467860 BLAKE2B b16749c0212f3aa196ec9fc0f999a023adeb9031b3332939330ba5a3edb5bc2ed6dc21bf861509696e19ed0cc5d5c54bb882018f0e54eb1ad8e9b0ba3bb64bff SHA512 608ce5db97ce2d851f381c7991f635c5e0927ae79037649b482c7e197479341b7c6560644e25f4d65ece8aa80c5763a0e044349a5be210fa33fbbf97a96462bd
 DIST node-v20.0.0.tar.xz 41279796 BLAKE2B 1df8785ca22dea15c6c1f19ec2d3b3d704f9cda6cf13d6e8e8fbbf853515871f18a11a4bbe5ed765434f6f5606975c5254e1826f2e506165ff937ef16d326262 SHA512 cda981227398c1a9023a2212c0d5351eadfedd19d58776dcc470e3ba0213a178b626c37d48fa52548ddd5a70d26a18b66c266856321a0af9ada2b1eac7ee9fd8
+DIST node-v20.1.0.tar.xz 41501496 BLAKE2B 03731915e734f0fd5cfb94fd05f4bd88ca015c5d5a91666d091499daa1a1b3193a3b4667ccec99ce1442ef6b402838705c42e785275dd327bf72adaae9487f50 SHA512 06b88a3ab3f1c089f0d38fb504083bed9a2d27b1b07633dbd40b02bcb3c0a22f6d04ab70abc394fdfb14ac978e974d97656bffeb27e0e47b0c95e672b925067c

diff --git a/net-libs/nodejs/nodejs-20.1.0.ebuild b/net-libs/nodejs/nodejs-20.1.0.ebuild
new file mode 100644
index 000000000000..a0749b8aad06
--- /dev/null
+++ b/net-libs/nodejs/nodejs-20.1.0.ebuild
@@ -0,0 +1,252 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+CONFIG_CHECK="~ADVISE_SYSCALLS"
+PYTHON_COMPAT=( python3_{9..11} )
+PYTHON_REQ_USE="threads(+)"
+
+inherit bash-completion-r1 check-reqs flag-o-matic linux-info ninja-utils pax-utils python-any-r1 toolchain-funcs xdg-utils
+
+DESCRIPTION="A JavaScript runtime built on Chrome's V8 JavaScript engine"
+HOMEPAGE="https://nodejs.org/"
+LICENSE="Apache-1.1 Apache-2.0 BSD BSD-2 MIT"
+
+if [[ ${PV} == *9999 ]]; then
+	inherit git-r3
+	EGIT_REPO_URI="https://github.com/nodejs/node"
+	SLOT="0"
+else
+	SRC_URI="https://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz"
+	SLOT="0/$(ver_cut 1)"
+	KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64 ~riscv ~x86 ~amd64-linux ~x64-macos"
+	S="${WORKDIR}/node-v${PV}"
+fi
+
+IUSE="cpu_flags_x86_sse2 debug doc +icu inspector lto +npm pax-kernel +snapshot +ssl +system-icu +system-ssl test"
+REQUIRED_USE="inspector? ( icu ssl )
+	npm? ( ssl )
+	system-icu? ( icu )
+	system-ssl? ( ssl )"
+
+RESTRICT="!test? ( test )"
+
+RDEPEND=">=app-arch/brotli-1.0.9:=
+	>=dev-libs/libuv-1.44.0:=
+	>=net-dns/c-ares-1.17.2:=
+	>=net-libs/nghttp2-1.41.0:=
+	sys-libs/zlib
+	system-icu? ( >=dev-libs/icu-67:= )
+	system-ssl? ( >=dev-libs/openssl-1.1.1:0= )
+	sys-devel/gcc:*"
+BDEPEND="${PYTHON_DEPS}
+${NINJA_DEPEND}
+	sys-apps/coreutils
+	virtual/pkgconfig
+	test? ( net-misc/curl )
+	pax-kernel? ( sys-apps/elfix )"
+DEPEND="${RDEPEND}"
+
+# These are measured on a loong machine with -ggdb on, and only checked
+# if debugging flags are present in CFLAGS.
+#
+# The final link consumed a little more than 7GiB alone, so 8GiB is the lower
+# limit for memory usage. Disk usage was 19.1GiB for the build directory and
+# 1.2GiB for the installed image, so we leave some room for architectures with
+# fatter binaries and set the disk requirement to 22GiB.
+CHECKREQS_MEMORY="8G"
+CHECKREQS_DISK_BUILD="22G"
+
+pkg_pretend() {
+	(use x86 && ! use cpu_flags_x86_sse2) && \
+		die "Your CPU doesn't support the required SSE2 instruction."
+
+	if [[ ${MERGE_TYPE} != "binary" ]]; then
+		if is-flagq "-g*" && ! is-flagq "-g*0" ; then
+			einfo "Checking for sufficient disk space and memory to build ${PN} with debugging CFLAGS"
+			check-reqs_pkg_pretend
+		fi
+	fi
+}
+
+pkg_setup() {
+	python-any-r1_pkg_setup
+	linux-info_pkg_setup
+}
+
+src_prepare() {
+	tc-export AR CC CXX PKG_CONFIG
+	export V=1
+	export BUILDTYPE=Release
+
+	# fix compilation on Darwin
+	# https://code.google.com/p/gyp/issues/detail?id=260
+	sed -i -e "/append('-arch/d" tools/gyp/pylib/gyp/xcode_emulation.py || die
+
+	# less verbose install output (stating the same as portage, basically)
+	sed -i -e "/print/d" tools/install.py || die
+
+	# proper libdir, hat tip @ryanpcmcquen https://github.com/iojs/io.js/issues/504
+	local LIBDIR=$(get_libdir)
+	sed -i -e "s|lib/|${LIBDIR}/|g" tools/install.py || die
+	sed -i -e "s/'lib'/'${LIBDIR}'/" deps/npm/lib/npm.js || die
+
+	# Avoid writing a depfile, not useful
+	sed -i -e "/DEPFLAGS =/d" tools/gyp/pylib/gyp/generator/make.py || die
+
+	sed -i -e "/'-O3'/d" common.gypi node.gypi || die
+
+	# debug builds. change install path, remove optimisations and override buildtype
+	if use debug; then
+		sed -i -e "s|out/Release/|out/Debug/|g" tools/install.py || die
+		BUILDTYPE=Debug
+	fi
+
+	# We need to disable mprotect on two files when it builds Bug 694100.
+	use pax-kernel && PATCHES+=( "${FILESDIR}"/${PN}-18.16.0-paxmarking.patch )
+
+	default
+}
+
+src_configure() {
+	xdg_environment_reset
+
+	# LTO compiler flags are handled by configure.py itself
+	filter-flags '-flto*'
+	# nodejs unconditionally links to libatomic #869992
+	# specifically it requires __atomic_is_lock_free which
+	# is not yet implemented by sys-libs/compiler-rt (see
+	# https://reviews.llvm.org/D85044?id=287068), therefore
+	# we depend on gcc and force using libgcc as the support lib
+	tc-is-clang && append-ldflags "--rtlib=libgcc --unwindlib=libgcc"
+
+	local myconf=(
+	--ninja
+		--shared-brotli
+		--shared-cares
+		--shared-libuv
+		--shared-nghttp2
+		--shared-zlib
+	)
+	use debug && myconf+=( --debug )
+	use lto && myconf+=( --enable-lto )
+	if use system-icu; then
+		myconf+=( --with-intl=system-icu )
+	elif use icu; then
+		myconf+=( --with-intl=full-icu )
+	else
+		myconf+=( --with-intl=none )
+	fi
+	use inspector || myconf+=( --without-inspector )
+	use npm || myconf+=( --without-npm )
+	use snapshot || myconf+=( --without-node-snapshot )
+	if use ssl; then
+		use system-ssl && myconf+=( --shared-openssl --openssl-use-def-ca-store )
+	else
+		myconf+=( --without-ssl )
+	fi
+
+	local myarch=""
+	case "${ARCH}:${ABI}" in
+		*:amd64) myarch="x64";;
+		*:arm) myarch="arm";;
+		*:arm64) myarch="arm64";;
+		loong:lp64*) myarch="loong64";;
+		riscv:lp64*) myarch="riscv64";;
+		*:ppc64) myarch="ppc64";;
+		*:x32) myarch="x32";;
+		*:x86) myarch="ia32";;
+		*) myarch="${ABI}";;
+	esac
+
+	GYP_DEFINES="linux_use_gold_flags=0
+		linux_use_bundled_binutils=0
+		linux_use_bundled_gold=0" \
+	"${EPYTHON}" configure.py \
+		--prefix="${EPREFIX}"/usr \
+		--dest-cpu=${myarch} \
+		"${myconf[@]}" || die
+}
+
+src_compile() {
+	eninja -C out/${BUILDTYPE}
+}
+
+src_install() {
+	local LIBDIR="${ED}/usr/$(get_libdir)"
+	default
+
+	pax-mark -m "${ED}"/usr/bin/node
+
+	# set up a symlink structure that node-gyp expects..
+	dodir /usr/include/node/deps/{v8,uv}
+	dosym . /usr/include/node/src
+	for var in deps/{uv,v8}/include; do
+		dosym ../.. /usr/include/node/${var}
+	done
+
+	if use doc; then
+		docinto html
+		dodoc -r "${S}"/doc/*
+	fi
+
+	if use npm; then
+		keepdir /etc/npm
+		echo "NPM_CONFIG_GLOBALCONFIG=${EPREFIX}/etc/npm/npmrc" > "${T}"/50npm
+		doenvd "${T}"/50npm
+
+		# Install bash completion for `npm`
+		local tmp_npm_completion_file="$(TMPDIR="${T}" mktemp -t npm.XXXXXXXXXX)"
+		"${ED}/usr/bin/npm" completion > "${tmp_npm_completion_file}"
+		newbashcomp "${tmp_npm_completion_file}" npm
+
+		# Move man pages
+		doman "${LIBDIR}"/node_modules/npm/man/man{1,5,7}/*
+
+		# Clean up
+		rm -f "${LIBDIR}"/node_modules/npm/{.mailmap,.npmignore,Makefile}
+		rm -rf "${LIBDIR}"/node_modules/npm/{doc,html,man}
+
+		local find_exp="-or -name"
+		local find_name=()
+		for match in "AUTHORS*" "CHANGELOG*" "CONTRIBUT*" "README*" \
+			".travis.yml" ".eslint*" ".wercker.yml" ".npmignore" \
+			"*.md" "*.markdown" "*.bat" "*.cmd"; do
+			find_name+=( ${find_exp} "${match}" )
+		done
+
+		# Remove various development and/or inappropriate files and
+		# useless docs of dependend packages.
+		find "${LIBDIR}"/node_modules \
+			\( -type d -name examples \) -or \( -type f \( \
+				-iname "LICEN?E*" \
+				"${find_name[@]}" \
+			\) \) -exec rm -rf "{}" \;
+	fi
+
+	mv "${ED}"/usr/share/doc/node "${ED}"/usr/share/doc/${PF} || die
+}
+
+src_test() {
+	local drop_tests=(
+		test/parallel/test-dns-setserver-when-querying.js
+		test/parallel/test-fs-mkdir.js
+		test/parallel/test-fs-utimes-y2K38.js
+		test/parallel/test-release-npm.js
+		test/parallel/test-socket-write-after-fin-error.js
+		test/parallel/test-strace-openat-openssl.js
+		test/sequential/test-util-debug.js
+	)
+	rm "${drop_tests[@]}" || die "disabling tests failed"
+
+	out/${BUILDTYPE}/cctest || die
+	"${EPYTHON}" tools/test.py --mode=${BUILDTYPE,,} --flaky-tests=dontcare -J message parallel sequential || die
+}
+
+pkg_postinst() {
+	if use npm; then
+		ewarn "remember to run: source /etc/profile if you plan to use nodejs"
+		ewarn "	in your current shell"
+	fi
+}