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