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