Gentoo Archives: gentoo-commits

From: William Hubbs <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-libs/nodejs/
Date: Tue, 26 Apr 2022 14:56:58
Message-Id: 1650985004.1b4fed3aa867d14227aea0c48e4c03f938ca4f11.williamh@gentoo
1 commit: 1b4fed3aa867d14227aea0c48e4c03f938ca4f11
2 Author: William Hubbs <williamh <AT> gentoo <DOT> org>
3 AuthorDate: Tue Apr 26 14:56:14 2022 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Tue Apr 26 14:56:44 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1b4fed3a
7
8 net-libs/nodejs: add 16.14.2
9
10 Closes: https://bugs.gentoo.org/837701
11 Signed-off-by: William Hubbs <williamh <AT> gentoo.org>
12
13 net-libs/nodejs/Manifest | 1 +
14 net-libs/nodejs/nodejs-16.14.2.ebuild | 230 ++++++++++++++++++++++++++++++++++
15 2 files changed, 231 insertions(+)
16
17 diff --git a/net-libs/nodejs/Manifest b/net-libs/nodejs/Manifest
18 index 151d18eeb253..7cddccb60217 100644
19 --- a/net-libs/nodejs/Manifest
20 +++ b/net-libs/nodejs/Manifest
21 @@ -11,5 +11,6 @@ DIST node-v16.10.0.tar.xz 34046720 BLAKE2B e745443a4707eca97ebfc0d3cb8e697f64cd3
22 DIST node-v16.13.0.tar.xz 33502788 BLAKE2B d30a63e77ef3b423bfa3a43299f7f6576ee5b0544757d1dbf233cbbc4bc9c70971927283ca87497add5ed05c9bf5d5501b36992cd242468fcd12e7f950ee29c2 SHA512 5d840fa49e8e637398f20b166b590a57e1070fd04c62bcb9b2d56646cf5a97719a70dbd9e0e29a548a268ac84c9a6c63c02ed6d38536ed45d82ffb96896a61c0
23 DIST node-v16.13.1.tar.xz 33907544 BLAKE2B 9243145f53619cb8285dc686d30317b71f474e67853eb16266b4bf4f2af2f81ad1d78d39ffa70024c4a99612230f07605fce69674a5b12013291e7746252dbc4 SHA512 bb0739089965785dff59721303ac68605a459d40318e1eada071c720e1499569cefb61a59a378062794d8533b8d54b8d5fef0e380f7e159206a89b0bb0b9cebf
24 DIST node-v16.14.1.tar.xz 34329468 BLAKE2B 9b20af7d37c0116b17d3b2cedf8a16c208bbc501d8a4bb0958954a608fb9eeb61a77aec721de0b6be63674091184da471ab4e8ee62d6b8a55a51ee72513f8461 SHA512 56443c06e86547ac05800c2b3b4af7139190b0798a0e53ee0b0cbccf1ac3157f8549feb8766a956d8942daa1bb3eb55d2b524f47fb3fd0dc445399ecc47e6f38
25 +DIST node-v16.14.2.tar.xz 34332624 BLAKE2B 756895f81ecabbacf30b1e513890d100192c367443a5d041cd3e383985acb6fae189213f44b7a533b43d1b759d5a2677a5ee787c72d3abdb480879d6d24cc95e SHA512 b97274f6e0d63f19e01497c43af36e6561f019e7b0b5b4f6ea19d0fbe2cb4d3c514c06f49e237d1e327936db03c3f437ae0d0b2f830a35f1b7c3a723fbe2a1be
26 DIST node-v16.9.1.tar.xz 34026992 BLAKE2B 8bb0d75ab91a00d5b03a31ded17a6b8845894630185d353ded616bf8435b672ea5cef06b4ca5bd01bb3536c5c50774f6ad0aa08a0fa8cbb00d8866e29561c2ab SHA512 e570c39fffa5d79c8d3fa1fe90ece53b22729af6e882416a35b54362be7169eeb3d37cf8be69ee1b748a981b1fbc725d8c85a739bc5cb0b22d6d2e313ab646ac
27 DIST node-v18.0.0.tar.xz 36826840 BLAKE2B 658b6a4872779c648b1c10b952403892a4ea846525737daba222aeb7d1467f797345c2e07bfb28320d593810617541b893dd37006dcbd13e5e69313455045ff0 SHA512 801ee56e22490453f259ab92bfcd1b13da3f9510fb70078da1e680d0a27971d4ee4b4b4344b2a969d230e661fd9a8b35e9104c5fe0a594222be3a20583a59f3e
28
29 diff --git a/net-libs/nodejs/nodejs-16.14.2.ebuild b/net-libs/nodejs/nodejs-16.14.2.ebuild
30 new file mode 100644
31 index 000000000000..a77369330d31
32 --- /dev/null
33 +++ b/net-libs/nodejs/nodejs-16.14.2.ebuild
34 @@ -0,0 +1,230 @@
35 +# Copyright 1999-2022 Gentoo Authors
36 +# Distributed under the terms of the GNU General Public License v2
37 +
38 +EAPI=8
39 +
40 +PYTHON_COMPAT=( python3_{8..10} )
41 +PYTHON_REQ_USE="threads(+)"
42 +
43 +inherit bash-completion-r1 flag-o-matic pax-utils python-any-r1 toolchain-funcs xdg-utils
44 +
45 +DESCRIPTION="A JavaScript runtime built on Chrome's V8 JavaScript engine"
46 +HOMEPAGE="https://nodejs.org/"
47 +LICENSE="Apache-1.1 Apache-2.0 BSD BSD-2 MIT"
48 +
49 +if [[ ${PV} == *9999 ]]; then
50 + inherit git-r3
51 + EGIT_REPO_URI="https://github.com/nodejs/node"
52 + SLOT="0"
53 +else
54 + SRC_URI="https://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz"
55 + SLOT="0/$(ver_cut 1)"
56 + KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86 ~amd64-linux ~x64-macos"
57 + S="${WORKDIR}/node-v${PV}"
58 +fi
59 +
60 +IUSE="cpu_flags_x86_sse2 debug doc +icu inspector lto +npm pax-kernel +snapshot +ssl +system-icu +system-ssl systemtap test"
61 +REQUIRED_USE="inspector? ( icu ssl )
62 + npm? ( ssl )
63 + system-icu? ( icu )
64 + system-ssl? ( ssl )"
65 +
66 +RESTRICT="!test? ( test )"
67 +
68 +RDEPEND=">=app-arch/brotli-1.0.9:=
69 + >=dev-libs/libuv-1.40.0:=
70 + >=net-dns/c-ares-1.17.2:=
71 + >=net-libs/nghttp2-1.41.0:=
72 + sys-libs/zlib
73 + system-icu? ( >=dev-libs/icu-67:= )
74 + system-ssl? ( >=dev-libs/openssl-1.1.1:0= )"
75 +BDEPEND="${PYTHON_DEPS}
76 + sys-apps/coreutils
77 + virtual/pkgconfig
78 + systemtap? ( dev-util/systemtap )
79 + test? ( net-misc/curl )
80 + pax-kernel? ( sys-apps/elfix )"
81 +DEPEND="${RDEPEND}"
82 +
83 +PATCHES=(
84 + "${FILESDIR}"/${PN}-12.22.5-shared_c-ares_nameser_h.patch
85 + "${FILESDIR}"/${PN}-15.2.0-global-npm-config.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 + fi
100 + fi
101 + fi
102 +}
103 +
104 +src_prepare() {
105 + tc-export AR CC CXX PKG_CONFIG
106 + export V=1
107 + export BUILDTYPE=Release
108 +
109 + # fix compilation on Darwin
110 + # https://code.google.com/p/gyp/issues/detail?id=260
111 + sed -i -e "/append('-arch/d" tools/gyp/pylib/gyp/xcode_emulation.py || die
112 +
113 + # less verbose install output (stating the same as portage, basically)
114 + sed -i -e "/print/d" tools/install.py || die
115 +
116 + # proper libdir, hat tip @ryanpcmcquen https://github.com/iojs/io.js/issues/504
117 + local LIBDIR=$(get_libdir)
118 + sed -i -e "s|lib/|${LIBDIR}/|g" tools/install.py || die
119 + sed -i -e "s/'lib'/'${LIBDIR}'/" deps/npm/lib/npm.js || die
120 +
121 + # Avoid writing a depfile, not useful
122 + sed -i -e "/DEPFLAGS =/d" tools/gyp/pylib/gyp/generator/make.py || die
123 +
124 + sed -i -e "/'-O3'/d" common.gypi node.gypi || die
125 +
126 + # debug builds. change install path, remove optimisations and override buildtype
127 + if use debug; then
128 + sed -i -e "s|out/Release/|out/Debug/|g" tools/install.py || die
129 + BUILDTYPE=Debug
130 + fi
131 +
132 + # We need to disable mprotect on two files when it builds Bug 694100.
133 + use pax-kernel && PATCHES+=( "${FILESDIR}"/${PN}-13.8.0-paxmarking.patch )
134 +
135 + # All this test does is check if the npm CLI produces warnings of any sort,
136 + # failing if it does. Overkill, much? Especially given one possible warning
137 + # is that there is a newer version of npm available upstream (yes, it does
138 + # use the network if available), thus making it a real possibility for this
139 + # test to begin failing one day even though it was fine before.
140 + rm -f test/parallel/test-release-npm.js
141 +
142 + default
143 +}
144 +
145 +src_configure() {
146 + xdg_environment_reset
147 +
148 + # LTO compiler flags are handled by configure.py itself
149 + filter-flags '-flto*'
150 +
151 + local myconf=(
152 + --shared-brotli
153 + --shared-cares
154 + --shared-libuv
155 + --shared-nghttp2
156 + --shared-zlib
157 + )
158 + use debug && myconf+=( --debug )
159 + use lto && myconf+=( --enable-lto )
160 + if use system-icu; then
161 + myconf+=( --with-intl=system-icu )
162 + elif use icu; then
163 + myconf+=( --with-intl=full-icu )
164 + else
165 + myconf+=( --with-intl=none )
166 + fi
167 + use inspector || myconf+=( --without-inspector )
168 + use npm || myconf+=( --without-npm )
169 + use snapshot || myconf+=( --without-node-snapshot )
170 + if use ssl; then
171 + use system-ssl && myconf+=( --shared-openssl --openssl-use-def-ca-store )
172 + else
173 + myconf+=( --without-ssl )
174 + fi
175 +
176 + local myarch=""
177 + case ${ABI} in
178 + amd64) myarch="x64";;
179 + arm) myarch="arm";;
180 + arm64) myarch="arm64";;
181 + lp64*) myarch="riscv64";;
182 + ppc64) myarch="ppc64";;
183 + x32) myarch="x32";;
184 + x86) myarch="ia32";;
185 + *) myarch="${ABI}";;
186 + esac
187 +
188 + GYP_DEFINES="linux_use_gold_flags=0
189 + linux_use_bundled_binutils=0
190 + linux_use_bundled_gold=0" \
191 + "${EPYTHON}" configure.py \
192 + --prefix="${EPREFIX}"/usr \
193 + --dest-cpu=${myarch} \
194 + $(use_with systemtap dtrace) \
195 + "${myconf[@]}" || die
196 +}
197 +
198 +src_compile() {
199 + emake -C out
200 +}
201 +
202 +src_install() {
203 + local LIBDIR="${ED}/usr/$(get_libdir)"
204 + default
205 +
206 + pax-mark -m "${ED}"/usr/bin/node
207 +
208 + # set up a symlink structure that node-gyp expects..
209 + dodir /usr/include/node/deps/{v8,uv}
210 + dosym . /usr/include/node/src
211 + for var in deps/{uv,v8}/include; do
212 + dosym ../.. /usr/include/node/${var}
213 + done
214 +
215 + if use doc; then
216 + docinto html
217 + dodoc -r "${S}"/doc/*
218 + fi
219 +
220 + if use npm; then
221 + keepdir /etc/npm
222 +
223 + # Install bash completion for `npm`
224 + local tmp_npm_completion_file="$(TMPDIR="${T}" mktemp -t npm.XXXXXXXXXX)"
225 + "${ED}/usr/bin/npm" completion > "${tmp_npm_completion_file}"
226 + newbashcomp "${tmp_npm_completion_file}" npm
227 +
228 + # Move man pages
229 + doman "${LIBDIR}"/node_modules/npm/man/man{1,5,7}/*
230 +
231 + # Clean up
232 + rm -f "${LIBDIR}"/node_modules/npm/{.mailmap,.npmignore,Makefile}
233 + rm -rf "${LIBDIR}"/node_modules/npm/{doc,html,man}
234 +
235 + local find_exp="-or -name"
236 + local find_name=()
237 + for match in "AUTHORS*" "CHANGELOG*" "CONTRIBUT*" "README*" \
238 + ".travis.yml" ".eslint*" ".wercker.yml" ".npmignore" \
239 + "*.md" "*.markdown" "*.bat" "*.cmd"; do
240 + find_name+=( ${find_exp} "${match}" )
241 + done
242 +
243 + # Remove various development and/or inappropriate files and
244 + # useless docs of dependend packages.
245 + find "${LIBDIR}"/node_modules \
246 + \( -type d -name examples \) -or \( -type f \( \
247 + -iname "LICEN?E*" \
248 + "${find_name[@]}" \
249 + \) \) -exec rm -rf "{}" \;
250 + fi
251 +
252 + mv "${ED}"/usr/share/doc/node "${ED}"/usr/share/doc/${PF} || die
253 +}
254 +
255 +src_test() {
256 + if has usersandbox ${FEATURES}; then
257 + rm -f "${S}"/test/parallel/test-fs-mkdir.js
258 + ewarn "You are emerging ${PN} with 'usersandbox' enabled. Excluding tests known to fail in this mode." \
259 + "For full test coverage, emerge =${CATEGORY}/${PF} with 'FEATURES=-usersandbox'."
260 + fi
261 +
262 + out/${BUILDTYPE}/cctest || die
263 + "${EPYTHON}" tools/test.py --mode=${BUILDTYPE,,} --flaky-tests=dontcare -J message parallel sequential || die
264 +}