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: Thu, 29 Sep 2022 18:56:38
Message-Id: 1664477785.7c4f9958ebda0b7bc991a540045c29f96a40d3d6.williamh@gentoo
1 commit: 7c4f9958ebda0b7bc991a540045c29f96a40d3d6
2 Author: William Hubbs <williamh <AT> gentoo <DOT> org>
3 AuthorDate: Thu Sep 29 18:55:40 2022 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Thu Sep 29 18:56:25 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7c4f9958
7
8 net-libs/nodejs: add 18.10.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.10.0.ebuild | 250 ++++++++++++++++++++++++++++++++++
14 2 files changed, 251 insertions(+)
15
16 diff --git a/net-libs/nodejs/Manifest b/net-libs/nodejs/Manifest
17 index 39bc486c5a03..716b1e4eadb2 100644
18 --- a/net-libs/nodejs/Manifest
19 +++ b/net-libs/nodejs/Manifest
20 @@ -1,3 +1,4 @@
21 DIST node-v14.20.1.tar.xz 34482880 BLAKE2B 3d21645c94e194c4a9a499544032643a2b14f507642c8d01bd54b3446c691c6d59109c08713a4b2e210c7418baded496b80308687b31830d2ccee5f8c9a06178 SHA512 27186e6b877189c7976fe566cbc4f5e961941f74af7e2f96a0829d6061b880569095666da70545f61a017f1b520050ab6ef5fc98e2e71e72253633f88a9264fb
22 DIST node-v16.17.1.tar.xz 35661452 BLAKE2B 1fd9fad86f4f5161b2e06199a18f4df431b95ca03214cedefa4b76a9703e7153120c8c3f0f9b07fce825015533d2f52cc29e5737308c69d809c3e6edbc0eacee SHA512 f9aefcc72a260cbdc162db8db01885a93b1b2248ff0c20c6e9b98819b8b5e599f7da89eeeb7cfe202764cca3974b6ca48610351176f6767ef6ad630ca7ee8cb7
23 +DIST node-v18.10.0.tar.xz 38364672 BLAKE2B 0746f9c8bba75a996987c77e6e4c328e56a54517b768280254edf2feffa7d6b578ead54ec86753dd84f764ece6d4b8d22567670d51ef70e70a22d99fc2a835fb SHA512 7dbdb75786a8b85b66a8258ec1754aeaaaed3fed086b6a6caf46940c57fec16305a34931f27c33ed6ac036f16a7dbf010f17a6eec26316d71f3b3086626cf68b
24 DIST node-v18.9.1.tar.xz 38315220 BLAKE2B 515ab64db023c5809c476c1248e2d47a49d46ed273ee0f91ac803791b0e7a51f3dd2f0ee7f30901d9a1fbc9172dd971c9845c86a703c6194bc8f983d3f81567c SHA512 fc570dbd41197363d0f9bc3f329fbdffd0cb5b7382327e206d40b3b4e42a80fa65debb172abd501021bcc5082d8d99fc5f6faa05cf87066170c87be1b15e8734
25
26 diff --git a/net-libs/nodejs/nodejs-18.10.0.ebuild b/net-libs/nodejs/nodejs-18.10.0.ebuild
27 new file mode 100644
28 index 000000000000..6c803a2495ee
29 --- /dev/null
30 +++ b/net-libs/nodejs/nodejs-18.10.0.ebuild
31 @@ -0,0 +1,250 @@
32 +# Copyright 1999-2022 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_{8..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.40.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 +PATCHES=(
83 + "${FILESDIR}"/${PN}-12.22.5-shared_c-ares_nameser_h.patch
84 + "${FILESDIR}"/${PN}-15.2.0-global-npm-config.patch
85 +)
86 +
87 +# These are measured on a loong machine with -ggdb on, and only checked
88 +# if debugging flags are present in CFLAGS.
89 +#
90 +# The final link consumed a little more than 7GiB alone, so 8GiB is the lower
91 +# limit for memory usage. Disk usage was 19.1GiB for the build directory and
92 +# 1.2GiB for the installed image, so we leave some room for architectures with
93 +# fatter binaries and set the disk requirement to 22GiB.
94 +CHECKREQS_MEMORY="8G"
95 +CHECKREQS_DISK_BUILD="22G"
96 +
97 +pkg_pretend() {
98 + (use x86 && ! use cpu_flags_x86_sse2) && \
99 + die "Your CPU doesn't support the required SSE2 instruction."
100 +
101 + if [[ ${MERGE_TYPE} != "binary" ]]; then
102 + if is-flagq "-g*" && ! is-flagq "-g*0" ; then
103 + einfo "Checking for sufficient disk space and memory to build ${PN} with debugging CFLAGS"
104 + check-reqs_pkg_pretend
105 + fi
106 + fi
107 +}
108 +
109 +pkg_setup() {
110 + python-any-r1_pkg_setup
111 + linux-info_pkg_setup
112 +}
113 +
114 +src_prepare() {
115 + tc-export AR CC CXX PKG_CONFIG
116 + export V=1
117 + export BUILDTYPE=Release
118 +
119 + # fix compilation on Darwin
120 + # https://code.google.com/p/gyp/issues/detail?id=260
121 + sed -i -e "/append('-arch/d" tools/gyp/pylib/gyp/xcode_emulation.py || die
122 +
123 + # less verbose install output (stating the same as portage, basically)
124 + sed -i -e "/print/d" tools/install.py || die
125 +
126 + # proper libdir, hat tip @ryanpcmcquen https://github.com/iojs/io.js/issues/504
127 + local LIBDIR=$(get_libdir)
128 + sed -i -e "s|lib/|${LIBDIR}/|g" tools/install.py || die
129 + sed -i -e "s/'lib'/'${LIBDIR}'/" deps/npm/lib/npm.js || die
130 +
131 + # Avoid writing a depfile, not useful
132 + sed -i -e "/DEPFLAGS =/d" tools/gyp/pylib/gyp/generator/make.py || die
133 +
134 + sed -i -e "/'-O3'/d" common.gypi node.gypi || die
135 +
136 + # debug builds. change install path, remove optimisations and override buildtype
137 + if use debug; then
138 + sed -i -e "s|out/Release/|out/Debug/|g" tools/install.py || die
139 + BUILDTYPE=Debug
140 + fi
141 +
142 + # We need to disable mprotect on two files when it builds Bug 694100.
143 + use pax-kernel && PATCHES+=( "${FILESDIR}"/${PN}-18.3.0-paxmarking.patch )
144 +
145 + # All this test does is check if the npm CLI produces warnings of any sort,
146 + # failing if it does. Overkill, much? Especially given one possible warning
147 + # is that there is a newer version of npm available upstream (yes, it does
148 + # use the network if available), thus making it a real possibility for this
149 + # test to begin failing one day even though it was fine before.
150 + rm -f test/parallel/test-release-npm.js
151 +
152 + default
153 +}
154 +
155 +src_configure() {
156 + xdg_environment_reset
157 +
158 + # LTO compiler flags are handled by configure.py itself
159 + filter-flags '-flto*'
160 + # nodejs unconditionally links to libatomic #869992
161 + # specifically it requires __atomic_is_lock_free which
162 + # is not yet implemented by sys-libs/compiler-rt (see
163 + # https://reviews.llvm.org/D85044?id=287068), therefore
164 + # we depend on gcc and force using libgcc as the support lib
165 + tc-is-clang && append-ldflags "--rtlib=libgcc --unwindlib=libgcc"
166 +
167 + local myconf=(
168 + --shared-brotli
169 + --shared-cares
170 + --shared-libuv
171 + --shared-nghttp2
172 + --shared-zlib
173 + )
174 + use debug && myconf+=( --debug )
175 + use lto && myconf+=( --enable-lto )
176 + if use system-icu; then
177 + myconf+=( --with-intl=system-icu )
178 + elif use icu; then
179 + myconf+=( --with-intl=full-icu )
180 + else
181 + myconf+=( --with-intl=none )
182 + fi
183 + use inspector || myconf+=( --without-inspector )
184 + use npm || myconf+=( --without-npm )
185 + use snapshot || myconf+=( --without-node-snapshot )
186 + if use ssl; then
187 + use system-ssl && myconf+=( --shared-openssl --openssl-use-def-ca-store )
188 + else
189 + myconf+=( --without-ssl )
190 + fi
191 +
192 + local myarch=""
193 + case "${ARCH}:${ABI}" in
194 + *:amd64) myarch="x64";;
195 + *:arm) myarch="arm";;
196 + *:arm64) myarch="arm64";;
197 + loong:lp64*) myarch="loong64";;
198 + riscv:lp64*) myarch="riscv64";;
199 + *:ppc64) myarch="ppc64";;
200 + *:x32) myarch="x32";;
201 + *:x86) myarch="ia32";;
202 + *) myarch="${ABI}";;
203 + esac
204 +
205 + GYP_DEFINES="linux_use_gold_flags=0
206 + linux_use_bundled_binutils=0
207 + linux_use_bundled_gold=0" \
208 + "${EPYTHON}" configure.py \
209 + --prefix="${EPREFIX}"/usr \
210 + --dest-cpu=${myarch} \
211 + $(use_with systemtap dtrace) \
212 + "${myconf[@]}" || die
213 +}
214 +
215 +src_compile() {
216 + emake -C out
217 +}
218 +
219 +src_install() {
220 + local LIBDIR="${ED}/usr/$(get_libdir)"
221 + default
222 +
223 + pax-mark -m "${ED}"/usr/bin/node
224 +
225 + # set up a symlink structure that node-gyp expects..
226 + dodir /usr/include/node/deps/{v8,uv}
227 + dosym . /usr/include/node/src
228 + for var in deps/{uv,v8}/include; do
229 + dosym ../.. /usr/include/node/${var}
230 + done
231 +
232 + if use doc; then
233 + docinto html
234 + dodoc -r "${S}"/doc/*
235 + fi
236 +
237 + if use npm; then
238 + keepdir /etc/npm
239 +
240 + # Install bash completion for `npm`
241 + local tmp_npm_completion_file="$(TMPDIR="${T}" mktemp -t npm.XXXXXXXXXX)"
242 + "${ED}/usr/bin/npm" completion > "${tmp_npm_completion_file}"
243 + newbashcomp "${tmp_npm_completion_file}" npm
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 +}