Gentoo Archives: gentoo-commits

From: William Hubbs <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-libs/nodejs/
Date: Sun, 25 Sep 2022 03:59:13
Message-Id: 1664078339.66f14e514723b54528dee2a0bbcd38a795926a4f.williamh@gentoo
1 commit: 66f14e514723b54528dee2a0bbcd38a795926a4f
2 Author: William Hubbs <williamh <AT> gentoo <DOT> org>
3 AuthorDate: Sun Sep 25 03:58:21 2022 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Sun Sep 25 03:58:59 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=66f14e51
7
8 net-libs/nodejs: add 14.20.1, 16.17.1, 18.9.1
9
10 Bug: https://bugs.gentoo.org/872692
11 Signed-off-by: William Hubbs <williamh <AT> gentoo.org>
12
13 net-libs/nodejs/Manifest | 3 +
14 net-libs/nodejs/nodejs-14.20.1.ebuild | 240 ++++++++++++++++++++++++++++++++
15 net-libs/nodejs/nodejs-16.17.1.ebuild | 232 +++++++++++++++++++++++++++++++
16 net-libs/nodejs/nodejs-18.9.1.ebuild | 250 ++++++++++++++++++++++++++++++++++
17 4 files changed, 725 insertions(+)
18
19 diff --git a/net-libs/nodejs/Manifest b/net-libs/nodejs/Manifest
20 index e666bf77bd2f..917b9b813fdd 100644
21 --- a/net-libs/nodejs/Manifest
22 +++ b/net-libs/nodejs/Manifest
23 @@ -1,6 +1,9 @@
24 DIST node-v14.20.0.tar.xz 34487684 BLAKE2B a3b8af94d2bb0e52f36ead91a5cd96a4a35a67f07b87e43da5ff598d693fd8b3b47c05dbb6c6b738aefa55b056eccedbcf782225a2abf49110b3371a544952bd SHA512 400eb247c1d37ca64f4d643ab1852d2e1415ee190cf726b1e9b058386a1ebd6d7a9f40092afff228ec7980f37a78978252c1ef115aee47ec5b90c065f136b10f
25 +DIST node-v14.20.1.tar.xz 34482880 BLAKE2B 3d21645c94e194c4a9a499544032643a2b14f507642c8d01bd54b3446c691c6d59109c08713a4b2e210c7418baded496b80308687b31830d2ccee5f8c9a06178 SHA512 27186e6b877189c7976fe566cbc4f5e961941f74af7e2f96a0829d6061b880569095666da70545f61a017f1b520050ab6ef5fc98e2e71e72253633f88a9264fb
26 DIST node-v16.16.0.tar.xz 35039712 BLAKE2B e4cf7debda3d32b515d60d11ac7ebd788fdab0ebc782a096571cd4b502dddfb9c63c9a3625198c6c545f95092ffcb247e94ee96e33d8a79a7c5e24c56039c229 SHA512 828bfee4f3789b02fec512a7d9785bf02650401c61b2d3ff80d8a3876420927fb9c8d0c2d66e45e1e8370c47cb81140d434747588322c4fedca7fd9e42b84ac3
27 DIST node-v16.17.0.tar.xz 35664964 BLAKE2B 490bcb65440a81d356f6351c45b19a4022cd55834b8b90da9eed2006042ab73732d581d58983b34b12ddef618d3e99fe760ef93447a2201268e2ab86466d3bb1 SHA512 8906ee337562b6f0b1614aa57084499ffd3bdfe8f8e706de8fed98baed5a92f691c534528b98f6321cf8a1eaaed6b45a938f28bd08167fbd75bfeb432ca03181
28 +DIST node-v16.17.1.tar.xz 35661452 BLAKE2B 1fd9fad86f4f5161b2e06199a18f4df431b95ca03214cedefa4b76a9703e7153120c8c3f0f9b07fce825015533d2f52cc29e5737308c69d809c3e6edbc0eacee SHA512 f9aefcc72a260cbdc162db8db01885a93b1b2248ff0c20c6e9b98819b8b5e599f7da89eeeb7cfe202764cca3974b6ca48610351176f6767ef6ad630ca7ee8cb7
29 DIST node-v18.6.0.tar.xz 37189620 BLAKE2B 15a8a874f39db7de576d3ba81fddcb8072cb170ebb12308d2ade2efb9c8200c561671f453371a16db82d4c0f02522a28f6ae01216d11be40df94b53b184828b3 SHA512 d682e25a71ffbef90e2cb3c55e22dbd548952c4de24d48c47206afd270fd17c7bda95b3241840bf6a470f28d2389f3c6fddbb812ad17cf1d36262ff25fcda859
30 DIST node-v18.7.0.tar.xz 36945328 BLAKE2B 8ec945347ba396f7c65f544325690abdece4aa82ce1dae63e56662c78f445845f3f858a803ee2b130444f44cd38f4e1d8f5df0240d5a0c5124a38cbab42daafc SHA512 3da56b25f304b4e205c27a59f2e442e7216e494465e4cce9f51ffd3f7c7da3ab3519c4b7d1eb41a754b86ecfa1d138d270578aa3908b4fd42cc5dbfd389a6798
31 DIST node-v18.9.0.tar.xz 38309908 BLAKE2B 87ce3e45c6450bc686fe800a9c39a6c0cb5c01279c3052431455c29e0fc0b244de122dd899a43da1e8291fe60457847d307c7193c4e69f2d6f6b8824f4555daf SHA512 60bf98bc5011876429c9a687141b916fc6023ba21f1a641fef2f11d53218db24f442542382495455d2f107d708fcd04994e239a9bbfb52f070935c9048089e81
32 +DIST node-v18.9.1.tar.xz 38315220 BLAKE2B 515ab64db023c5809c476c1248e2d47a49d46ed273ee0f91ac803791b0e7a51f3dd2f0ee7f30901d9a1fbc9172dd971c9845c86a703c6194bc8f983d3f81567c SHA512 fc570dbd41197363d0f9bc3f329fbdffd0cb5b7382327e206d40b3b4e42a80fa65debb172abd501021bcc5082d8d99fc5f6faa05cf87066170c87be1b15e8734
33
34 diff --git a/net-libs/nodejs/nodejs-14.20.1.ebuild b/net-libs/nodejs/nodejs-14.20.1.ebuild
35 new file mode 100644
36 index 000000000000..0f65989cf3f7
37 --- /dev/null
38 +++ b/net-libs/nodejs/nodejs-14.20.1.ebuild
39 @@ -0,0 +1,240 @@
40 +# Copyright 1999-2022 Gentoo Authors
41 +# Distributed under the terms of the GNU General Public License v2
42 +
43 +EAPI=7
44 +
45 +CONFIG_CHECK="~ADVISE_SYSCALLS"
46 +PYTHON_COMPAT=( python3_{8..10} )
47 +PYTHON_REQ_USE="threads(+)"
48 +
49 +inherit bash-completion-r1 flag-o-matic linux-info pax-utils python-any-r1 toolchain-funcs xdg-utils
50 +
51 +DESCRIPTION="A JavaScript runtime built on Chrome's V8 JavaScript engine"
52 +HOMEPAGE="https://nodejs.org/"
53 +LICENSE="Apache-1.1 Apache-2.0 BSD BSD-2 MIT"
54 +
55 +if [[ ${PV} == *9999 ]]; then
56 + inherit git-r3
57 + EGIT_REPO_URI="https://github.com/nodejs/node"
58 + SLOT="0"
59 +else
60 + SRC_URI="https://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz"
61 + SLOT="0/$(ver_cut 1)"
62 + KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 -riscv ~x86 ~amd64-linux ~x64-macos"
63 + S="${WORKDIR}/node-v${PV}"
64 +fi
65 +
66 +IUSE="cpu_flags_x86_sse2 debug doc +icu inspector lto +npm pax-kernel +snapshot +ssl +system-icu +system-ssl systemtap test"
67 +REQUIRED_USE="inspector? ( icu ssl )
68 + npm? ( ssl )
69 + system-icu? ( icu )
70 + system-ssl? ( ssl )"
71 +
72 +RESTRICT="!test? ( test )"
73 +
74 +RDEPEND=">=app-arch/brotli-1.0.9:=
75 + >=dev-libs/libuv-1.40.0:=
76 + >=net-dns/c-ares-1.17.2:=
77 + >=net-libs/nghttp2-1.41.0:=
78 + sys-libs/zlib
79 + system-icu? ( >=dev-libs/icu-67:= )
80 + system-ssl? (
81 + >=dev-libs/openssl-1.1.1:0=
82 + <dev-libs/openssl-3.0.0_beta1:0=
83 + )
84 + sys-devel/gcc:*"
85 +BDEPEND="${PYTHON_DEPS}
86 + sys-apps/coreutils
87 + virtual/pkgconfig
88 + systemtap? ( dev-util/systemtap )
89 + test? ( net-misc/curl )
90 + pax-kernel? ( sys-apps/elfix )"
91 +DEPEND="${RDEPEND}"
92 +
93 +PATCHES=(
94 + "${FILESDIR}"/${PN}-12.22.5-shared_c-ares_nameser_h.patch
95 + "${FILESDIR}"/${PN}-14.15.0-fix_ppc64_crashes.patch
96 + "${FILESDIR}"/${PN}-14.19.0-global-npm-config.patch
97 +)
98 +
99 +pkg_pretend() {
100 + (use x86 && ! use cpu_flags_x86_sse2) && \
101 + die "Your CPU doesn't support the required SSE2 instruction."
102 +}
103 +
104 +pkg_setup() {
105 + python-any-r1_pkg_setup
106 + linux-info_pkg_setup
107 +}
108 +
109 +src_prepare() {
110 + tc-export AR CC CXX PKG_CONFIG
111 + export V=1
112 + export BUILDTYPE=Release
113 +
114 + # fix compilation on Darwin
115 + # https://code.google.com/p/gyp/issues/detail?id=260
116 + sed -i -e "/append('-arch/d" tools/gyp/pylib/gyp/xcode_emulation.py || die
117 +
118 + # less verbose install output (stating the same as portage, basically)
119 + sed -i -e "/print/d" tools/install.py || die
120 +
121 + # proper libdir, hat tip @ryanpcmcquen https://github.com/iojs/io.js/issues/504
122 + local LIBDIR=$(get_libdir)
123 + sed -i -e "s|lib/|${LIBDIR}/|g" tools/install.py || die
124 + sed -i -e "s/'lib'/'${LIBDIR}'/" deps/npm/lib/npm.js || die
125 +
126 + # Avoid writing a depfile, not useful
127 + sed -i -e "/DEPFLAGS =/d" tools/gyp/pylib/gyp/generator/make.py || die
128 +
129 + sed -i -e "/'-O3'/d" common.gypi node.gypi || die
130 +
131 + # debug builds. change install path, remove optimisations and override buildtype
132 + if use debug; then
133 + sed -i -e "s|out/Release/|out/Debug/|g" tools/install.py || die
134 + BUILDTYPE=Debug
135 + fi
136 +
137 + # We need to disable mprotect on two files when it builds Bug 694100.
138 + use pax-kernel && PATCHES+=( "${FILESDIR}"/${PN}-13.8.0-paxmarking.patch )
139 +
140 + # All this test does is check if the npm CLI produces warnings of any sort,
141 + # failing if it does. Overkill, much? Especially given one possible warning
142 + # is that there is a newer version of npm available upstream (yes, it does
143 + # use the network if available), thus making it a real possibility for this
144 + # test to begin failing one day even though it was fine before.
145 + rm -f test/parallel/test-release-npm.js
146 +
147 + default
148 +}
149 +
150 +src_configure() {
151 + xdg_environment_reset
152 +
153 + # LTO compiler flags are handled by configure.py itself
154 + filter-flags '-flto*'
155 + # nodejs unconditionally links to libatomic #869992
156 + # specifically it requires __atomic_is_lock_free which
157 + # is not yet implemented by sys-libs/compiler-rt (see
158 + # https://reviews.llvm.org/D85044?id=287068), therefore
159 + # we depend on gcc and force using libgcc as the support lib
160 + tc-is-clang && append-ldflags "--rtlib=libgcc --unwindlib=libgcc"
161 +
162 + local myconf=(
163 + --shared-brotli
164 + --shared-cares
165 + --shared-libuv
166 + --shared-nghttp2
167 + --shared-zlib
168 + )
169 + use debug && myconf+=( --debug )
170 + use lto && myconf+=( --enable-lto )
171 + if use system-icu; then
172 + myconf+=( --with-intl=system-icu )
173 + elif use icu; then
174 + myconf+=( --with-intl=full-icu )
175 + else
176 + myconf+=( --with-intl=none )
177 + fi
178 + use inspector || myconf+=( --without-inspector )
179 + use npm || myconf+=( --without-npm )
180 + use snapshot || myconf+=( --without-node-snapshot )
181 + if use ssl; then
182 + use system-ssl && myconf+=( --shared-openssl --openssl-use-def-ca-store )
183 + else
184 + myconf+=( --without-ssl )
185 + fi
186 +
187 + local myarch=""
188 + case ${ABI} in
189 + amd64) myarch="x64";;
190 + arm) myarch="arm";;
191 + arm64) myarch="arm64";;
192 + ppc64) myarch="ppc64";;
193 + x32) myarch="x32";;
194 + x86) myarch="ia32";;
195 + *) myarch="${ABI}";;
196 + esac
197 +
198 + GYP_DEFINES="linux_use_gold_flags=0
199 + linux_use_bundled_binutils=0
200 + linux_use_bundled_gold=0" \
201 + "${EPYTHON}" configure.py \
202 + --prefix="${EPREFIX}"/usr \
203 + --dest-cpu=${myarch} \
204 + $(use_with systemtap dtrace) \
205 + "${myconf[@]}" || die
206 +}
207 +
208 +src_compile() {
209 + emake -C out
210 +}
211 +
212 +src_install() {
213 + local LIBDIR="${ED}/usr/$(get_libdir)"
214 + default
215 +
216 + pax-mark -m "${ED}"/usr/bin/node
217 +
218 + # set up a symlink structure that node-gyp expects..
219 + dodir /usr/include/node/deps/{v8,uv}
220 + dosym . /usr/include/node/src
221 + for var in deps/{uv,v8}/include; do
222 + dosym ../.. /usr/include/node/${var}
223 + done
224 +
225 + if use doc; then
226 + docinto html
227 + dodoc -r "${S}"/doc/*
228 + fi
229 +
230 + if use npm; then
231 + dodir /etc/npm
232 +
233 + # Install bash completion for `npm`
234 + # We need to temporarily replace default config path since
235 + # npm otherwise tries to write outside of the sandbox
236 + local npm_config="usr/$(get_libdir)/node_modules/npm/lib/config/core.js"
237 + sed -i -e "s|'/etc'|'${ED}/etc'|g" "${ED}/${npm_config}" || die
238 + local tmp_npm_completion_file="$(TMPDIR="${T}" mktemp -t npm.XXXXXXXXXX)"
239 + "${ED}/usr/bin/npm" completion > "${tmp_npm_completion_file}"
240 + newbashcomp "${tmp_npm_completion_file}" npm
241 + sed -i -e "s|'${ED}/etc'|'/etc'|g" "${ED}/${npm_config}" || die
242 +
243 + # Move man pages
244 + doman "${LIBDIR}"/node_modules/npm/man/man{1,5,7}/*
245 +
246 + # Clean up
247 + rm -f "${LIBDIR}"/node_modules/npm/{.mailmap,.npmignore,Makefile}
248 + rm -rf "${LIBDIR}"/node_modules/npm/{doc,html,man}
249 +
250 + local find_exp="-or -name"
251 + local find_name=()
252 + for match in "AUTHORS*" "CHANGELOG*" "CONTRIBUT*" "README*" \
253 + ".travis.yml" ".eslint*" ".wercker.yml" ".npmignore" \
254 + "*.md" "*.markdown" "*.bat" "*.cmd"; do
255 + find_name+=( ${find_exp} "${match}" )
256 + done
257 +
258 + # Remove various development and/or inappropriate files and
259 + # useless docs of dependend packages.
260 + find "${LIBDIR}"/node_modules \
261 + \( -type d -name examples \) -or \( -type f \( \
262 + -iname "LICEN?E*" \
263 + "${find_name[@]}" \
264 + \) \) -exec rm -rf "{}" \;
265 + fi
266 +
267 + mv "${ED}"/usr/share/doc/node "${ED}"/usr/share/doc/${PF} || die
268 +}
269 +
270 +src_test() {
271 + if has usersandbox ${FEATURES}; then
272 + rm -f "${S}"/test/parallel/test-fs-mkdir.js
273 + ewarn "You are emerging ${PN} with 'usersandbox' enabled. Excluding tests known to fail in this mode." \
274 + "For full test coverage, emerge =${CATEGORY}/${PF} with 'FEATURES=-usersandbox'."
275 + fi
276 +
277 + out/${BUILDTYPE}/cctest || die
278 + "${EPYTHON}" tools/test.py --mode=${BUILDTYPE,,} --flaky-tests=dontcare -J message parallel sequential || die
279 +}
280
281 diff --git a/net-libs/nodejs/nodejs-16.17.1.ebuild b/net-libs/nodejs/nodejs-16.17.1.ebuild
282 new file mode 100644
283 index 000000000000..60ccb02f3246
284 --- /dev/null
285 +++ b/net-libs/nodejs/nodejs-16.17.1.ebuild
286 @@ -0,0 +1,232 @@
287 +# Copyright 1999-2022 Gentoo Authors
288 +# Distributed under the terms of the GNU General Public License v2
289 +
290 +EAPI=8
291 +
292 +CONFIG_CHECK="~ADVISE_SYSCALLS"
293 +PYTHON_COMPAT=( python3_{8..10} )
294 +PYTHON_REQ_USE="threads(+)"
295 +
296 +inherit bash-completion-r1 flag-o-matic linux-info pax-utils python-any-r1 toolchain-funcs xdg-utils
297 +
298 +DESCRIPTION="A JavaScript runtime built on Chrome's V8 JavaScript engine"
299 +HOMEPAGE="https://nodejs.org/"
300 +LICENSE="Apache-1.1 Apache-2.0 BSD BSD-2 MIT"
301 +
302 +if [[ ${PV} == *9999 ]]; then
303 + inherit git-r3
304 + EGIT_REPO_URI="https://github.com/nodejs/node"
305 + SLOT="0"
306 +else
307 + SRC_URI="https://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz"
308 + SLOT="0/$(ver_cut 1)"
309 + KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86 ~amd64-linux ~x64-macos"
310 + S="${WORKDIR}/node-v${PV}"
311 +fi
312 +
313 +IUSE="cpu_flags_x86_sse2 debug doc +icu inspector lto +npm pax-kernel +snapshot +ssl +system-icu +system-ssl systemtap test"
314 +REQUIRED_USE="inspector? ( icu ssl )
315 + npm? ( ssl )
316 + system-icu? ( icu )
317 + system-ssl? ( ssl )"
318 +
319 +RESTRICT="!test? ( test )"
320 +
321 +RDEPEND=">=app-arch/brotli-1.0.9:=
322 + >=dev-libs/libuv-1.40.0:=
323 + >=net-dns/c-ares-1.17.2:=
324 + >=net-libs/nghttp2-1.41.0:=
325 + sys-libs/zlib
326 + system-icu? ( >=dev-libs/icu-67:= )
327 + system-ssl? ( >=dev-libs/openssl-1.1.1:0= )
328 + sys-devel/gcc:*"
329 +BDEPEND="${PYTHON_DEPS}
330 + sys-apps/coreutils
331 + virtual/pkgconfig
332 + systemtap? ( dev-util/systemtap )
333 + test? ( net-misc/curl )
334 + pax-kernel? ( sys-apps/elfix )"
335 +DEPEND="${RDEPEND}"
336 +
337 +PATCHES=(
338 + "${FILESDIR}"/${PN}-12.22.5-shared_c-ares_nameser_h.patch
339 + "${FILESDIR}"/${PN}-15.2.0-global-npm-config.patch
340 +)
341 +
342 +pkg_pretend() {
343 + (use x86 && ! use cpu_flags_x86_sse2) && \
344 + die "Your CPU doesn't support the required SSE2 instruction."
345 +}
346 +
347 +pkg_setup() {
348 + python-any-r1_pkg_setup
349 + linux-info_pkg_setup
350 +}
351 +
352 +src_prepare() {
353 + tc-export AR CC CXX PKG_CONFIG
354 + export V=1
355 + export BUILDTYPE=Release
356 +
357 + # fix compilation on Darwin
358 + # https://code.google.com/p/gyp/issues/detail?id=260
359 + sed -i -e "/append('-arch/d" tools/gyp/pylib/gyp/xcode_emulation.py || die
360 +
361 + # less verbose install output (stating the same as portage, basically)
362 + sed -i -e "/print/d" tools/install.py || die
363 +
364 + # proper libdir, hat tip @ryanpcmcquen https://github.com/iojs/io.js/issues/504
365 + local LIBDIR=$(get_libdir)
366 + sed -i -e "s|lib/|${LIBDIR}/|g" tools/install.py || die
367 + sed -i -e "s/'lib'/'${LIBDIR}'/" deps/npm/lib/npm.js || die
368 +
369 + # Avoid writing a depfile, not useful
370 + sed -i -e "/DEPFLAGS =/d" tools/gyp/pylib/gyp/generator/make.py || die
371 +
372 + sed -i -e "/'-O3'/d" common.gypi node.gypi || die
373 +
374 + # debug builds. change install path, remove optimisations and override buildtype
375 + if use debug; then
376 + sed -i -e "s|out/Release/|out/Debug/|g" tools/install.py || die
377 + BUILDTYPE=Debug
378 + fi
379 +
380 + # We need to disable mprotect on two files when it builds Bug 694100.
381 + use pax-kernel && PATCHES+=( "${FILESDIR}"/${PN}-16.4.2-paxmarking.patch )
382 +
383 + # All this test does is check if the npm CLI produces warnings of any sort,
384 + # failing if it does. Overkill, much? Especially given one possible warning
385 + # is that there is a newer version of npm available upstream (yes, it does
386 + # use the network if available), thus making it a real possibility for this
387 + # test to begin failing one day even though it was fine before.
388 + rm -f test/parallel/test-release-npm.js
389 +
390 + default
391 +}
392 +
393 +src_configure() {
394 + xdg_environment_reset
395 +
396 + # LTO compiler flags are handled by configure.py itself
397 + filter-flags '-flto*'
398 + # nodejs unconditionally links to libatomic #869992
399 + # specifically it requires __atomic_is_lock_free which
400 + # is not yet implemented by sys-libs/compiler-rt (see
401 + # https://reviews.llvm.org/D85044?id=287068), therefore
402 + # we depend on gcc and force using libgcc as the support lib
403 + tc-is-clang && append-ldflags "--rtlib=libgcc --unwindlib=libgcc"
404 +
405 + local myconf=(
406 + --shared-brotli
407 + --shared-cares
408 + --shared-libuv
409 + --shared-nghttp2
410 + --shared-zlib
411 + )
412 + use debug && myconf+=( --debug )
413 + use lto && myconf+=( --enable-lto )
414 + if use system-icu; then
415 + myconf+=( --with-intl=system-icu )
416 + elif use icu; then
417 + myconf+=( --with-intl=full-icu )
418 + else
419 + myconf+=( --with-intl=none )
420 + fi
421 + use inspector || myconf+=( --without-inspector )
422 + use npm || myconf+=( --without-npm )
423 + use snapshot || myconf+=( --without-node-snapshot )
424 + if use ssl; then
425 + use system-ssl && myconf+=( --shared-openssl --openssl-use-def-ca-store )
426 + else
427 + myconf+=( --without-ssl )
428 + fi
429 +
430 + local myarch=""
431 + case ${ABI} in
432 + amd64) myarch="x64";;
433 + arm) myarch="arm";;
434 + arm64) myarch="arm64";;
435 + lp64*) myarch="riscv64";;
436 + ppc64) myarch="ppc64";;
437 + x32) myarch="x32";;
438 + x86) myarch="ia32";;
439 + *) myarch="${ABI}";;
440 + esac
441 +
442 + GYP_DEFINES="linux_use_gold_flags=0
443 + linux_use_bundled_binutils=0
444 + linux_use_bundled_gold=0" \
445 + "${EPYTHON}" configure.py \
446 + --prefix="${EPREFIX}"/usr \
447 + --dest-cpu=${myarch} \
448 + $(use_with systemtap dtrace) \
449 + "${myconf[@]}" || die
450 +}
451 +
452 +src_compile() {
453 + emake -C out
454 +}
455 +
456 +src_install() {
457 + local LIBDIR="${ED}/usr/$(get_libdir)"
458 + default
459 +
460 + pax-mark -m "${ED}"/usr/bin/node
461 +
462 + # set up a symlink structure that node-gyp expects..
463 + dodir /usr/include/node/deps/{v8,uv}
464 + dosym . /usr/include/node/src
465 + for var in deps/{uv,v8}/include; do
466 + dosym ../.. /usr/include/node/${var}
467 + done
468 +
469 + if use doc; then
470 + docinto html
471 + dodoc -r "${S}"/doc/*
472 + fi
473 +
474 + if use npm; then
475 + keepdir /etc/npm
476 +
477 + # Install bash completion for `npm`
478 + local tmp_npm_completion_file="$(TMPDIR="${T}" mktemp -t npm.XXXXXXXXXX)"
479 + "${ED}/usr/bin/npm" completion > "${tmp_npm_completion_file}"
480 + newbashcomp "${tmp_npm_completion_file}" npm
481 +
482 + # Move man pages
483 + doman "${LIBDIR}"/node_modules/npm/man/man{1,5,7}/*
484 +
485 + # Clean up
486 + rm -f "${LIBDIR}"/node_modules/npm/{.mailmap,.npmignore,Makefile}
487 + rm -rf "${LIBDIR}"/node_modules/npm/{doc,html,man}
488 +
489 + local find_exp="-or -name"
490 + local find_name=()
491 + for match in "AUTHORS*" "CHANGELOG*" "CONTRIBUT*" "README*" \
492 + ".travis.yml" ".eslint*" ".wercker.yml" ".npmignore" \
493 + "*.md" "*.markdown" "*.bat" "*.cmd"; do
494 + find_name+=( ${find_exp} "${match}" )
495 + done
496 +
497 + # Remove various development and/or inappropriate files and
498 + # useless docs of dependend packages.
499 + find "${LIBDIR}"/node_modules \
500 + \( -type d -name examples \) -or \( -type f \( \
501 + -iname "LICEN?E*" \
502 + "${find_name[@]}" \
503 + \) \) -exec rm -rf "{}" \;
504 + fi
505 +
506 + mv "${ED}"/usr/share/doc/node "${ED}"/usr/share/doc/${PF} || die
507 +}
508 +
509 +src_test() {
510 + if has usersandbox ${FEATURES}; then
511 + rm -f "${S}"/test/parallel/test-fs-mkdir.js
512 + ewarn "You are emerging ${PN} with 'usersandbox' enabled. Excluding tests known to fail in this mode." \
513 + "For full test coverage, emerge =${CATEGORY}/${PF} with 'FEATURES=-usersandbox'."
514 + fi
515 +
516 + out/${BUILDTYPE}/cctest || die
517 + "${EPYTHON}" tools/test.py --mode=${BUILDTYPE,,} --flaky-tests=dontcare -J message parallel sequential || die
518 +}
519
520 diff --git a/net-libs/nodejs/nodejs-18.9.1.ebuild b/net-libs/nodejs/nodejs-18.9.1.ebuild
521 new file mode 100644
522 index 000000000000..6c803a2495ee
523 --- /dev/null
524 +++ b/net-libs/nodejs/nodejs-18.9.1.ebuild
525 @@ -0,0 +1,250 @@
526 +# Copyright 1999-2022 Gentoo Authors
527 +# Distributed under the terms of the GNU General Public License v2
528 +
529 +EAPI=8
530 +
531 +CONFIG_CHECK="~ADVISE_SYSCALLS"
532 +PYTHON_COMPAT=( python3_{8..11} )
533 +PYTHON_REQ_USE="threads(+)"
534 +
535 +inherit bash-completion-r1 check-reqs flag-o-matic linux-info pax-utils python-any-r1 toolchain-funcs xdg-utils
536 +
537 +DESCRIPTION="A JavaScript runtime built on Chrome's V8 JavaScript engine"
538 +HOMEPAGE="https://nodejs.org/"
539 +LICENSE="Apache-1.1 Apache-2.0 BSD BSD-2 MIT"
540 +
541 +if [[ ${PV} == *9999 ]]; then
542 + inherit git-r3
543 + EGIT_REPO_URI="https://github.com/nodejs/node"
544 + SLOT="0"
545 +else
546 + SRC_URI="https://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz"
547 + SLOT="0/$(ver_cut 1)"
548 + KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64 ~riscv ~x86 ~amd64-linux ~x64-macos"
549 + S="${WORKDIR}/node-v${PV}"
550 +fi
551 +
552 +IUSE="cpu_flags_x86_sse2 debug doc +icu inspector lto +npm pax-kernel +snapshot +ssl +system-icu +system-ssl systemtap test"
553 +REQUIRED_USE="inspector? ( icu ssl )
554 + npm? ( ssl )
555 + system-icu? ( icu )
556 + system-ssl? ( ssl )"
557 +
558 +RESTRICT="!test? ( test )"
559 +
560 +RDEPEND=">=app-arch/brotli-1.0.9:=
561 + >=dev-libs/libuv-1.40.0:=
562 + >=net-dns/c-ares-1.17.2:=
563 + >=net-libs/nghttp2-1.41.0:=
564 + sys-libs/zlib
565 + system-icu? ( >=dev-libs/icu-67:= )
566 + system-ssl? ( >=dev-libs/openssl-1.1.1:0= )
567 + sys-devel/gcc:*"
568 +BDEPEND="${PYTHON_DEPS}
569 + sys-apps/coreutils
570 + virtual/pkgconfig
571 + systemtap? ( dev-util/systemtap )
572 + test? ( net-misc/curl )
573 + pax-kernel? ( sys-apps/elfix )"
574 +DEPEND="${RDEPEND}"
575 +
576 +PATCHES=(
577 + "${FILESDIR}"/${PN}-12.22.5-shared_c-ares_nameser_h.patch
578 + "${FILESDIR}"/${PN}-15.2.0-global-npm-config.patch
579 +)
580 +
581 +# These are measured on a loong machine with -ggdb on, and only checked
582 +# if debugging flags are present in CFLAGS.
583 +#
584 +# The final link consumed a little more than 7GiB alone, so 8GiB is the lower
585 +# limit for memory usage. Disk usage was 19.1GiB for the build directory and
586 +# 1.2GiB for the installed image, so we leave some room for architectures with
587 +# fatter binaries and set the disk requirement to 22GiB.
588 +CHECKREQS_MEMORY="8G"
589 +CHECKREQS_DISK_BUILD="22G"
590 +
591 +pkg_pretend() {
592 + (use x86 && ! use cpu_flags_x86_sse2) && \
593 + die "Your CPU doesn't support the required SSE2 instruction."
594 +
595 + if [[ ${MERGE_TYPE} != "binary" ]]; then
596 + if is-flagq "-g*" && ! is-flagq "-g*0" ; then
597 + einfo "Checking for sufficient disk space and memory to build ${PN} with debugging CFLAGS"
598 + check-reqs_pkg_pretend
599 + fi
600 + fi
601 +}
602 +
603 +pkg_setup() {
604 + python-any-r1_pkg_setup
605 + linux-info_pkg_setup
606 +}
607 +
608 +src_prepare() {
609 + tc-export AR CC CXX PKG_CONFIG
610 + export V=1
611 + export BUILDTYPE=Release
612 +
613 + # fix compilation on Darwin
614 + # https://code.google.com/p/gyp/issues/detail?id=260
615 + sed -i -e "/append('-arch/d" tools/gyp/pylib/gyp/xcode_emulation.py || die
616 +
617 + # less verbose install output (stating the same as portage, basically)
618 + sed -i -e "/print/d" tools/install.py || die
619 +
620 + # proper libdir, hat tip @ryanpcmcquen https://github.com/iojs/io.js/issues/504
621 + local LIBDIR=$(get_libdir)
622 + sed -i -e "s|lib/|${LIBDIR}/|g" tools/install.py || die
623 + sed -i -e "s/'lib'/'${LIBDIR}'/" deps/npm/lib/npm.js || die
624 +
625 + # Avoid writing a depfile, not useful
626 + sed -i -e "/DEPFLAGS =/d" tools/gyp/pylib/gyp/generator/make.py || die
627 +
628 + sed -i -e "/'-O3'/d" common.gypi node.gypi || die
629 +
630 + # debug builds. change install path, remove optimisations and override buildtype
631 + if use debug; then
632 + sed -i -e "s|out/Release/|out/Debug/|g" tools/install.py || die
633 + BUILDTYPE=Debug
634 + fi
635 +
636 + # We need to disable mprotect on two files when it builds Bug 694100.
637 + use pax-kernel && PATCHES+=( "${FILESDIR}"/${PN}-18.3.0-paxmarking.patch )
638 +
639 + # All this test does is check if the npm CLI produces warnings of any sort,
640 + # failing if it does. Overkill, much? Especially given one possible warning
641 + # is that there is a newer version of npm available upstream (yes, it does
642 + # use the network if available), thus making it a real possibility for this
643 + # test to begin failing one day even though it was fine before.
644 + rm -f test/parallel/test-release-npm.js
645 +
646 + default
647 +}
648 +
649 +src_configure() {
650 + xdg_environment_reset
651 +
652 + # LTO compiler flags are handled by configure.py itself
653 + filter-flags '-flto*'
654 + # nodejs unconditionally links to libatomic #869992
655 + # specifically it requires __atomic_is_lock_free which
656 + # is not yet implemented by sys-libs/compiler-rt (see
657 + # https://reviews.llvm.org/D85044?id=287068), therefore
658 + # we depend on gcc and force using libgcc as the support lib
659 + tc-is-clang && append-ldflags "--rtlib=libgcc --unwindlib=libgcc"
660 +
661 + local myconf=(
662 + --shared-brotli
663 + --shared-cares
664 + --shared-libuv
665 + --shared-nghttp2
666 + --shared-zlib
667 + )
668 + use debug && myconf+=( --debug )
669 + use lto && myconf+=( --enable-lto )
670 + if use system-icu; then
671 + myconf+=( --with-intl=system-icu )
672 + elif use icu; then
673 + myconf+=( --with-intl=full-icu )
674 + else
675 + myconf+=( --with-intl=none )
676 + fi
677 + use inspector || myconf+=( --without-inspector )
678 + use npm || myconf+=( --without-npm )
679 + use snapshot || myconf+=( --without-node-snapshot )
680 + if use ssl; then
681 + use system-ssl && myconf+=( --shared-openssl --openssl-use-def-ca-store )
682 + else
683 + myconf+=( --without-ssl )
684 + fi
685 +
686 + local myarch=""
687 + case "${ARCH}:${ABI}" in
688 + *:amd64) myarch="x64";;
689 + *:arm) myarch="arm";;
690 + *:arm64) myarch="arm64";;
691 + loong:lp64*) myarch="loong64";;
692 + riscv:lp64*) myarch="riscv64";;
693 + *:ppc64) myarch="ppc64";;
694 + *:x32) myarch="x32";;
695 + *:x86) myarch="ia32";;
696 + *) myarch="${ABI}";;
697 + esac
698 +
699 + GYP_DEFINES="linux_use_gold_flags=0
700 + linux_use_bundled_binutils=0
701 + linux_use_bundled_gold=0" \
702 + "${EPYTHON}" configure.py \
703 + --prefix="${EPREFIX}"/usr \
704 + --dest-cpu=${myarch} \
705 + $(use_with systemtap dtrace) \
706 + "${myconf[@]}" || die
707 +}
708 +
709 +src_compile() {
710 + emake -C out
711 +}
712 +
713 +src_install() {
714 + local LIBDIR="${ED}/usr/$(get_libdir)"
715 + default
716 +
717 + pax-mark -m "${ED}"/usr/bin/node
718 +
719 + # set up a symlink structure that node-gyp expects..
720 + dodir /usr/include/node/deps/{v8,uv}
721 + dosym . /usr/include/node/src
722 + for var in deps/{uv,v8}/include; do
723 + dosym ../.. /usr/include/node/${var}
724 + done
725 +
726 + if use doc; then
727 + docinto html
728 + dodoc -r "${S}"/doc/*
729 + fi
730 +
731 + if use npm; then
732 + keepdir /etc/npm
733 +
734 + # Install bash completion for `npm`
735 + local tmp_npm_completion_file="$(TMPDIR="${T}" mktemp -t npm.XXXXXXXXXX)"
736 + "${ED}/usr/bin/npm" completion > "${tmp_npm_completion_file}"
737 + newbashcomp "${tmp_npm_completion_file}" npm
738 +
739 + # Move man pages
740 + doman "${LIBDIR}"/node_modules/npm/man/man{1,5,7}/*
741 +
742 + # Clean up
743 + rm -f "${LIBDIR}"/node_modules/npm/{.mailmap,.npmignore,Makefile}
744 + rm -rf "${LIBDIR}"/node_modules/npm/{doc,html,man}
745 +
746 + local find_exp="-or -name"
747 + local find_name=()
748 + for match in "AUTHORS*" "CHANGELOG*" "CONTRIBUT*" "README*" \
749 + ".travis.yml" ".eslint*" ".wercker.yml" ".npmignore" \
750 + "*.md" "*.markdown" "*.bat" "*.cmd"; do
751 + find_name+=( ${find_exp} "${match}" )
752 + done
753 +
754 + # Remove various development and/or inappropriate files and
755 + # useless docs of dependend packages.
756 + find "${LIBDIR}"/node_modules \
757 + \( -type d -name examples \) -or \( -type f \( \
758 + -iname "LICEN?E*" \
759 + "${find_name[@]}" \
760 + \) \) -exec rm -rf "{}" \;
761 + fi
762 +
763 + mv "${ED}"/usr/share/doc/node "${ED}"/usr/share/doc/${PF} || die
764 +}
765 +
766 +src_test() {
767 + if has usersandbox ${FEATURES}; then
768 + rm -f "${S}"/test/parallel/test-fs-mkdir.js
769 + ewarn "You are emerging ${PN} with 'usersandbox' enabled. Excluding tests known to fail in this mode." \
770 + "For full test coverage, emerge =${CATEGORY}/${PF} with 'FEATURES=-usersandbox'."
771 + fi
772 +
773 + out/${BUILDTYPE}/cctest || die
774 + "${EPYTHON}" tools/test.py --mode=${BUILDTYPE,,} --flaky-tests=dontcare -J message parallel sequential || die
775 +}