Gentoo Archives: gentoo-commits

From: Jeroen Roovers <jer@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-libs/nodejs/
Date: Wed, 07 Oct 2020 06:29:21
Message-Id: 1602052154.3b3f4b676aadb2755fc2758723312a7a0560184e.jer@gentoo
1 commit: 3b3f4b676aadb2755fc2758723312a7a0560184e
2 Author: Jeroen Roovers <jer <AT> gentoo <DOT> org>
3 AuthorDate: Wed Oct 7 06:27:51 2020 +0000
4 Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org>
5 CommitDate: Wed Oct 7 06:29:14 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3b3f4b67
7
8 net-libs/nodejs: Version 12.19.0
9
10 Package-Manager: Portage-3.0.8, Repoman-3.0.1
11 Signed-off-by: Jeroen Roovers <jer <AT> gentoo.org>
12
13 net-libs/nodejs/Manifest | 1 +
14 net-libs/nodejs/nodejs-12.19.0.ebuild | 215 ++++++++++++++++++++++++++++++++++
15 2 files changed, 216 insertions(+)
16
17 diff --git a/net-libs/nodejs/Manifest b/net-libs/nodejs/Manifest
18 index 0ca16c0a960..3ad50a858b4 100644
19 --- a/net-libs/nodejs/Manifest
20 +++ b/net-libs/nodejs/Manifest
21 @@ -1,5 +1,6 @@
22 DIST node-v12.16.1.tar.xz 23481768 BLAKE2B 29371b952c14907778c064269108f1da5e3818c32773e73090c61edcd07190c418189db6a505987ca71f99bb868880e297de5d2181b9a880774eaaf515985f26 SHA512 fe1e9fabb6fe52e3bc4275b33e6c5e4a761550b04964c0ae7dbef7172f5d415207bb2985751d068e357ce45a0ba414b07c0abd1531ef839b9463e98eeae8f9a4
23 DIST node-v12.18.4.tar.xz 23679924 BLAKE2B 14de3c83851b89f85f7d6f549d9e43e3e97c7a84de94eef8c3a2789e960595749726b8039fdff1be822377355ede2bb95bba4fd1d17c3e5165c844a80eb32e53 SHA512 07101a9acc8dee5189f8484746715b57d4227d819e38a79c100da33f803b0f061e7b37fbd4114ce2bc3eea647726f8786880d3096dfab187c177679f3e1c78e8
24 +DIST node-v12.19.0.tar.xz 23819884 BLAKE2B 5affa4ef9bd4c88218cf8845341f8f7d357a807af5fb8a3633f47de278b20272be1f46365b2b1525c50f0c6ea40025c16725ab5236fb09dfb2f9167b727a1f8e SHA512 ca14aac0f6f95190fd63a87cdc0195c4d38697aef98c111392d71654bb482f1a8c4c925c4fa8387c41fa8a9515ac5e54af8fa365dbc0034fedc271c072801dc7
25 DIST node-v14.11.0.tar.xz 33379456 BLAKE2B 99e2eba4ba2e54209836fa1e3b63e42caf854d7f3bc99f5836300b0795ef8c785b78bd7c6b99148604f0bb1b34a5169c72e8be0f8d4f62412e7d352fce15ca18 SHA512 5014ebaeb109b0ecaca8f795a4e1a626c03b1132f9b8bac8826b734633c14e9f99b4f079c185a1f43f6938a1e543e5838f520159c3e08ca454398039fd26ef11
26 DIST node-v14.12.0.tar.xz 33390472 BLAKE2B 930b196ada16d21e2d2b43d030d936391e039cc985ee517b6b420277baa071ecef8c8cef7bd2f24b5e167465e9d4acc6b0da36ae4e7332fe179c47724e05ff50 SHA512 168141a3e3f20be98a0e800a8e8f70e1ff330ff087cc08c31d6ae185882615723166f445d6310a23e1bb5a023e671a74834b40e1b83f2b789f65c787c18762e2
27 DIST node-v14.13.0.tar.xz 33418156 BLAKE2B 8a986a467b77485fbe2bc9d580c48ae72536d6d62c826319b787d2937c86358787ae452676b69df608adb9d9754f4cd068b729614989a4f2a93973380c4929d1 SHA512 7a75bff501520afbe15d6ceea4b4507717111c87cf03de47047af790df2e2e9d71da9501c7256d5dd9f58616c3d04db2e74401dfbcbd72abbd0c81778a588893
28
29 diff --git a/net-libs/nodejs/nodejs-12.19.0.ebuild b/net-libs/nodejs/nodejs-12.19.0.ebuild
30 new file mode 100644
31 index 00000000000..7147f99f5e5
32 --- /dev/null
33 +++ b/net-libs/nodejs/nodejs-12.19.0.ebuild
34 @@ -0,0 +1,215 @@
35 +# Copyright 1999-2020 Gentoo Authors
36 +# Distributed under the terms of the GNU General Public License v2
37 +
38 +EAPI=7
39 +PYTHON_COMPAT=( python3_{6,7} )
40 +PYTHON_REQ_USE="threads(+)"
41 +inherit bash-completion-r1 eutils flag-o-matic 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 +SRC_URI="
46 + https://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz
47 +"
48 +
49 +LICENSE="Apache-1.1 Apache-2.0 BSD BSD-2 MIT"
50 +SLOT="0"
51 +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x64-macos"
52 +IUSE="cpu_flags_x86_sse2 debug doc icu inspector +npm +snapshot +ssl +system-ssl systemtap test"
53 +REQUIRED_USE="
54 + inspector? ( icu ssl )
55 + npm? ( ssl )
56 + system-ssl? ( ssl )
57 +"
58 +
59 +RDEPEND="
60 + >=app-arch/brotli-1.0.9
61 + >=dev-libs/libuv-1.39.0:=
62 + >=net-dns/c-ares-1.16.0
63 + >=net-libs/http-parser-2.9.3:=
64 + >=net-libs/nghttp2-1.40.0
65 + sys-libs/zlib
66 + icu? ( >=dev-libs/icu-64.2:= )
67 + system-ssl? ( >=dev-libs/openssl-1.1.1:0= )
68 +"
69 +BDEPEND="
70 + ${PYTHON_DEPS}
71 + systemtap? ( dev-util/systemtap )
72 + test? ( net-misc/curl )
73 +"
74 +DEPEND="
75 + ${RDEPEND}
76 +"
77 +PATCHES=(
78 + "${FILESDIR}"/${PN}-10.3.0-global-npm-config.patch
79 + "${FILESDIR}"/${PN}-99999999-llhttp.patch
80 +)
81 +RESTRICT="test"
82 +S="${WORKDIR}/node-v${PV}"
83 +
84 +pkg_pretend() {
85 + (use x86 && ! use cpu_flags_x86_sse2) && \
86 + die "Your CPU doesn't support the required SSE2 instruction."
87 +
88 + ( [[ ${MERGE_TYPE} != "binary" ]] && ! test-flag-CXX -std=c++11 ) && \
89 + die "Your compiler doesn't support C++11. Use GCC 4.8, Clang 3.3 or newer."
90 +}
91 +
92 +src_prepare() {
93 + tc-export CC CXX PKG_CONFIG
94 + export V=1
95 + export BUILDTYPE=Release
96 +
97 + # fix compilation on Darwin
98 + # https://code.google.com/p/gyp/issues/detail?id=260
99 + sed -i -e "/append('-arch/d" tools/gyp/pylib/gyp/xcode_emulation.py || die
100 +
101 + # less verbose install output (stating the same as portage, basically)
102 + sed -i -e "/print/d" tools/install.py || die
103 +
104 + # proper libdir, hat tip @ryanpcmcquen https://github.com/iojs/io.js/issues/504
105 + local LIBDIR=$(get_libdir)
106 + sed -i -e "s|lib/|${LIBDIR}/|g" tools/install.py || die
107 + sed -i -e "s/'lib'/'${LIBDIR}'/" deps/npm/lib/npm.js || die
108 +
109 + # Avoid writing a depfile, not useful
110 + sed -i -e "/DEPFLAGS =/d" tools/gyp/pylib/gyp/generator/make.py || die
111 +
112 + sed -i -e "/'-O3'/d" common.gypi node.gypi || die
113 +
114 + # Avoid a test that I've only been able to reproduce from emerge. It doesnt
115 + # seem sandbox related either (invoking it from a sandbox works fine).
116 + # The issue is that no stdin handle is openened when asked for one.
117 + # It doesn't really belong upstream , so it'll just be removed until someone
118 + # with more gentoo-knowledge than me (jbergstroem) figures it out.
119 + rm test/parallel/test-stdout-close-unref.js || die
120 +
121 + # debug builds. change install path, remove optimisations and override buildtype
122 + if use debug; then
123 + sed -i -e "s|out/Release/|out/Debug/|g" tools/install.py || die
124 + BUILDTYPE=Debug
125 + fi
126 +
127 + default
128 +}
129 +
130 +src_configure() {
131 + xdg_environment_reset
132 +
133 + local myconf=(
134 + --shared-brotli
135 + --shared-cares
136 + --shared-http-parser
137 + --shared-libuv
138 + --shared-nghttp2
139 + --shared-zlib
140 + )
141 + use debug && myconf+=( --debug )
142 + use icu && myconf+=( --with-intl=system-icu ) || myconf+=( --with-intl=none )
143 + use inspector || myconf+=( --without-inspector )
144 + use npm || myconf+=( --without-npm )
145 + use snapshot || myconf+=( --without-node-snapshot )
146 + if use ssl; then
147 + use system-ssl && myconf+=( --shared-openssl --openssl-use-def-ca-store )
148 + else
149 + myconf+=( --without-ssl )
150 + fi
151 +
152 + local myarch=""
153 + case ${ABI} in
154 + amd64) myarch="x64";;
155 + arm) myarch="arm";;
156 + arm64) myarch="arm64";;
157 + ppc64) myarch="ppc64";;
158 + x32) myarch="x32";;
159 + x86) myarch="ia32";;
160 + *) myarch="${ABI}";;
161 + esac
162 +
163 + GYP_DEFINES="linux_use_gold_flags=0
164 + linux_use_bundled_binutils=0
165 + linux_use_bundled_gold=0" \
166 + "${EPYTHON}" configure.py \
167 + --prefix="${EPREFIX}"/usr \
168 + --dest-cpu=${myarch} \
169 + $(use_with systemtap dtrace) \
170 + "${myconf[@]}" || die
171 +}
172 +
173 +src_compile() {
174 + emake -C out mksnapshot
175 + pax-mark m "out/${BUILDTYPE}/mksnapshot"
176 + emake -C out
177 +}
178 +
179 +src_install() {
180 + local LIBDIR="${ED}/usr/$(get_libdir)"
181 + default
182 +
183 + pax-mark -m "${ED}"/usr/bin/node
184 +
185 + # set up a symlink structure that node-gyp expects..
186 + dodir /usr/include/node/deps/{v8,uv}
187 + dosym . /usr/include/node/src
188 + for var in deps/{uv,v8}/include; do
189 + dosym ../.. /usr/include/node/${var}
190 + done
191 +
192 + if use doc; then
193 + docinto html
194 + dodoc -r "${S}"/doc/*
195 + fi
196 +
197 + if use npm; then
198 + dodir /etc/npm
199 +
200 + # Install bash completion for `npm`
201 + # We need to temporarily replace default config path since
202 + # npm otherwise tries to write outside of the sandbox
203 + local npm_config="usr/$(get_libdir)/node_modules/npm/lib/config/core.js"
204 + sed -i -e "s|'/etc'|'${ED}/etc'|g" "${ED}/${npm_config}" || die
205 + local tmp_npm_completion_file="$(emktemp)"
206 + "${ED}/usr/bin/npm" completion > "${tmp_npm_completion_file}"
207 + newbashcomp "${tmp_npm_completion_file}" npm
208 + sed -i -e "s|'${ED}/etc'|'/etc'|g" "${ED}/${npm_config}" || die
209 +
210 + # Move man pages
211 + doman "${LIBDIR}"/node_modules/npm/man/man{1,5,7}/*
212 +
213 + # Clean up
214 + rm "${LIBDIR}"/node_modules/npm/{.mailmap,.npmignore,Makefile} || die
215 + rm -rf "${LIBDIR}"/node_modules/npm/{doc,html,man} || die
216 +
217 + local find_exp="-or -name"
218 + local find_name=()
219 + for match in "AUTHORS*" "CHANGELOG*" "CONTRIBUT*" "README*" \
220 + ".travis.yml" ".eslint*" ".wercker.yml" ".npmignore" \
221 + "*.md" "*.markdown" "*.bat" "*.cmd"; do
222 + find_name+=( ${find_exp} "${match}" )
223 + done
224 +
225 + # Remove various development and/or inappropriate files and
226 + # useless docs of dependend packages.
227 + find "${LIBDIR}"/node_modules \
228 + \( -type d -name examples \) -or \( -type f \( \
229 + -iname "LICEN?E*" \
230 + "${find_name[@]}" \
231 + \) \) -exec rm -rf "{}" \;
232 + fi
233 +
234 + mv "${ED}"/usr/share/doc/node "${ED}"/usr/share/doc/${PF} || die
235 +}
236 +
237 +src_test() {
238 + out/${BUILDTYPE}/cctest || die
239 + "${PYTHON}" tools/test.py --mode=${BUILDTYPE,,} -J message parallel sequential || die
240 +}
241 +
242 +pkg_postinst() {
243 + elog "The global npm config lives in /etc/npm. This deviates slightly"
244 + elog "from upstream which otherwise would have it live in /usr/etc/."
245 + elog ""
246 + elog "Protip: When using node-gyp to install native modules, you can"
247 + elog "avoid having to download extras by doing the following:"
248 + elog "$ node-gyp --nodedir /usr/include/node <command>"
249 +}