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