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, 17 Mar 2023 19:51:16
Message-Id: 1679082668.43730dfc076f5a39aefaa1895d82fdb67d140bf6.williamh@gentoo
1 commit: 43730dfc076f5a39aefaa1895d82fdb67d140bf6
2 Author: William Hubbs <williamh <AT> gentoo <DOT> org>
3 AuthorDate: Fri Mar 17 19:50:25 2023 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Fri Mar 17 19:51:08 2023 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=43730dfc
7
8 net-libs/nodejs: add 18.15.0
9
10 Signed-off-by: William Hubbs <williamh <AT> gentoo.org>
11
12 net-libs/nodejs/Manifest | 1 +
13 net-libs/nodejs/nodejs-18.15.0.ebuild | 255 ++++++++++++++++++++++++++++++++++
14 2 files changed, 256 insertions(+)
15
16 diff --git a/net-libs/nodejs/Manifest b/net-libs/nodejs/Manifest
17 index 114f4d1ef324..179aa0d88ab8 100644
18 --- a/net-libs/nodejs/Manifest
19 +++ b/net-libs/nodejs/Manifest
20 @@ -1,3 +1,4 @@
21 DIST node-v14.21.3.tar.xz 34508116 BLAKE2B 6fa001be10499ff2dfc920690dda9df25423f3e5c0bf19ae2ab9df571ca905e164e5a4eb778d0aa16a6026c354e39e063bde39d734a0532c3d95c937e509a9cb SHA512 bea8ccbb95ba00c220a42d30f8827fc94fb63725079dc3b63c65fd62d5f4f85d1d78e00b9b1f882a80449fa251930d3f3f5f9c8ae8d14d132660d4c4fd0b08f0
22 DIST node-v16.19.1.tar.xz 35465252 BLAKE2B 717cf15ab6fa5a2a643138959c4e539ef541783061605d0670564579bb43c89db0972228d42e529fb4104396ce7e1ed33486b6f28356752709a196924894b9f6 SHA512 7274ae1c7c92a4db9f8df9762f363cd9fb252c51142b98a25e718d749d10989d4228bc8d5fc864b83a4fe0c7f9541f59190b47374673a6ab4654a6366a373a48
23 DIST node-v18.14.2.tar.xz 40330824 BLAKE2B d18cf6a23f091633e5298727eeee15dec65ca83e688ff9fbed78385102aa44707ff4b33bcb034f6d10aab9a81a646ad7e8c28a239de151b816ff7072977df0de SHA512 72bb788b40d83bc42850dd9e2d00ffc06d9bcb17d24280d4721038038d1632846f859864328c849498255d1095296402b9b3c6b8910bbd399f7f516a43b9c86f
24 +DIST node-v18.15.0.tar.xz 40355624 BLAKE2B 56337de0b6e3c2421e6d9add81d30ada821525e0bb05fc977c91b7162f6dc075610ec53af50d6596cab6c0f647d61fb243896b25f0a768eeeefedf1a8bde1c05 SHA512 e41fcda469809186fd724ef4691e25f4a5bd81357ee99acf3d7faa1190a69c19cb62bd14aea199ca6f8b5cf9687af7d898cdf605ea2414d2c04db87ddb3b4dc8
25
26 diff --git a/net-libs/nodejs/nodejs-18.15.0.ebuild b/net-libs/nodejs/nodejs-18.15.0.ebuild
27 new file mode 100644
28 index 000000000000..a91643fe8d0d
29 --- /dev/null
30 +++ b/net-libs/nodejs/nodejs-18.15.0.ebuild
31 @@ -0,0 +1,255 @@
32 +# Copyright 1999-2023 Gentoo Authors
33 +# Distributed under the terms of the GNU General Public License v2
34 +
35 +EAPI=8
36 +
37 +CONFIG_CHECK="~ADVISE_SYSCALLS"
38 +PYTHON_COMPAT=( python3_{9..11} )
39 +PYTHON_REQ_USE="threads(+)"
40 +
41 +inherit bash-completion-r1 check-reqs flag-o-matic linux-info pax-utils python-any-r1 toolchain-funcs xdg-utils
42 +
43 +DESCRIPTION="A JavaScript runtime built on Chrome's V8 JavaScript engine"
44 +HOMEPAGE="https://nodejs.org/"
45 +LICENSE="Apache-1.1 Apache-2.0 BSD BSD-2 MIT"
46 +
47 +if [[ ${PV} == *9999 ]]; then
48 + inherit git-r3
49 + EGIT_REPO_URI="https://github.com/nodejs/node"
50 + SLOT="0"
51 +else
52 + SRC_URI="https://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz"
53 + SLOT="0/$(ver_cut 1)"
54 + KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64 ~riscv ~x86 ~amd64-linux ~x64-macos"
55 + S="${WORKDIR}/node-v${PV}"
56 +fi
57 +
58 +IUSE="cpu_flags_x86_sse2 debug doc +icu inspector lto +npm pax-kernel +snapshot +ssl +system-icu +system-ssl systemtap test"
59 +REQUIRED_USE="inspector? ( icu ssl )
60 + npm? ( ssl )
61 + system-icu? ( icu )
62 + system-ssl? ( ssl )"
63 +
64 +RESTRICT="!test? ( test )"
65 +
66 +RDEPEND=">=app-arch/brotli-1.0.9:=
67 + >=dev-libs/libuv-1.44.0:=
68 + >=net-dns/c-ares-1.17.2:=
69 + >=net-libs/nghttp2-1.41.0:=
70 + sys-libs/zlib
71 + system-icu? ( >=dev-libs/icu-67:= )
72 + system-ssl? ( >=dev-libs/openssl-1.1.1:0= )
73 + sys-devel/gcc:*"
74 +BDEPEND="${PYTHON_DEPS}
75 + sys-apps/coreutils
76 + virtual/pkgconfig
77 + systemtap? ( dev-util/systemtap )
78 + test? ( net-misc/curl )
79 + pax-kernel? ( sys-apps/elfix )"
80 +DEPEND="${RDEPEND}"
81 +
82 +# These are measured on a loong machine with -ggdb on, and only checked
83 +# if debugging flags are present in CFLAGS.
84 +#
85 +# The final link consumed a little more than 7GiB alone, so 8GiB is the lower
86 +# limit for memory usage. Disk usage was 19.1GiB for the build directory and
87 +# 1.2GiB for the installed image, so we leave some room for architectures with
88 +# fatter binaries and set the disk requirement to 22GiB.
89 +CHECKREQS_MEMORY="8G"
90 +CHECKREQS_DISK_BUILD="22G"
91 +
92 +pkg_pretend() {
93 + (use x86 && ! use cpu_flags_x86_sse2) && \
94 + die "Your CPU doesn't support the required SSE2 instruction."
95 +
96 + if [[ ${MERGE_TYPE} != "binary" ]]; then
97 + if is-flagq "-g*" && ! is-flagq "-g*0" ; then
98 + einfo "Checking for sufficient disk space and memory to build ${PN} with debugging CFLAGS"
99 + check-reqs_pkg_pretend
100 + fi
101 + fi
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}-18.3.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 "${ARCH}:${ABI}" in
189 + *:amd64) myarch="x64";;
190 + *:arm) myarch="arm";;
191 + *:arm64) myarch="arm64";;
192 + loong:lp64*) myarch="loong64";;
193 + riscv:lp64*) myarch="riscv64";;
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 + keepdir /etc/npm
234 + echo "NPM_CONFIG_GLOBALCONFIG=${EPREFIX}/etc/npm/npmrc" > "${T}"/50npm
235 + doenvd "${T}"/50npm
236 +
237 + # Install bash completion for `npm`
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 +
242 + # Move man pages
243 + doman "${LIBDIR}"/node_modules/npm/man/man{1,5,7}/*
244 +
245 + # Clean up
246 + rm -f "${LIBDIR}"/node_modules/npm/{.mailmap,.npmignore,Makefile}
247 + rm -rf "${LIBDIR}"/node_modules/npm/{doc,html,man}
248 +
249 + local find_exp="-or -name"
250 + local find_name=()
251 + for match in "AUTHORS*" "CHANGELOG*" "CONTRIBUT*" "README*" \
252 + ".travis.yml" ".eslint*" ".wercker.yml" ".npmignore" \
253 + "*.md" "*.markdown" "*.bat" "*.cmd"; do
254 + find_name+=( ${find_exp} "${match}" )
255 + done
256 +
257 + # Remove various development and/or inappropriate files and
258 + # useless docs of dependend packages.
259 + find "${LIBDIR}"/node_modules \
260 + \( -type d -name examples \) -or \( -type f \( \
261 + -iname "LICEN?E*" \
262 + "${find_name[@]}" \
263 + \) \) -exec rm -rf "{}" \;
264 + fi
265 +
266 + mv "${ED}"/usr/share/doc/node "${ED}"/usr/share/doc/${PF} || die
267 +}
268 +
269 +src_test() {
270 + rm -f "${S}"/tests/parallel/test-dns-setserver-when-querying.js
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 +pkg_postinst() {
282 + if use npm; then
283 + ewarn "remember to run: source /etc/profile if you plan to use nodejs"
284 + ewarn " in your current shell"
285 + fi
286 +}