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: Tue, 22 Jun 2021 10:22:33
Message-Id: 1624357336.0ff8fc9bd35b476b4044cc2fc489bd760cf95496.marecki@gentoo
1 commit: 0ff8fc9bd35b476b4044cc2fc489bd760cf95496
2 Author: Marek Szuba <marecki <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jun 22 09:21:38 2021 +0000
4 Commit: Marek Szuba <marecki <AT> gentoo <DOT> org>
5 CommitDate: Tue Jun 22 10:22:16 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0ff8fc9b
7
8 net-libs/nodejs: add 14.17.1
9
10 Signed-off-by: Marek Szuba <marecki <AT> gentoo.org>
11
12 net-libs/nodejs/Manifest | 1 +
13 net-libs/nodejs/nodejs-14.17.1.ebuild | 239 ++++++++++++++++++++++++++++++++++
14 2 files changed, 240 insertions(+)
15
16 diff --git a/net-libs/nodejs/Manifest b/net-libs/nodejs/Manifest
17 index ca1d06ede63..17ecdcf2898 100644
18 --- a/net-libs/nodejs/Manifest
19 +++ b/net-libs/nodejs/Manifest
20 @@ -1,4 +1,5 @@
21 DIST node-v12.22.1.tar.xz 23650180 BLAKE2B 90b0a8ab3842483fea0c776e0245e63539a986c18f55abd8c7cd22ec399ccde22fa5b008d3e07c0f07713b5a45a1ee2a0bc370c04408800db2ee59cd92fcb5be SHA512 eaead633611bda04ab9be200aeddf3b4004b8104e9c6af246023b8008003dd3a7103e1508ea690443e59c6591521b04a2d71c7344343f2a20d1c935ef51c66a0
22 DIST node-v14.16.1.tar.xz 33297064 BLAKE2B 0927434c63cd248e90a4002b50c7a0fd68a5527a4cd7424b451840ddf0c403ba452979b195e598cc3b323e24233248a74a1274519ce8cd3a2f4e71dc7a8f3dcb SHA512 d4f5fbab69592ae555613b2186090b85a458d2211b6035989aee2617bfd0f6768ca767ec45ce12756a9c452d00af7237edee3b1ae526049e9fcd01f8f67680c0
23 DIST node-v14.17.0.tar.xz 33484212 BLAKE2B 0ad045b7e0b96f564f42cef703338fece2167cb8bfe32840b765b137e01491a43a9c31ce290a3379ffa834ddfe4e2e1f42f95d4d0014240151b06313e0339383 SHA512 7a7683523904580462077c8bf3ee9640f1b674c7df55655049ca50ca3cfdb2973b13088f2b65e4eccf4df2641cd9c86c9716bcd160a5d5863a969cb1e88de093
24 +DIST node-v14.17.1.tar.xz 33580416 BLAKE2B da5234087945327fc7f3a666a8869426ec5adff3b31b800c59135d9937507bcca7be3c8ca6720c2593b45ec6a9b49c30f71dadbcc03dc0a68c082e3f1746e6df SHA512 354f9f215a4915ca3dbccdbb90c14fb8bfb8b0ed8ece4f95106d7b068affdeab65a79db0beb2c7d6af03dc15567edc5250629deedd38a9de7d581f76716315f8
25 DIST node-v16.3.0.tar.xz 33801084 BLAKE2B aa1f2fc6639ccb995252e483b68e1b425a9ad47cd148f5536fad168e94b0582819df511f797b3a278fd54d45e45f64dc701a997c2f17ad72d94d8b02d590cf81 SHA512 f25243521869ee9d99c2490150f8f9361b1603e497364ec559917d5c76e4a857e6c25c90d54b11e5a9d16fabb85e12b052ea768f3c2977ff18e96d33f60d9eff
26
27 diff --git a/net-libs/nodejs/nodejs-14.17.1.ebuild b/net-libs/nodejs/nodejs-14.17.1.ebuild
28 new file mode 100644
29 index 00000000000..bccefc5543b
30 --- /dev/null
31 +++ b/net-libs/nodejs/nodejs-14.17.1.ebuild
32 @@ -0,0 +1,239 @@
33 +# Copyright 1999-2021 Gentoo Authors
34 +# Distributed under the terms of the GNU General Public License v2
35 +
36 +EAPI=7
37 +
38 +PYTHON_COMPAT=( python3_{7..10} )
39 +PYTHON_REQ_USE="threads(+)"
40 +
41 +inherit bash-completion-r1 flag-o-matic 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 ~ppc64 ~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.16.1
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 +BDEPEND="${PYTHON_DEPS}
74 + sys-apps/coreutils
75 + virtual/pkgconfig
76 + systemtap? ( dev-util/systemtap )
77 + test? ( net-misc/curl )
78 + pax_kernel? ( sys-apps/elfix )"
79 +DEPEND="${RDEPEND}"
80 +
81 +PATCHES=(
82 + "${FILESDIR}"/${PN}-10.3.0-global-npm-config.patch
83 + "${FILESDIR}"/${PN}-12.22.1-jinja_collections_abc.patch
84 + "${FILESDIR}"/${PN}-12.22.1-uvwasi_shared_libuv.patch
85 + "${FILESDIR}"/${PN}-14.15.0-fix_ppc64_crashes.patch
86 +)
87 +
88 +pkg_pretend() {
89 + (use x86 && ! use cpu_flags_x86_sse2) && \
90 + die "Your CPU doesn't support the required SSE2 instruction."
91 +
92 + if [[ ${MERGE_TYPE} != "binary" ]]; then
93 + if use lto; then
94 + if tc-is-gcc; then
95 + if [[ $(gcc-major-version) -ge 11 ]]; then
96 + # Bug #787158
97 + 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"
98 + fi
99 + else
100 + # configure.py will abort on this later if we do not
101 + die "${PN} only supports LTO for gcc"
102 + fi
103 + fi
104 + fi
105 +}
106 +
107 +src_prepare() {
108 + tc-export AR CC CXX PKG_CONFIG
109 + export V=1
110 + export BUILDTYPE=Release
111 +
112 + # fix compilation on Darwin
113 + # https://code.google.com/p/gyp/issues/detail?id=260
114 + sed -i -e "/append('-arch/d" tools/gyp/pylib/gyp/xcode_emulation.py || die
115 +
116 + # less verbose install output (stating the same as portage, basically)
117 + sed -i -e "/print/d" tools/install.py || die
118 +
119 + # proper libdir, hat tip @ryanpcmcquen https://github.com/iojs/io.js/issues/504
120 + local LIBDIR=$(get_libdir)
121 + sed -i -e "s|lib/|${LIBDIR}/|g" tools/install.py || die
122 + sed -i -e "s/'lib'/'${LIBDIR}'/" deps/npm/lib/npm.js || die
123 +
124 + # Avoid writing a depfile, not useful
125 + sed -i -e "/DEPFLAGS =/d" tools/gyp/pylib/gyp/generator/make.py || die
126 +
127 + sed -i -e "/'-O3'/d" common.gypi node.gypi || die
128 +
129 + # debug builds. change install path, remove optimisations and override buildtype
130 + if use debug; then
131 + sed -i -e "s|out/Release/|out/Debug/|g" tools/install.py || die
132 + BUILDTYPE=Debug
133 + fi
134 +
135 + # We need to disable mprotect on two files when it builds Bug 694100.
136 + use pax_kernel && PATCHES+=( "${FILESDIR}"/${PN}-13.8.0-paxmarking.patch )
137 +
138 + # All this test does is check if the npm CLI produces warnings of any sort,
139 + # failing if it does. Overkill, much? Especially given one possible warning
140 + # is that there is a newer version of npm available upstream (yes, it does
141 + # use the network if available), thus making it a real possibility for this
142 + # test to begin failing one day even though it was fine before.
143 + rm -f test/parallel/test-release-npm.js
144 +
145 + default
146 +}
147 +
148 +src_configure() {
149 + xdg_environment_reset
150 +
151 + # LTO compiler flags are handled by configure.py itself
152 + filter-flags '-flto*'
153 +
154 + local myconf=(
155 + --shared-brotli
156 + --shared-cares
157 + --shared-libuv
158 + --shared-nghttp2
159 + --shared-zlib
160 + )
161 + use debug && myconf+=( --debug )
162 + use lto && myconf+=( --enable-lto )
163 + if use system-icu; then
164 + myconf+=( --with-intl=system-icu )
165 + elif use icu; then
166 + myconf+=( --with-intl=full-icu )
167 + else
168 + myconf+=( --with-intl=none )
169 + fi
170 + use inspector || myconf+=( --without-inspector )
171 + use npm || myconf+=( --without-npm )
172 + use snapshot || myconf+=( --without-node-snapshot )
173 + if use ssl; then
174 + use system-ssl && myconf+=( --shared-openssl --openssl-use-def-ca-store )
175 + else
176 + myconf+=( --without-ssl )
177 + fi
178 +
179 + local myarch=""
180 + case ${ABI} in
181 + amd64) myarch="x64";;
182 + arm) myarch="arm";;
183 + arm64) myarch="arm64";;
184 + ppc64) myarch="ppc64";;
185 + x32) myarch="x32";;
186 + x86) myarch="ia32";;
187 + *) myarch="${ABI}";;
188 + esac
189 +
190 + GYP_DEFINES="linux_use_gold_flags=0
191 + linux_use_bundled_binutils=0
192 + linux_use_bundled_gold=0" \
193 + "${EPYTHON}" configure.py \
194 + --prefix="${EPREFIX}"/usr \
195 + --dest-cpu=${myarch} \
196 + $(use_with systemtap dtrace) \
197 + "${myconf[@]}" || die
198 +}
199 +
200 +src_compile() {
201 + emake -C out
202 +}
203 +
204 +src_install() {
205 + local LIBDIR="${ED}/usr/$(get_libdir)"
206 + default
207 +
208 + pax-mark -m "${ED}"/usr/bin/node
209 +
210 + # set up a symlink structure that node-gyp expects..
211 + dodir /usr/include/node/deps/{v8,uv}
212 + dosym . /usr/include/node/src
213 + for var in deps/{uv,v8}/include; do
214 + dosym ../.. /usr/include/node/${var}
215 + done
216 +
217 + if use doc; then
218 + docinto html
219 + dodoc -r "${S}"/doc/*
220 + fi
221 +
222 + if use npm; then
223 + dodir /etc/npm
224 +
225 + # Install bash completion for `npm`
226 + # We need to temporarily replace default config path since
227 + # npm otherwise tries to write outside of the sandbox
228 + local npm_config="usr/$(get_libdir)/node_modules/npm/lib/config/core.js"
229 + sed -i -e "s|'/etc'|'${ED}/etc'|g" "${ED}/${npm_config}" || die
230 + local tmp_npm_completion_file="$(TMPDIR="${T}" mktemp -t npm.XXXXXXXXXX)"
231 + "${ED}/usr/bin/npm" completion > "${tmp_npm_completion_file}"
232 + newbashcomp "${tmp_npm_completion_file}" npm
233 + sed -i -e "s|'${ED}/etc'|'/etc'|g" "${ED}/${npm_config}" || die
234 +
235 + # Move man pages
236 + doman "${LIBDIR}"/node_modules/npm/man/man{1,5,7}/*
237 +
238 + # Clean up
239 + rm -f "${LIBDIR}"/node_modules/npm/{.mailmap,.npmignore,Makefile}
240 + rm -rf "${LIBDIR}"/node_modules/npm/{doc,html,man}
241 +
242 + local find_exp="-or -name"
243 + local find_name=()
244 + for match in "AUTHORS*" "CHANGELOG*" "CONTRIBUT*" "README*" \
245 + ".travis.yml" ".eslint*" ".wercker.yml" ".npmignore" \
246 + "*.md" "*.markdown" "*.bat" "*.cmd"; do
247 + find_name+=( ${find_exp} "${match}" )
248 + done
249 +
250 + # Remove various development and/or inappropriate files and
251 + # useless docs of dependend packages.
252 + find "${LIBDIR}"/node_modules \
253 + \( -type d -name examples \) -or \( -type f \( \
254 + -iname "LICEN?E*" \
255 + "${find_name[@]}" \
256 + \) \) -exec rm -rf "{}" \;
257 + fi
258 +
259 + mv "${ED}"/usr/share/doc/node "${ED}"/usr/share/doc/${PF} || die
260 +}
261 +
262 +src_test() {
263 + # parallel/test-fs-mkdir is known to fail with FEATURES=usersandbox
264 + if has usersandbox ${FEATURES}; then
265 + ewarn "You are emerging ${P} with 'usersandbox' enabled." \
266 + "Expect some test failures or emerge with 'FEATURES=-usersandbox'!"
267 + fi
268 +
269 + out/${BUILDTYPE}/cctest || die
270 + "${EPYTHON}" tools/test.py --mode=${BUILDTYPE,,} --flaky-tests=dontcare -J message parallel sequential || die
271 +}