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