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 13:01:56
Message-Id: 1627650107.7d058a60145243655731322144708f696d9120f1.marecki@gentoo
1 commit: 7d058a60145243655731322144708f696d9120f1
2 Author: Marek Szuba <marecki <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jul 30 12:56:41 2021 +0000
4 Commit: Marek Szuba <marecki <AT> gentoo <DOT> org>
5 CommitDate: Fri Jul 30 13:01:47 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7d058a60
7
8 net-libs/nodejs: add 12.22.4
9
10 Signed-off-by: Marek Szuba <marecki <AT> gentoo.org>
11
12 net-libs/nodejs/Manifest | 1 +
13 net-libs/nodejs/nodejs-12.22.4.ebuild | 248 ++++++++++++++++++++++++++++++++++
14 2 files changed, 249 insertions(+)
15
16 diff --git a/net-libs/nodejs/Manifest b/net-libs/nodejs/Manifest
17 index c311849b68a..eeb2604ae65 100644
18 --- a/net-libs/nodejs/Manifest
19 +++ b/net-libs/nodejs/Manifest
20 @@ -1,5 +1,6 @@
21 DIST node-v12.22.1.tar.xz 23650180 BLAKE2B 90b0a8ab3842483fea0c776e0245e63539a986c18f55abd8c7cd22ec399ccde22fa5b008d3e07c0f07713b5a45a1ee2a0bc370c04408800db2ee59cd92fcb5be SHA512 eaead633611bda04ab9be200aeddf3b4004b8104e9c6af246023b8008003dd3a7103e1508ea690443e59c6591521b04a2d71c7344343f2a20d1c935ef51c66a0
22 DIST node-v12.22.3.tar.xz 23662268 BLAKE2B b686d96ce1a2e1678c1565dbc6025738be85dc6b0e21b39742265639eb8da590b33f86afa5ca3ecaa4c70e4155a97e413e4d6e5da9ec0c5cb19a876241e599e5 SHA512 11684b6df15b6b74b8674ebf2c2bb950d1e52b83f90478638e85dd11a163dc7c62ae888bc4c1c29e89179e0c47fdccc26bee2817d64eb3ff926b2d3e648c351c
23 +DIST node-v12.22.4.tar.xz 23653388 BLAKE2B dfed2c23f7bbafe20d955dbe382ee8b2b40d17a8f4a9266242b405d5c3cb8654e8727817822d33a06c121cd0f04a027cdd3e4483c70e95f17cb4032ab4429bc5 SHA512 dc833f60474bb5659870573d751cb0e90cef87f94f0111d379a66ba593bf1ac00f624be75839bdcbeb3380c5ca52ef87cd0ffbe8f4e89345b0dec3165b9ce85e
24 DIST node-v14.16.1.tar.xz 33297064 BLAKE2B 0927434c63cd248e90a4002b50c7a0fd68a5527a4cd7424b451840ddf0c403ba452979b195e598cc3b323e24233248a74a1274519ce8cd3a2f4e71dc7a8f3dcb SHA512 d4f5fbab69592ae555613b2186090b85a458d2211b6035989aee2617bfd0f6768ca767ec45ce12756a9c452d00af7237edee3b1ae526049e9fcd01f8f67680c0
25 DIST node-v14.17.3.tar.xz 33585080 BLAKE2B 37267c9da2d773dbbe95f7378f5b0c2b0dc397b17850be325f9fec637c6745dede4ca4136ba4bf109d72d8982ee985f1e077cc706165f1be2e3dc3053edfe229 SHA512 c6096715299f155b96df873976da91e854da7e99cde635cdb65d5c962abc5283dac86b8ddce4f5a9f7498f9793ff08943645b5e5b0b23395dfe035f7295218bb
26 DIST node-v14.17.4.tar.xz 33592020 BLAKE2B ad8a49715b3d568a5dc66b759d9c3074ea78c1c2293b1642549e32d26c5213ccc8fce4a531ef7727e3a74a63ddc26d8b71ac20bf5c86bf0af09467c2306363ef SHA512 c06228f1a82cf887fa1557be58a8814027926f5c9750c9f1a1656afd6f58151be08e05203343c62fb9a3957d99a73bee6fe509e52543fdbc5bd4c05a1e76c3cf
27
28 diff --git a/net-libs/nodejs/nodejs-12.22.4.ebuild b/net-libs/nodejs/nodejs-12.22.4.ebuild
29 new file mode 100644
30 index 00000000000..aa0282ea003
31 --- /dev/null
32 +++ b/net-libs/nodejs/nodejs-12.22.4.ebuild
33 @@ -0,0 +1,248 @@
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_{8..10} )
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 +LICENSE="Apache-1.1 Apache-2.0 BSD BSD-2 MIT"
47 +
48 +if [[ ${PV} == *9999 ]]; then
49 + inherit git-r3
50 + EGIT_REPO_URI="https://github.com/nodejs/node"
51 + SLOT="0"
52 +else
53 + SRC_URI="https://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz"
54 + SLOT="0/$(ver_cut 1)"
55 + KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86 ~amd64-linux ~x64-macos"
56 + S="${WORKDIR}/node-v${PV}"
57 +fi
58 +
59 +IUSE="cpu_flags_x86_sse2 debug doc icu inspector lto +npm +snapshot +ssl +system-ssl systemtap test"
60 +REQUIRED_USE="
61 + inspector? ( icu ssl )
62 + npm? ( ssl )
63 + system-ssl? ( ssl )
64 +"
65 +
66 +RESTRICT="!test? ( test )"
67 +
68 +RDEPEND="
69 + >=app-arch/brotli-1.0.9
70 + >=dev-libs/libuv-1.39.0:=
71 + >=net-dns/c-ares-1.16.0
72 + >=net-libs/http-parser-2.9.3:=
73 + >=net-libs/nghttp2-1.40.0
74 + sys-libs/zlib
75 + icu? ( >=dev-libs/icu-64.2:= )
76 + system-ssl? (
77 + >=dev-libs/openssl-1.1.1:0=
78 + <dev-libs/openssl-3.0.0_beta1:0=
79 + )
80 +"
81 +BDEPEND="
82 + ${PYTHON_DEPS}
83 + sys-apps/coreutils
84 + virtual/pkgconfig
85 + systemtap? ( dev-util/systemtap )
86 + test? ( net-misc/curl )
87 +"
88 +DEPEND="
89 + ${RDEPEND}
90 +"
91 +PATCHES=(
92 + "${FILESDIR}"/${PN}-10.3.0-global-npm-config.patch
93 + "${FILESDIR}"/${PN}-12.20.1-fix_ppc64_crashes.patch
94 + "${FILESDIR}"/${PN}-12.22.1-jinja_collections_abc.patch
95 + "${FILESDIR}"/${PN}-12.22.1-uvwasi_shared_libuv.patch
96 + "${FILESDIR}"/${PN}-99999999-llhttp.patch
97 +)
98 +
99 +pkg_pretend() {
100 + (use x86 && ! use cpu_flags_x86_sse2) && \
101 + die "Your CPU doesn't support the required SSE2 instruction."
102 +
103 + if [[ ${MERGE_TYPE} != "binary" ]]; then
104 + if use lto; then
105 + if tc-is-gcc; then
106 + if [[ $(gcc-major-version) -ge 11 ]]; then
107 + # Bug #787158
108 + 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"
109 + fi
110 + else
111 + # configure.py will abort on this later if we do not
112 + die "${PN} only supports LTO for gcc"
113 + fi
114 + fi
115 + fi
116 +}
117 +
118 +src_prepare() {
119 + tc-export CC CXX PKG_CONFIG
120 + export V=1
121 + export BUILDTYPE=Release
122 +
123 + # fix compilation on Darwin
124 + # https://code.google.com/p/gyp/issues/detail?id=260
125 + sed -i -e "/append('-arch/d" tools/gyp/pylib/gyp/xcode_emulation.py || die
126 +
127 + # less verbose install output (stating the same as portage, basically)
128 + sed -i -e "/print/d" tools/install.py || die
129 +
130 + # proper libdir, hat tip @ryanpcmcquen https://github.com/iojs/io.js/issues/504
131 + local LIBDIR=$(get_libdir)
132 + sed -i -e "s|lib/|${LIBDIR}/|g" tools/install.py || die
133 + sed -i -e "s/'lib'/'${LIBDIR}'/" deps/npm/lib/npm.js || die
134 +
135 + # Avoid writing a depfile, not useful
136 + sed -i -e "/DEPFLAGS =/d" tools/gyp/pylib/gyp/generator/make.py || die
137 +
138 + sed -i -e "/'-O3'/d" common.gypi node.gypi || die
139 +
140 + # Known-to-fail test of a deprecated, legacy HTTP parser. Just don't bother.
141 + rm -f test/parallel/test-http-transfer-encoding-smuggling-legacy.js
142 +
143 + # debug builds. change install path, remove optimisations and override buildtype
144 + if use debug; then
145 + sed -i -e "s|out/Release/|out/Debug/|g" tools/install.py || die
146 + BUILDTYPE=Debug
147 + fi
148 +
149 + default
150 +}
151 +
152 +src_configure() {
153 + xdg_environment_reset
154 +
155 + # LTO compiler flags are handled by configure.py itself
156 + filter-flags '-flto*'
157 +
158 + local myconf=(
159 + --shared-brotli
160 + --shared-cares
161 + --shared-http-parser
162 + --shared-libuv
163 + --shared-nghttp2
164 + --shared-zlib
165 + )
166 + use debug && myconf+=( --debug )
167 + use lto && myconf+=( --enable-lto )
168 + use icu && myconf+=( --with-intl=system-icu ) || myconf+=( --with-intl=none )
169 + use inspector || myconf+=( --without-inspector )
170 + use npm || myconf+=( --without-npm )
171 + use snapshot || myconf+=( --without-node-snapshot )
172 + if use ssl; then
173 + use system-ssl && myconf+=( --shared-openssl --openssl-use-def-ca-store )
174 + else
175 + myconf+=( --without-ssl )
176 + fi
177 +
178 + local myarch=""
179 + case ${ABI} in
180 + amd64) myarch="x64";;
181 + arm) myarch="arm";;
182 + arm64) myarch="arm64";;
183 + ppc64) myarch="ppc64";;
184 + x32) myarch="x32";;
185 + x86) myarch="ia32";;
186 + *) myarch="${ABI}";;
187 + esac
188 +
189 + GYP_DEFINES="linux_use_gold_flags=0
190 + linux_use_bundled_binutils=0
191 + linux_use_bundled_gold=0" \
192 + "${EPYTHON}" configure.py \
193 + --prefix="${EPREFIX}"/usr \
194 + --dest-cpu=${myarch} \
195 + $(use_with systemtap dtrace) \
196 + "${myconf[@]}" || die
197 +}
198 +
199 +src_compile() {
200 + emake -C out mksnapshot
201 + pax-mark m "out/${BUILDTYPE}/mksnapshot"
202 + emake -C out
203 +}
204 +
205 +src_install() {
206 + local LIBDIR="${ED}/usr/$(get_libdir)"
207 + default
208 +
209 + pax-mark -m "${ED}"/usr/bin/node
210 +
211 + # set up a symlink structure that node-gyp expects..
212 + dodir /usr/include/node/deps/{v8,uv}
213 + dosym . /usr/include/node/src
214 + for var in deps/{uv,v8}/include; do
215 + dosym ../.. /usr/include/node/${var}
216 + done
217 +
218 + if use doc; then
219 + docinto html
220 + dodoc -r "${S}"/doc/*
221 + fi
222 +
223 + if use npm; then
224 + dodir /etc/npm
225 +
226 + # Install bash completion for `npm`
227 + # We need to temporarily replace default config path since
228 + # npm otherwise tries to write outside of the sandbox
229 + local npm_config="usr/$(get_libdir)/node_modules/npm/lib/config/core.js"
230 + sed -i -e "s|'/etc'|'${ED}/etc'|g" "${ED}/${npm_config}" || die
231 + local tmp_npm_completion_file="$(TMPDIR="${T}" mktemp -t npm.XXXXXXXXXX)"
232 + "${ED}/usr/bin/npm" completion > "${tmp_npm_completion_file}"
233 + newbashcomp "${tmp_npm_completion_file}" npm
234 + sed -i -e "s|'${ED}/etc'|'/etc'|g" "${ED}/${npm_config}" || die
235 +
236 + # Move man pages
237 + doman "${LIBDIR}"/node_modules/npm/man/man{1,5,7}/*
238 +
239 + # Clean up
240 + rm -f "${LIBDIR}"/node_modules/npm/{.mailmap,.npmignore,Makefile}
241 + rm -rf "${LIBDIR}"/node_modules/npm/{doc,html,man}
242 +
243 + local find_exp="-or -name"
244 + local find_name=()
245 + for match in "AUTHORS*" "CHANGELOG*" "CONTRIBUT*" "README*" \
246 + ".travis.yml" ".eslint*" ".wercker.yml" ".npmignore" \
247 + "*.md" "*.markdown" "*.bat" "*.cmd"; do
248 + find_name+=( ${find_exp} "${match}" )
249 + done
250 +
251 + # Remove various development and/or inappropriate files and
252 + # useless docs of dependend packages.
253 + find "${LIBDIR}"/node_modules \
254 + \( -type d -name examples \) -or \( -type f \( \
255 + -iname "LICEN?E*" \
256 + "${find_name[@]}" \
257 + \) \) -exec rm -rf "{}" \;
258 + fi
259 +
260 + mv "${ED}"/usr/share/doc/node "${ED}"/usr/share/doc/${PF} || die
261 +}
262 +
263 +src_test() {
264 + if has usersandbox ${FEATURES}; then
265 + rm -f "${S}"/test/parallel/test-fs-mkdir.js
266 + ewarn "You are emerging ${PN} with 'usersandbox' enabled. Excluding tests known to fail in this mode." \
267 + "For full test coverage, emerge =${CATEGORY}/${PF} with 'FEATURES=-usersandbox'."
268 + fi
269 +
270 + out/${BUILDTYPE}/cctest || die
271 + "${PYTHON}" tools/test.py --mode=${BUILDTYPE,,} --flaky-tests=dontcare -J message parallel sequential || die
272 +}
273 +
274 +pkg_postinst() {
275 + elog "The global npm config lives in /etc/npm. This deviates slightly"
276 + elog "from upstream which otherwise would have it live in /usr/etc/."
277 + elog ""
278 + elog "Protip: When using node-gyp to install native modules, you can"
279 + elog "avoid having to download extras by doing the following:"
280 + elog "$ node-gyp --nodedir /usr/include/node <command>"
281 +}