Gentoo Archives: gentoo-commits

From: Marek Szuba <marecki@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-libs/nodejs/
Date: Wed, 05 May 2021 14:27:26
Message-Id: 1620224832.ec9febe9594c231ef2b02eb4ced72a00612e8583.marecki@gentoo
1 commit: ec9febe9594c231ef2b02eb4ced72a00612e8583
2 Author: Marek Szuba <marecki <AT> gentoo <DOT> org>
3 AuthorDate: Wed May 5 14:22:25 2021 +0000
4 Commit: Marek Szuba <marecki <AT> gentoo <DOT> org>
5 CommitDate: Wed May 5 14:27:12 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ec9febe9
7
8 net-libs/nodejs: add 16.1.0
9
10 Now with the test phase enabled!
11
12 Signed-off-by: Marek Szuba <marecki <AT> gentoo.org>
13
14 net-libs/nodejs/Manifest | 1 +
15 net-libs/nodejs/nodejs-16.1.0.ebuild | 224 +++++++++++++++++++++++++++++++++++
16 2 files changed, 225 insertions(+)
17
18 diff --git a/net-libs/nodejs/Manifest b/net-libs/nodejs/Manifest
19 index fef3a8ebafa..c0656482fd6 100644
20 --- a/net-libs/nodejs/Manifest
21 +++ b/net-libs/nodejs/Manifest
22 @@ -1,3 +1,4 @@
23 DIST node-v12.22.1.tar.xz 23650180 BLAKE2B 90b0a8ab3842483fea0c776e0245e63539a986c18f55abd8c7cd22ec399ccde22fa5b008d3e07c0f07713b5a45a1ee2a0bc370c04408800db2ee59cd92fcb5be SHA512 eaead633611bda04ab9be200aeddf3b4004b8104e9c6af246023b8008003dd3a7103e1508ea690443e59c6591521b04a2d71c7344343f2a20d1c935ef51c66a0
24 DIST node-v14.16.1.tar.xz 33297064 BLAKE2B 0927434c63cd248e90a4002b50c7a0fd68a5527a4cd7424b451840ddf0c403ba452979b195e598cc3b323e24233248a74a1274519ce8cd3a2f4e71dc7a8f3dcb SHA512 d4f5fbab69592ae555613b2186090b85a458d2211b6035989aee2617bfd0f6768ca767ec45ce12756a9c452d00af7237edee3b1ae526049e9fcd01f8f67680c0
25 DIST node-v16.0.0.tar.xz 33784448 BLAKE2B 3286cf6522074cb7b17dce8fce642204777fef26fd4bdb904fdef638061913a1eccda13b8e2f170906dd9098500c8fae7eaea7275e41bf97ea6d9fdd644b215c SHA512 6b976a8959079751bfdece15614a6286088d9145fc4db4ae048aca2ede4b7e38e86e91b1722be51eb4c934749a144a745e425ccf118bed9848c30ff254de2557
26 +DIST node-v16.1.0.tar.xz 33770472 BLAKE2B 2b7cf5f07dbf72eb25018cd046ce15cf6c5a444225e34d425614c19e69888b4f5c9488b079fed12e6fe52cb8dfdee20cf61c4df5a39f53e60b95c4da445f2091 SHA512 dc12078203940e7b280198ae15f51f68aaefcf8cab71a9f988952e67045e4b16dc48ec471abcc497bd15b0b426c06678e376b53762349d6568b48d52888cc2d5
27
28 diff --git a/net-libs/nodejs/nodejs-16.1.0.ebuild b/net-libs/nodejs/nodejs-16.1.0.ebuild
29 new file mode 100644
30 index 00000000000..61ddcf50edb
31 --- /dev/null
32 +++ b/net-libs/nodejs/nodejs-16.1.0.ebuild
33 @@ -0,0 +1,224 @@
34 +# Copyright 1999-2021 Gentoo Authors
35 +# Distributed under the terms of the GNU General Public License v2
36 +
37 +EAPI=7
38 +
39 +PYTHON_COMPAT=( python3_{7..9} )
40 +PYTHON_REQ_USE="threads(+)"
41 +
42 +inherit bash-completion-r1 flag-o-matic pax-utils python-any-r1 toolchain-funcs xdg-utils
43 +
44 +DESCRIPTION="A JavaScript runtime built on Chrome's V8 JavaScript engine"
45 +HOMEPAGE="https://nodejs.org/"
46 +SRC_URI="https://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz"
47 +
48 +LICENSE="Apache-1.1 Apache-2.0 BSD BSD-2 MIT"
49 +SLOT="0/$(ver_cut 1)"
50 +KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86 ~amd64-linux ~x64-macos"
51 +
52 +IUSE="cpu_flags_x86_sse2 debug doc +icu inspector lto +npm pax_kernel +snapshot +ssl system-icu +system-ssl systemtap test"
53 +REQUIRED_USE="inspector? ( icu ssl )
54 + npm? ( ssl )
55 + system-icu? ( icu )
56 + system-ssl? ( ssl )"
57 +
58 +RESTRICT="!test? ( test )"
59 +
60 +RDEPEND=">=app-arch/brotli-1.0.9
61 + >=dev-libs/libuv-1.40.0:=
62 + >=net-dns/c-ares-1.17.0
63 + >=net-libs/nghttp2-1.41.0
64 + sys-libs/zlib
65 + system-icu? ( >=dev-libs/icu-67:= )
66 + system-ssl? ( >=dev-libs/openssl-1.1.1:0= )"
67 +BDEPEND="${PYTHON_DEPS}
68 + sys-apps/coreutils
69 + virtual/pkgconfig
70 + systemtap? ( dev-util/systemtap )
71 + test? ( net-misc/curl )
72 + pax_kernel? ( sys-apps/elfix )"
73 +DEPEND="${RDEPEND}"
74 +
75 +PATCHES=(
76 + "${FILESDIR}"/${PN}-12.22.1-uvwasi_shared_libuv.patch
77 + "${FILESDIR}"/${PN}-15.2.0-global-npm-config.patch
78 +)
79 +
80 +S="${WORKDIR}/node-v${PV}"
81 +
82 +pkg_pretend() {
83 + (use x86 && ! use cpu_flags_x86_sse2) && \
84 + die "Your CPU doesn't support the required SSE2 instruction."
85 +
86 + if [[ ${MERGE_TYPE} != "binary" ]]; then
87 + if use lto; then
88 + if tc-is-gcc; then
89 + if [[ $(gcc-major-version) -ge 11 ]]; then
90 + # Bug #787158
91 + die "LTO builds of ${PN} using gcc-11+ currently fail tests and produce runtime errors. Either switch to gcc-10 or unset USE=lto for this ebuild"
92 + fi
93 + else
94 + # configure.py will abort on this later if we do not
95 + die "${PN} only supports LTO for gcc"
96 + fi
97 + fi
98 + fi
99 +}
100 +
101 +src_prepare() {
102 + tc-export AR CC CXX PKG_CONFIG
103 + export V=1
104 + export BUILDTYPE=Release
105 +
106 + # See https://github.com/nodejs/node/issues/38558
107 + # FIXME: temporary, until we have figured out why that one single test fails.
108 + rm -f test/parallel/test-repl-history-navigation.js
109 +
110 + # fix compilation on Darwin
111 + # https://code.google.com/p/gyp/issues/detail?id=260
112 + sed -i -e "/append('-arch/d" tools/gyp/pylib/gyp/xcode_emulation.py || die
113 +
114 + # less verbose install output (stating the same as portage, basically)
115 + sed -i -e "/print/d" tools/install.py || die
116 +
117 + # proper libdir, hat tip @ryanpcmcquen https://github.com/iojs/io.js/issues/504
118 + local LIBDIR=$(get_libdir)
119 + sed -i -e "s|lib/|${LIBDIR}/|g" tools/install.py || die
120 + sed -i -e "s/'lib'/'${LIBDIR}'/" deps/npm/lib/npm.js || die
121 +
122 + # Avoid writing a depfile, not useful
123 + sed -i -e "/DEPFLAGS =/d" tools/gyp/pylib/gyp/generator/make.py || die
124 +
125 + sed -i -e "/'-O3'/d" common.gypi node.gypi || die
126 +
127 + # debug builds. change install path, remove optimisations and override buildtype
128 + if use debug; then
129 + sed -i -e "s|out/Release/|out/Debug/|g" tools/install.py || die
130 + BUILDTYPE=Debug
131 + fi
132 +
133 + # We need to disable mprotect on two files when it builds Bug 694100.
134 + use pax_kernel && PATCHES+=( "${FILESDIR}"/${PN}-13.8.0-paxmarking.patch )
135 +
136 + default
137 +}
138 +
139 +src_configure() {
140 + xdg_environment_reset
141 +
142 + # LTO compiler flags are handled by configure.py itself
143 + filter-flags '-flto*'
144 +
145 + local myconf=(
146 + --shared-brotli
147 + --shared-cares
148 + --shared-libuv
149 + --shared-nghttp2
150 + --shared-zlib
151 + )
152 + use debug && myconf+=( --debug )
153 + use lto && myconf+=( --enable-lto )
154 + if use system-icu; then
155 + myconf+=( --with-intl=system-icu )
156 + elif use icu; then
157 + myconf+=( --with-intl=full-icu )
158 + else
159 + myconf+=( --with-intl=none )
160 + fi
161 + use inspector || myconf+=( --without-inspector )
162 + use npm || myconf+=( --without-npm )
163 + use snapshot || myconf+=( --without-node-snapshot )
164 + if use ssl; then
165 + use system-ssl && myconf+=( --shared-openssl --openssl-use-def-ca-store )
166 + else
167 + myconf+=( --without-ssl )
168 + fi
169 +
170 + local myarch=""
171 + case ${ABI} in
172 + amd64) myarch="x64";;
173 + arm) myarch="arm";;
174 + arm64) myarch="arm64";;
175 + ppc64) myarch="ppc64";;
176 + x32) myarch="x32";;
177 + x86) myarch="ia32";;
178 + *) myarch="${ABI}";;
179 + esac
180 +
181 + GYP_DEFINES="linux_use_gold_flags=0
182 + linux_use_bundled_binutils=0
183 + linux_use_bundled_gold=0" \
184 + "${EPYTHON}" configure.py \
185 + --prefix="${EPREFIX}"/usr \
186 + --dest-cpu=${myarch} \
187 + $(use_with systemtap dtrace) \
188 + "${myconf[@]}" || die
189 +}
190 +
191 +src_compile() {
192 + emake -C out
193 +}
194 +
195 +src_install() {
196 + local LIBDIR="${ED}/usr/$(get_libdir)"
197 + default
198 +
199 + pax-mark -m "${ED}"/usr/bin/node
200 +
201 + # set up a symlink structure that node-gyp expects..
202 + dodir /usr/include/node/deps/{v8,uv}
203 + dosym . /usr/include/node/src
204 + for var in deps/{uv,v8}/include; do
205 + dosym ../.. /usr/include/node/${var}
206 + done
207 +
208 + if use doc; then
209 + docinto html
210 + dodoc -r "${S}"/doc/*
211 + fi
212 +
213 + if use npm; then
214 + keepdir /etc/npm
215 +
216 + # Install bash completion for `npm`
217 + local tmp_npm_completion_file="$(TMPDIR="${T}" mktemp -t npm.XXXXXXXXXX)"
218 + "${ED}/usr/bin/npm" completion > "${tmp_npm_completion_file}"
219 + newbashcomp "${tmp_npm_completion_file}" npm
220 +
221 + # Move man pages
222 + doman "${LIBDIR}"/node_modules/npm/man/man{1,5,7}/*
223 +
224 + # Clean up
225 + rm -f "${LIBDIR}"/node_modules/npm/{.mailmap,.npmignore,Makefile}
226 + rm -rf "${LIBDIR}"/node_modules/npm/{doc,html,man}
227 +
228 + local find_exp="-or -name"
229 + local find_name=()
230 + for match in "AUTHORS*" "CHANGELOG*" "CONTRIBUT*" "README*" \
231 + ".travis.yml" ".eslint*" ".wercker.yml" ".npmignore" \
232 + "*.md" "*.markdown" "*.bat" "*.cmd"; do
233 + find_name+=( ${find_exp} "${match}" )
234 + done
235 +
236 + # Remove various development and/or inappropriate files and
237 + # useless docs of dependend packages.
238 + find "${LIBDIR}"/node_modules \
239 + \( -type d -name examples \) -or \( -type f \( \
240 + -iname "LICEN?E*" \
241 + "${find_name[@]}" \
242 + \) \) -exec rm -rf "{}" \;
243 + fi
244 +
245 + mv "${ED}"/usr/share/doc/node "${ED}"/usr/share/doc/${PF} || die
246 +}
247 +
248 +src_test() {
249 + # parallel/test-fs-mkdir is known to fail with FEATURES=usersandbox
250 + if has usersandbox ${FEATURES}; then
251 + ewarn "You are emerging ${P} with 'usersandbox' enabled." \
252 + "Expect some test failures or emerge with 'FEATURES=-usersandbox'!"
253 + fi
254 +
255 + out/${BUILDTYPE}/cctest || die
256 + "${EPYTHON}" tools/test.py --mode=${BUILDTYPE,,} --flaky-tests=dontcare -J message parallel sequential || die
257 +}