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