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