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: Tue, 04 Jun 2019 20:39:52
Message-Id: 1559680784.17418e89902ac41bb1e6a59036e7dcd0d180511b.jer@gentoo
1 commit: 17418e89902ac41bb1e6a59036e7dcd0d180511b
2 Author: Jeroen Roovers <jer <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jun 4 20:38:31 2019 +0000
4 Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org>
5 CommitDate: Tue Jun 4 20:39:44 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=17418e89
7
8 net-libs/nodejs: Version 12.4.0
9
10 Package-Manager: Portage-2.3.67, Repoman-2.3.14
11 Signed-off-by: Jeroen Roovers <jer <AT> gentoo.org>
12
13 net-libs/nodejs/Manifest | 1 +
14 net-libs/nodejs/nodejs-12.4.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 7eaf335aa89..2c1c284254c 100644
19 --- a/net-libs/nodejs/Manifest
20 +++ b/net-libs/nodejs/Manifest
21 @@ -5,6 +5,7 @@ DIST node-v11.14.0.tar.xz 22106812 BLAKE2B 3a8dd9feb5916f235bf69d0610e32c1861e64
22 DIST node-v11.15.0.tar.xz 22115480 BLAKE2B ed1f621e46d24051f8d84255875e7cb2c1bc0f9432a12fcc35dc5e336a71bb3e7f511146d112d1f236f9f978a68987d80331c22699479ce63b7bf30e50643219 SHA512 48270620fab3eef86c21387b316ce9054e2b0aac60a36f7fc08d18ad4a11c8d2082886ca20a455fb4a74a561d7e97c77403227ec9a83a13c47fa230b47a5af2e
23 DIST node-v12.3.0.tar.xz 22448392 BLAKE2B 8c6e40d9bcfee315b6bb5f97846db27ebeae2520fcde5ede942af2f24032101c06653dded9d4fa77992fcdaf5b0f67452e5e3cbb032bd33cde4dc496a652c283 SHA512 4b97524781efb8c284337b36d1b02576aa6703aa37d0775329eff735f38bcb5391364bd420914fa75088b97e72fe087e263a41fb2367fc8e8f7f63ebf4a949e6
24 DIST node-v12.3.1.tar.xz 22462972 BLAKE2B f28b5594aca3701735a178873ae426ebde27a6abb5b13115c6ca2a32bb2e2532f60a96722b07737246bdf8a1dce799e86f920a355278ad8619d9931319a6e81a SHA512 40e05550d48b0b8739fcd6ef66a70e53e85106af486c2f99aad58fe10c8f33e5473ab5afb59849960ce828f5c8bb21f26cecbbfb31852a2f2c6aa3916449b44d
25 +DIST node-v12.4.0.tar.xz 22479676 BLAKE2B 86abd574843a8aa8a17fed378e3041288eea1f41c51f0613150129be9bd38ce83e88dde884cef81fe84f746f47f027ffe37bc07773112c4a9b1a3b12ffd40ee2 SHA512 04a9eeedaef2c151e993d9ca3d43d56d85e24b5f5d04fbee1b4556d192badb3e4f3c735dee58abf0a43775d2de335f054e23aedae48140148e2466245311d306
26 DIST node-v4.9.1.tar.xz 13250164 BLAKE2B 7a689b99bb4bf507f7f21dd2c096a5766d023a8174c0f468cab37365af1920b8700da04157e1a406917790524255ef32c243a74662fd50ef7d3567d189dac9cf SHA512 690c9fdf608e5194069a10955bdd94ec87cb1c308f13bc4d2cae92fa01436ace10fadf58f2e51d477dde6c570b23edc1c71fafea79bfc9cab2903eb2fa5f87aa
27 DIST node-v6.14.4.tar.xz 15842824 BLAKE2B fc56364be64fe5824e2bb50d861ebf8f58f9895f2c9c108b8df3315b127ffb2755eac85c28165ac9779adab4611ce8f5ea1a5745f43ebaa1389e82b8215c6396 SHA512 1ead0c097ec125230dd631f19a5c3ec06a1371f9ca3b392b5ad08fcc227dd0142f33ad52f96890c2c17448a4951a635b9099dfff00d7d8b3ffb59b07904d1bfa
28 DIST node-v6.17.1.tar.xz 15858444 BLAKE2B ad050f71452f0ddf989e66a4eb02e88e4e5001faa2bcb0eae6b57784da87ba1d8251201e3a3d15245bb4d846f31f39854ddfae47aa1212c0526ec717438ba778 SHA512 6938c4864a96f5698ebc4e9a1228644820789d5402f42348eb1ff9ccd64f31bb91309a1f3301636b1117424c88b0b41b42baae51a1070d5c532604e5d7d7b868
29
30 diff --git a/net-libs/nodejs/nodejs-12.4.0.ebuild b/net-libs/nodejs/nodejs-12.4.0.ebuild
31 new file mode 100644
32 index 00000000000..1d6bf82084f
33 --- /dev/null
34 +++ b/net-libs/nodejs/nodejs-12.4.0.ebuild
35 @@ -0,0 +1,208 @@
36 +# Copyright 1999-2019 Gentoo Authors
37 +# Distributed under the terms of the GNU General Public License v2
38 +
39 +EAPI=7
40 +PYTHON_COMPAT=( python2_7 )
41 +PYTHON_REQ_USE="threads"
42 +inherit bash-completion-r1 flag-o-matic pax-utils python-single-r1 toolchain-funcs
43 +
44 +DESCRIPTION="A JavaScript runtime built on Chrome's V8 JavaScript engine"
45 +HOMEPAGE="https://nodejs.org/"
46 +SRC_URI="https://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz"
47 +
48 +LICENSE="Apache-1.1 Apache-2.0 BSD BSD-2 MIT"
49 +SLOT="0"
50 +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x64-macos"
51 +IUSE="cpu_flags_x86_sse2 debug doc icu inspector +npm +snapshot +ssl systemtap test"
52 +REQUIRED_USE="
53 + ${PYTHON_REQUIRED_USE}
54 + inspector? ( icu ssl )
55 + npm? ( ssl )
56 +"
57 +
58 +RDEPEND="
59 + >=dev-libs/libuv-1.29.1:=
60 + >=net-dns/c-ares-1.15.0
61 + >=net-libs/http-parser-2.8.0:=
62 + >=net-libs/nghttp2-1.38.0
63 + sys-libs/zlib
64 + icu? ( >=dev-libs/icu-64.2:= )
65 + ssl? ( >=dev-libs/openssl-1.1.1:0= )
66 +"
67 +DEPEND="
68 + ${RDEPEND}
69 + ${PYTHON_DEPS}
70 + systemtap? ( dev-util/systemtap )
71 + test? ( net-misc/curl )
72 +"
73 +PATCHES=(
74 + "${FILESDIR}"/${PN}-10.3.0-global-npm-config.patch
75 + "${FILESDIR}"/${PN}-99999999-llhttp.patch
76 +)
77 +S="${WORKDIR}/node-v${PV}"
78 +
79 +pkg_pretend() {
80 + (use x86 && ! use cpu_flags_x86_sse2) && \
81 + die "Your CPU doesn't support the required SSE2 instruction."
82 +
83 + ( [[ ${MERGE_TYPE} != "binary" ]] && ! test-flag-CXX -std=c++11 ) && \
84 + die "Your compiler doesn't support C++11. Use GCC 4.8, Clang 3.3 or newer."
85 +}
86 +
87 +src_prepare() {
88 + tc-export CC CXX PKG_CONFIG
89 + export V=1
90 + export BUILDTYPE=Release
91 +
92 + # fix compilation on Darwin
93 + # https://code.google.com/p/gyp/issues/detail?id=260
94 + sed -i -e "/append('-arch/d" tools/gyp/pylib/gyp/xcode_emulation.py || die
95 +
96 + # make sure we use python2.* while using gyp
97 + sed -i -e "s/python/${EPYTHON}/" deps/npm/node_modules/node-gyp/gyp/gyp || die
98 + sed -i -e "s/|| 'python2'/|| '${EPYTHON}'/" deps/npm/node_modules/node-gyp/lib/configure.js || die
99 +
100 + # less verbose install output (stating the same as portage, basically)
101 + sed -i -e "/print/d" tools/install.py || die
102 +
103 + # proper libdir, hat tip @ryanpcmcquen https://github.com/iojs/io.js/issues/504
104 + local LIBDIR=$(get_libdir)
105 + sed -i -e "s|lib/|${LIBDIR}/|g" tools/install.py || die
106 + sed -i -e "s/'lib'/'${LIBDIR}'/" deps/npm/lib/npm.js || die
107 +
108 + # Avoid writing a depfile, not useful
109 + sed -i -e "/DEPFLAGS =/d" tools/gyp/pylib/gyp/generator/make.py || die
110 +
111 + sed -i -e "/'-O3'/d" common.gypi node.gypi || die
112 +
113 + # Avoid a test that I've only been able to reproduce from emerge. It doesnt
114 + # seem sandbox related either (invoking it from a sandbox works fine).
115 + # The issue is that no stdin handle is openened when asked for one.
116 + # It doesn't really belong upstream , so it'll just be removed until someone
117 + # with more gentoo-knowledge than me (jbergstroem) figures it out.
118 + rm test/parallel/test-stdout-close-unref.js || 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 + default
127 +}
128 +
129 +src_configure() {
130 + local myconf=(
131 + --shared-cares --shared-http-parser --shared-libuv --shared-nghttp2
132 + --shared-zlib
133 + )
134 + use debug && myconf+=( --debug )
135 + use icu && myconf+=( --with-intl=system-icu ) || myconf+=( --with-intl=none )
136 + use inspector || myconf+=( --without-inspector )
137 + use npm || myconf+=( --without-npm )
138 + use snapshot && myconf+=( --with-snapshot )
139 + use ssl && myconf+=( --shared-openssl --openssl-use-def-ca-store ) || myconf+=( --without-ssl )
140 +
141 + local myarch=""
142 + case ${ABI} in
143 + amd64) myarch="x64";;
144 + arm) myarch="arm";;
145 + arm64) myarch="arm64";;
146 + ppc64) myarch="ppc64";;
147 + x32) myarch="x32";;
148 + x86) myarch="ia32";;
149 + *) myarch="${ABI}";;
150 + esac
151 +
152 + GYP_DEFINES="linux_use_gold_flags=0
153 + linux_use_bundled_binutils=0
154 + linux_use_bundled_gold=0" \
155 + "${PYTHON}" configure \
156 + --prefix="${EPREFIX}"/usr \
157 + --dest-cpu=${myarch} \
158 + $(use_with systemtap dtrace) \
159 + "${myconf[@]}" || die
160 +}
161 +
162 +src_compile() {
163 + emake -C out mksnapshot
164 + pax-mark m "out/${BUILDTYPE}/mksnapshot"
165 + emake -C out
166 +}
167 +
168 +src_install() {
169 + local LIBDIR="${ED}/usr/$(get_libdir)"
170 + default
171 +
172 + pax-mark -m "${ED}"usr/bin/node
173 +
174 + # set up a symlink structure that node-gyp expects..
175 + dodir /usr/include/node/deps/{v8,uv}
176 + dosym . /usr/include/node/src
177 + for var in deps/{uv,v8}/include; do
178 + dosym ../.. /usr/include/node/${var}
179 + done
180 +
181 + if use doc; then
182 + # Patch docs to make them offline readable
183 + for i in `grep -rl 'fonts.googleapis.com' "${S}"/out/doc/api/*`; do
184 + sed -i '/fonts.googleapis.com/ d' $i;
185 + done
186 + # Install docs
187 + docinto html
188 + dodoc -r "${S}"/doc/*
189 + fi
190 +
191 + if use npm; then
192 + dodir /etc/npm
193 +
194 + # Install bash completion for `npm`
195 + # We need to temporarily replace default config path since
196 + # npm otherwise tries to write outside of the sandbox
197 + local npm_config="usr/$(get_libdir)/node_modules/npm/lib/config/core.js"
198 + sed -i -e "s|'/etc'|'${ED}/etc'|g" "${ED}/${npm_config}" || die
199 + local tmp_npm_completion_file="$(emktemp)"
200 + "${ED}/usr/bin/npm" completion > "${tmp_npm_completion_file}"
201 + newbashcomp "${tmp_npm_completion_file}" npm
202 + sed -i -e "s|'${ED}/etc'|'/etc'|g" "${ED}/${npm_config}" || die
203 +
204 + # Move man pages
205 + doman "${LIBDIR}"/node_modules/npm/man/man{1,5,7}/*
206 +
207 + # Clean up
208 + rm "${LIBDIR}"/node_modules/npm/{.mailmap,.npmignore,Makefile} || die
209 + rm -rf "${LIBDIR}"/node_modules/npm/{doc,html,man} || die
210 +
211 + local find_exp="-or -name"
212 + local find_name=()
213 + for match in "AUTHORS*" "CHANGELOG*" "CONTRIBUT*" "README*" \
214 + ".travis.yml" ".eslint*" ".wercker.yml" ".npmignore" \
215 + "*.md" "*.markdown" "*.bat" "*.cmd"; do
216 + find_name+=( ${find_exp} "${match}" )
217 + done
218 +
219 + # Remove various development and/or inappropriate files and
220 + # useless docs of dependend packages.
221 + find "${LIBDIR}"/node_modules \
222 + \( -type d -name examples \) -or \( -type f \( \
223 + -iname "LICEN?E*" \
224 + "${find_name[@]}" \
225 + \) \) -exec rm -rf "{}" \;
226 + fi
227 +
228 + mv "${ED}"/usr/share/doc/node "${ED}"/usr/share/doc/${PF} || die
229 +}
230 +
231 +src_test() {
232 + out/${BUILDTYPE}/cctest || die
233 + "${PYTHON}" tools/test.py --mode=${BUILDTYPE,,} -J message parallel sequential || die
234 +}
235 +
236 +pkg_postinst() {
237 + elog "The global npm config lives in /etc/npm. This deviates slightly"
238 + elog "from upstream which otherwise would have it live in /usr/etc/."
239 + elog ""
240 + elog "Protip: When using node-gyp to install native modules, you can"
241 + elog "avoid having to download extras by doing the following:"
242 + elog "$ node-gyp --nodedir /usr/include/node <command>"
243 +}