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: Thu, 18 Aug 2022 16:24:17
Message-Id: 1660839847.e2d494d079a1fe48fa2624fb5782343f2f2eecb4.williamh@gentoo
1 commit: e2d494d079a1fe48fa2624fb5782343f2f2eecb4
2 Author: William Hubbs <williamh <AT> gentoo <DOT> org>
3 AuthorDate: Thu Aug 18 16:22:28 2022 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Thu Aug 18 16:24:07 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e2d494d0
7
8 net-libs/nodejs: add 16.17.0
9
10 Bug: https://bugs.gentoo.org/865627
11 Signed-off-by: William Hubbs <williamh <AT> gentoo.org>
12
13 net-libs/nodejs/Manifest | 1 +
14 net-libs/nodejs/nodejs-16.17.0.ebuild | 225 ++++++++++++++++++++++++++++++++++
15 2 files changed, 226 insertions(+)
16
17 diff --git a/net-libs/nodejs/Manifest b/net-libs/nodejs/Manifest
18 index 45628b6eb4eb..ba40dcfe845a 100644
19 --- a/net-libs/nodejs/Manifest
20 +++ b/net-libs/nodejs/Manifest
21 @@ -1,4 +1,5 @@
22 DIST node-v14.20.0.tar.xz 34487684 BLAKE2B a3b8af94d2bb0e52f36ead91a5cd96a4a35a67f07b87e43da5ff598d693fd8b3b47c05dbb6c6b738aefa55b056eccedbcf782225a2abf49110b3371a544952bd SHA512 400eb247c1d37ca64f4d643ab1852d2e1415ee190cf726b1e9b058386a1ebd6d7a9f40092afff228ec7980f37a78978252c1ef115aee47ec5b90c065f136b10f
23 DIST node-v16.16.0.tar.xz 35039712 BLAKE2B e4cf7debda3d32b515d60d11ac7ebd788fdab0ebc782a096571cd4b502dddfb9c63c9a3625198c6c545f95092ffcb247e94ee96e33d8a79a7c5e24c56039c229 SHA512 828bfee4f3789b02fec512a7d9785bf02650401c61b2d3ff80d8a3876420927fb9c8d0c2d66e45e1e8370c47cb81140d434747588322c4fedca7fd9e42b84ac3
24 +DIST node-v16.17.0.tar.xz 35664964 BLAKE2B 490bcb65440a81d356f6351c45b19a4022cd55834b8b90da9eed2006042ab73732d581d58983b34b12ddef618d3e99fe760ef93447a2201268e2ab86466d3bb1 SHA512 8906ee337562b6f0b1614aa57084499ffd3bdfe8f8e706de8fed98baed5a92f691c534528b98f6321cf8a1eaaed6b45a938f28bd08167fbd75bfeb432ca03181
25 DIST node-v18.6.0.tar.xz 37189620 BLAKE2B 15a8a874f39db7de576d3ba81fddcb8072cb170ebb12308d2ade2efb9c8200c561671f453371a16db82d4c0f02522a28f6ae01216d11be40df94b53b184828b3 SHA512 d682e25a71ffbef90e2cb3c55e22dbd548952c4de24d48c47206afd270fd17c7bda95b3241840bf6a470f28d2389f3c6fddbb812ad17cf1d36262ff25fcda859
26 DIST node-v18.7.0.tar.xz 36945328 BLAKE2B 8ec945347ba396f7c65f544325690abdece4aa82ce1dae63e56662c78f445845f3f858a803ee2b130444f44cd38f4e1d8f5df0240d5a0c5124a38cbab42daafc SHA512 3da56b25f304b4e205c27a59f2e442e7216e494465e4cce9f51ffd3f7c7da3ab3519c4b7d1eb41a754b86ecfa1d138d270578aa3908b4fd42cc5dbfd389a6798
27
28 diff --git a/net-libs/nodejs/nodejs-16.17.0.ebuild b/net-libs/nodejs/nodejs-16.17.0.ebuild
29 new file mode 100644
30 index 000000000000..b091095897cc
31 --- /dev/null
32 +++ b/net-libs/nodejs/nodejs-16.17.0.ebuild
33 @@ -0,0 +1,225 @@
34 +# Copyright 1999-2022 Gentoo Authors
35 +# Distributed under the terms of the GNU General Public License v2
36 +
37 +EAPI=8
38 +
39 +CONFIG_CHECK="~ADVISE_SYSCALLS"
40 +PYTHON_COMPAT=( python3_{8..10} )
41 +PYTHON_REQ_USE="threads(+)"
42 +
43 +inherit bash-completion-r1 flag-o-matic linux-info 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 +
93 +pkg_setup() {
94 + python-any-r1_pkg_setup
95 + linux-info_pkg_setup
96 +}
97 +
98 +src_prepare() {
99 + tc-export AR CC CXX PKG_CONFIG
100 + export V=1
101 + export BUILDTYPE=Release
102 +
103 + # fix compilation on Darwin
104 + # https://code.google.com/p/gyp/issues/detail?id=260
105 + sed -i -e "/append('-arch/d" tools/gyp/pylib/gyp/xcode_emulation.py || die
106 +
107 + # less verbose install output (stating the same as portage, basically)
108 + sed -i -e "/print/d" tools/install.py || die
109 +
110 + # proper libdir, hat tip @ryanpcmcquen https://github.com/iojs/io.js/issues/504
111 + local LIBDIR=$(get_libdir)
112 + sed -i -e "s|lib/|${LIBDIR}/|g" tools/install.py || die
113 + sed -i -e "s/'lib'/'${LIBDIR}'/" deps/npm/lib/npm.js || die
114 +
115 + # Avoid writing a depfile, not useful
116 + sed -i -e "/DEPFLAGS =/d" tools/gyp/pylib/gyp/generator/make.py || die
117 +
118 + sed -i -e "/'-O3'/d" common.gypi node.gypi || die
119 +
120 + # debug builds. change install path, remove optimisations and override buildtype
121 + if use debug; then
122 + sed -i -e "s|out/Release/|out/Debug/|g" tools/install.py || die
123 + BUILDTYPE=Debug
124 + fi
125 +
126 + # We need to disable mprotect on two files when it builds Bug 694100.
127 + use pax-kernel && PATCHES+=( "${FILESDIR}"/${PN}-16.4.2-paxmarking.patch )
128 +
129 + # All this test does is check if the npm CLI produces warnings of any sort,
130 + # failing if it does. Overkill, much? Especially given one possible warning
131 + # is that there is a newer version of npm available upstream (yes, it does
132 + # use the network if available), thus making it a real possibility for this
133 + # test to begin failing one day even though it was fine before.
134 + rm -f test/parallel/test-release-npm.js
135 +
136 + default
137 +}
138 +
139 +src_configure() {
140 + xdg_environment_reset
141 +
142 + # LTO compiler flags are handled by configure.py itself
143 + filter-flags '-flto*'
144 +
145 + local myconf=(
146 + --shared-brotli
147 + --shared-cares
148 + --shared-libuv
149 + --shared-nghttp2
150 + --shared-zlib
151 + )
152 + use debug && myconf+=( --debug )
153 + use lto && myconf+=( --enable-lto )
154 + if use system-icu; then
155 + myconf+=( --with-intl=system-icu )
156 + elif use icu; then
157 + myconf+=( --with-intl=full-icu )
158 + else
159 + myconf+=( --with-intl=none )
160 + fi
161 + use inspector || myconf+=( --without-inspector )
162 + use npm || myconf+=( --without-npm )
163 + use snapshot || myconf+=( --without-node-snapshot )
164 + if use ssl; then
165 + use system-ssl && myconf+=( --shared-openssl --openssl-use-def-ca-store )
166 + else
167 + myconf+=( --without-ssl )
168 + fi
169 +
170 + local myarch=""
171 + case ${ABI} in
172 + amd64) myarch="x64";;
173 + arm) myarch="arm";;
174 + arm64) myarch="arm64";;
175 + lp64*) myarch="riscv64";;
176 + ppc64) myarch="ppc64";;
177 + x32) myarch="x32";;
178 + x86) myarch="ia32";;
179 + *) myarch="${ABI}";;
180 + esac
181 +
182 + GYP_DEFINES="linux_use_gold_flags=0
183 + linux_use_bundled_binutils=0
184 + linux_use_bundled_gold=0" \
185 + "${EPYTHON}" configure.py \
186 + --prefix="${EPREFIX}"/usr \
187 + --dest-cpu=${myarch} \
188 + $(use_with systemtap dtrace) \
189 + "${myconf[@]}" || die
190 +}
191 +
192 +src_compile() {
193 + emake -C out
194 +}
195 +
196 +src_install() {
197 + local LIBDIR="${ED}/usr/$(get_libdir)"
198 + default
199 +
200 + pax-mark -m "${ED}"/usr/bin/node
201 +
202 + # set up a symlink structure that node-gyp expects..
203 + dodir /usr/include/node/deps/{v8,uv}
204 + dosym . /usr/include/node/src
205 + for var in deps/{uv,v8}/include; do
206 + dosym ../.. /usr/include/node/${var}
207 + done
208 +
209 + if use doc; then
210 + docinto html
211 + dodoc -r "${S}"/doc/*
212 + fi
213 +
214 + if use npm; then
215 + keepdir /etc/npm
216 +
217 + # Install bash completion for `npm`
218 + local tmp_npm_completion_file="$(TMPDIR="${T}" mktemp -t npm.XXXXXXXXXX)"
219 + "${ED}/usr/bin/npm" completion > "${tmp_npm_completion_file}"
220 + newbashcomp "${tmp_npm_completion_file}" npm
221 +
222 + # Move man pages
223 + doman "${LIBDIR}"/node_modules/npm/man/man{1,5,7}/*
224 +
225 + # Clean up
226 + rm -f "${LIBDIR}"/node_modules/npm/{.mailmap,.npmignore,Makefile}
227 + rm -rf "${LIBDIR}"/node_modules/npm/{doc,html,man}
228 +
229 + local find_exp="-or -name"
230 + local find_name=()
231 + for match in "AUTHORS*" "CHANGELOG*" "CONTRIBUT*" "README*" \
232 + ".travis.yml" ".eslint*" ".wercker.yml" ".npmignore" \
233 + "*.md" "*.markdown" "*.bat" "*.cmd"; do
234 + find_name+=( ${find_exp} "${match}" )
235 + done
236 +
237 + # Remove various development and/or inappropriate files and
238 + # useless docs of dependend packages.
239 + find "${LIBDIR}"/node_modules \
240 + \( -type d -name examples \) -or \( -type f \( \
241 + -iname "LICEN?E*" \
242 + "${find_name[@]}" \
243 + \) \) -exec rm -rf "{}" \;
244 + fi
245 +
246 + mv "${ED}"/usr/share/doc/node "${ED}"/usr/share/doc/${PF} || die
247 +}
248 +
249 +src_test() {
250 + if has usersandbox ${FEATURES}; then
251 + rm -f "${S}"/test/parallel/test-fs-mkdir.js
252 + ewarn "You are emerging ${PN} with 'usersandbox' enabled. Excluding tests known to fail in this mode." \
253 + "For full test coverage, emerge =${CATEGORY}/${PF} with 'FEATURES=-usersandbox'."
254 + fi
255 +
256 + out/${BUILDTYPE}/cctest || die
257 + "${EPYTHON}" tools/test.py --mode=${BUILDTYPE,,} --flaky-tests=dontcare -J message parallel sequential || die
258 +}