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/files/, net-libs/nodejs/
Date: Wed, 14 Sep 2022 06:14:37
Message-Id: 1663136060.b8ed541d56fe430d8c9d88924de1700db65d37fe.williamh@gentoo
1 commit: b8ed541d56fe430d8c9d88924de1700db65d37fe
2 Author: William Hubbs <williamh <AT> gentoo <DOT> org>
3 AuthorDate: Wed Sep 14 06:11:19 2022 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Wed Sep 14 06:14:20 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b8ed541d
7
8 net-libs/nodejs: add 18.9.0
9
10 Closes: https://github.com/gentoo/gentoo/pull/27242
11 Bug: https://bugs.gentoo.org/869992
12 Signed-off-by: William Hubbs <williamh <AT> gentoo.org>
13
14 net-libs/nodejs/Manifest | 1 +
15 .../files/nodejs-18.9.0-clang-fix-libatomic.patch | 16 ++
16 net-libs/nodejs/nodejs-18.9.0.ebuild | 246 +++++++++++++++++++++
17 3 files changed, 263 insertions(+)
18
19 diff --git a/net-libs/nodejs/Manifest b/net-libs/nodejs/Manifest
20 index ba40dcfe845a..e666bf77bd2f 100644
21 --- a/net-libs/nodejs/Manifest
22 +++ b/net-libs/nodejs/Manifest
23 @@ -3,3 +3,4 @@ DIST node-v16.16.0.tar.xz 35039712 BLAKE2B e4cf7debda3d32b515d60d11ac7ebd788fdab
24 DIST node-v16.17.0.tar.xz 35664964 BLAKE2B 490bcb65440a81d356f6351c45b19a4022cd55834b8b90da9eed2006042ab73732d581d58983b34b12ddef618d3e99fe760ef93447a2201268e2ab86466d3bb1 SHA512 8906ee337562b6f0b1614aa57084499ffd3bdfe8f8e706de8fed98baed5a92f691c534528b98f6321cf8a1eaaed6b45a938f28bd08167fbd75bfeb432ca03181
25 DIST node-v18.6.0.tar.xz 37189620 BLAKE2B 15a8a874f39db7de576d3ba81fddcb8072cb170ebb12308d2ade2efb9c8200c561671f453371a16db82d4c0f02522a28f6ae01216d11be40df94b53b184828b3 SHA512 d682e25a71ffbef90e2cb3c55e22dbd548952c4de24d48c47206afd270fd17c7bda95b3241840bf6a470f28d2389f3c6fddbb812ad17cf1d36262ff25fcda859
26 DIST node-v18.7.0.tar.xz 36945328 BLAKE2B 8ec945347ba396f7c65f544325690abdece4aa82ce1dae63e56662c78f445845f3f858a803ee2b130444f44cd38f4e1d8f5df0240d5a0c5124a38cbab42daafc SHA512 3da56b25f304b4e205c27a59f2e442e7216e494465e4cce9f51ffd3f7c7da3ab3519c4b7d1eb41a754b86ecfa1d138d270578aa3908b4fd42cc5dbfd389a6798
27 +DIST node-v18.9.0.tar.xz 38309908 BLAKE2B 87ce3e45c6450bc686fe800a9c39a6c0cb5c01279c3052431455c29e0fc0b244de122dd899a43da1e8291fe60457847d307c7193c4e69f2d6f6b8824f4555daf SHA512 60bf98bc5011876429c9a687141b916fc6023ba21f1a641fef2f11d53218db24f442542382495455d2f107d708fcd04994e239a9bbfb52f070935c9048089e81
28
29 diff --git a/net-libs/nodejs/files/nodejs-18.9.0-clang-fix-libatomic.patch b/net-libs/nodejs/files/nodejs-18.9.0-clang-fix-libatomic.patch
30 new file mode 100644
31 index 000000000000..5296ed1318b0
32 --- /dev/null
33 +++ b/net-libs/nodejs/files/nodejs-18.9.0-clang-fix-libatomic.patch
34 @@ -0,0 +1,16 @@
35 +https://bugs.gentoo.org/869992
36 +
37 +diff --git a/node.gyp b/node.gyp
38 +index 347d82d2e1..8c4ffea256 100644
39 +--- a/node.gyp
40 ++++ b/node.gyp
41 +@@ -117,9 +117,6 @@
42 + '-Wl,-bnoerrmsg',
43 + ],
44 + }],
45 +- ['OS == "linux" and llvm_version != "0.0"', {
46 +- 'libraries': ['-latomic'],
47 +- }],
48 + ],
49 + },
50 +
51
52 diff --git a/net-libs/nodejs/nodejs-18.9.0.ebuild b/net-libs/nodejs/nodejs-18.9.0.ebuild
53 new file mode 100644
54 index 000000000000..03af59cf2a80
55 --- /dev/null
56 +++ b/net-libs/nodejs/nodejs-18.9.0.ebuild
57 @@ -0,0 +1,246 @@
58 +# Copyright 1999-2022 Gentoo Authors
59 +# Distributed under the terms of the GNU General Public License v2
60 +
61 +EAPI=8
62 +
63 +CONFIG_CHECK="~ADVISE_SYSCALLS"
64 +PYTHON_COMPAT=( python3_{8..11} )
65 +PYTHON_REQ_USE="threads(+)"
66 +
67 +inherit bash-completion-r1 check-reqs flag-o-matic linux-info pax-utils python-any-r1 toolchain-funcs xdg-utils
68 +
69 +DESCRIPTION="A JavaScript runtime built on Chrome's V8 JavaScript engine"
70 +HOMEPAGE="https://nodejs.org/"
71 +LICENSE="Apache-1.1 Apache-2.0 BSD BSD-2 MIT"
72 +
73 +if [[ ${PV} == *9999 ]]; then
74 + inherit git-r3
75 + EGIT_REPO_URI="https://github.com/nodejs/node"
76 + SLOT="0"
77 +else
78 + SRC_URI="https://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz"
79 + SLOT="0/$(ver_cut 1)"
80 + KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64 ~riscv ~x86 ~amd64-linux ~x64-macos"
81 + S="${WORKDIR}/node-v${PV}"
82 +fi
83 +
84 +IUSE="cpu_flags_x86_sse2 debug doc +icu inspector lto +npm pax-kernel +snapshot +ssl +system-icu +system-ssl systemtap test"
85 +REQUIRED_USE="inspector? ( icu ssl )
86 + npm? ( ssl )
87 + system-icu? ( icu )
88 + system-ssl? ( ssl )"
89 +
90 +RESTRICT="!test? ( test )"
91 +
92 +RDEPEND=">=app-arch/brotli-1.0.9:=
93 + >=dev-libs/libuv-1.40.0:=
94 + >=net-dns/c-ares-1.17.2:=
95 + >=net-libs/nghttp2-1.41.0:=
96 + sys-libs/zlib
97 + system-icu? ( >=dev-libs/icu-67:= )
98 + system-ssl? ( >=dev-libs/openssl-1.1.1:0= )"
99 +BDEPEND="${PYTHON_DEPS}
100 + sys-apps/coreutils
101 + virtual/pkgconfig
102 + systemtap? ( dev-util/systemtap )
103 + test? ( net-misc/curl )
104 + pax-kernel? ( sys-apps/elfix )"
105 +DEPEND="${RDEPEND}"
106 +
107 +PATCHES=(
108 + "${FILESDIR}"/${PN}-12.22.5-shared_c-ares_nameser_h.patch
109 + "${FILESDIR}"/${PN}-15.2.0-global-npm-config.patch
110 + "${FILESDIR}"/${P}-clang-fix-libatomic.patch
111 +)
112 +
113 +# These are measured on a loong machine with -ggdb on, and only checked
114 +# if debugging flags are present in CFLAGS.
115 +#
116 +# The final link consumed a little more than 7GiB alone, so 8GiB is the lower
117 +# limit for memory usage. Disk usage was 19.1GiB for the build directory and
118 +# 1.2GiB for the installed image, so we leave some room for architectures with
119 +# fatter binaries and set the disk requirement to 22GiB.
120 +CHECKREQS_MEMORY="8G"
121 +CHECKREQS_DISK_BUILD="22G"
122 +
123 +pkg_pretend() {
124 + (use x86 && ! use cpu_flags_x86_sse2) && \
125 + die "Your CPU doesn't support the required SSE2 instruction."
126 +
127 + if [[ ${MERGE_TYPE} != "binary" ]]; then
128 + if is-flagq "-g*" && ! is-flagq "-g*0" ; then
129 + einfo "Checking for sufficient disk space and memory to build ${PN} with debugging CFLAGS"
130 + check-reqs_pkg_pretend
131 + fi
132 + fi
133 +}
134 +
135 +pkg_setup() {
136 + python-any-r1_pkg_setup
137 + linux-info_pkg_setup
138 +}
139 +
140 +src_prepare() {
141 + tc-export AR CC CXX PKG_CONFIG
142 + export V=1
143 + export BUILDTYPE=Release
144 +
145 + # fix compilation on Darwin
146 + # https://code.google.com/p/gyp/issues/detail?id=260
147 + sed -i -e "/append('-arch/d" tools/gyp/pylib/gyp/xcode_emulation.py || die
148 +
149 + # less verbose install output (stating the same as portage, basically)
150 + sed -i -e "/print/d" tools/install.py || die
151 +
152 + # proper libdir, hat tip @ryanpcmcquen https://github.com/iojs/io.js/issues/504
153 + local LIBDIR=$(get_libdir)
154 + sed -i -e "s|lib/|${LIBDIR}/|g" tools/install.py || die
155 + sed -i -e "s/'lib'/'${LIBDIR}'/" deps/npm/lib/npm.js || die
156 +
157 + # Avoid writing a depfile, not useful
158 + sed -i -e "/DEPFLAGS =/d" tools/gyp/pylib/gyp/generator/make.py || die
159 +
160 + sed -i -e "/'-O3'/d" common.gypi node.gypi || die
161 +
162 + # debug builds. change install path, remove optimisations and override buildtype
163 + if use debug; then
164 + sed -i -e "s|out/Release/|out/Debug/|g" tools/install.py || die
165 + BUILDTYPE=Debug
166 + fi
167 +
168 + # We need to disable mprotect on two files when it builds Bug 694100.
169 + use pax-kernel && PATCHES+=( "${FILESDIR}"/${PN}-18.3.0-paxmarking.patch )
170 +
171 + # All this test does is check if the npm CLI produces warnings of any sort,
172 + # failing if it does. Overkill, much? Especially given one possible warning
173 + # is that there is a newer version of npm available upstream (yes, it does
174 + # use the network if available), thus making it a real possibility for this
175 + # test to begin failing one day even though it was fine before.
176 + rm -f test/parallel/test-release-npm.js
177 +
178 + default
179 +}
180 +
181 +src_configure() {
182 + xdg_environment_reset
183 +
184 + # LTO compiler flags are handled by configure.py itself
185 + filter-flags '-flto*'
186 + # nodejs unconditionally links to libatomic #869992
187 + append-atomic-flags
188 +
189 + local myconf=(
190 + --shared-brotli
191 + --shared-cares
192 + --shared-libuv
193 + --shared-nghttp2
194 + --shared-zlib
195 + )
196 + use debug && myconf+=( --debug )
197 + use lto && myconf+=( --enable-lto )
198 + if use system-icu; then
199 + myconf+=( --with-intl=system-icu )
200 + elif use icu; then
201 + myconf+=( --with-intl=full-icu )
202 + else
203 + myconf+=( --with-intl=none )
204 + fi
205 + use inspector || myconf+=( --without-inspector )
206 + use npm || myconf+=( --without-npm )
207 + use snapshot || myconf+=( --without-node-snapshot )
208 + if use ssl; then
209 + use system-ssl && myconf+=( --shared-openssl --openssl-use-def-ca-store )
210 + else
211 + myconf+=( --without-ssl )
212 + fi
213 +
214 + local myarch=""
215 + case "${ARCH}:${ABI}" in
216 + *:amd64) myarch="x64";;
217 + *:arm) myarch="arm";;
218 + *:arm64) myarch="arm64";;
219 + loong:lp64*) myarch="loong64";;
220 + riscv:lp64*) myarch="riscv64";;
221 + *:ppc64) myarch="ppc64";;
222 + *:x32) myarch="x32";;
223 + *:x86) myarch="ia32";;
224 + *) myarch="${ABI}";;
225 + esac
226 +
227 + GYP_DEFINES="linux_use_gold_flags=0
228 + linux_use_bundled_binutils=0
229 + linux_use_bundled_gold=0" \
230 + "${EPYTHON}" configure.py \
231 + --prefix="${EPREFIX}"/usr \
232 + --dest-cpu=${myarch} \
233 + $(use_with systemtap dtrace) \
234 + "${myconf[@]}" || die
235 +}
236 +
237 +src_compile() {
238 + emake -C out
239 +}
240 +
241 +src_install() {
242 + local LIBDIR="${ED}/usr/$(get_libdir)"
243 + default
244 +
245 + pax-mark -m "${ED}"/usr/bin/node
246 +
247 + # set up a symlink structure that node-gyp expects..
248 + dodir /usr/include/node/deps/{v8,uv}
249 + dosym . /usr/include/node/src
250 + for var in deps/{uv,v8}/include; do
251 + dosym ../.. /usr/include/node/${var}
252 + done
253 +
254 + if use doc; then
255 + docinto html
256 + dodoc -r "${S}"/doc/*
257 + fi
258 +
259 + if use npm; then
260 + keepdir /etc/npm
261 +
262 + # Install bash completion for `npm`
263 + local tmp_npm_completion_file="$(TMPDIR="${T}" mktemp -t npm.XXXXXXXXXX)"
264 + "${ED}/usr/bin/npm" completion > "${tmp_npm_completion_file}"
265 + newbashcomp "${tmp_npm_completion_file}" npm
266 +
267 + # Move man pages
268 + doman "${LIBDIR}"/node_modules/npm/man/man{1,5,7}/*
269 +
270 + # Clean up
271 + rm -f "${LIBDIR}"/node_modules/npm/{.mailmap,.npmignore,Makefile}
272 + rm -rf "${LIBDIR}"/node_modules/npm/{doc,html,man}
273 +
274 + local find_exp="-or -name"
275 + local find_name=()
276 + for match in "AUTHORS*" "CHANGELOG*" "CONTRIBUT*" "README*" \
277 + ".travis.yml" ".eslint*" ".wercker.yml" ".npmignore" \
278 + "*.md" "*.markdown" "*.bat" "*.cmd"; do
279 + find_name+=( ${find_exp} "${match}" )
280 + done
281 +
282 + # Remove various development and/or inappropriate files and
283 + # useless docs of dependend packages.
284 + find "${LIBDIR}"/node_modules \
285 + \( -type d -name examples \) -or \( -type f \( \
286 + -iname "LICEN?E*" \
287 + "${find_name[@]}" \
288 + \) \) -exec rm -rf "{}" \;
289 + fi
290 +
291 + mv "${ED}"/usr/share/doc/node "${ED}"/usr/share/doc/${PF} || die
292 +}
293 +
294 +src_test() {
295 + if has usersandbox ${FEATURES}; then
296 + rm -f "${S}"/test/parallel/test-fs-mkdir.js
297 + ewarn "You are emerging ${PN} with 'usersandbox' enabled. Excluding tests known to fail in this mode." \
298 + "For full test coverage, emerge =${CATEGORY}/${PF} with 'FEATURES=-usersandbox'."
299 + fi
300 +
301 + out/${BUILDTYPE}/cctest || die
302 + "${EPYTHON}" tools/test.py --mode=${BUILDTYPE,,} --flaky-tests=dontcare -J message parallel sequential || die
303 +}