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