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: Thu, 04 Jan 2018 12:17:50
Message-Id: 1515068260.afbc77a250238b93a447a165a77f5e661f7b5394.jer@gentoo
1 commit: afbc77a250238b93a447a165a77f5e661f7b5394
2 Author: Jeroen Roovers <jer <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jan 4 12:15:01 2018 +0000
4 Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org>
5 CommitDate: Thu Jan 4 12:17:40 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=afbc77a2
7
8 net-libs/nodejs: Version 4.8.7 6.12.3 8.9.4.
9
10 Package-Manager: Portage-2.3.19, Repoman-2.3.6
11
12 net-libs/nodejs/Manifest | 3 +
13 net-libs/nodejs/nodejs-4.8.7.ebuild | 143 +++++++++++++++++++++++++
14 net-libs/nodejs/nodejs-6.12.3.ebuild | 200 ++++++++++++++++++++++++++++++++++
15 net-libs/nodejs/nodejs-8.9.4.ebuild | 201 +++++++++++++++++++++++++++++++++++
16 4 files changed, 547 insertions(+)
17
18 diff --git a/net-libs/nodejs/Manifest b/net-libs/nodejs/Manifest
19 index b3041a03bb2..2be2bd67bd1 100644
20 --- a/net-libs/nodejs/Manifest
21 +++ b/net-libs/nodejs/Manifest
22 @@ -1,8 +1,11 @@
23 DIST node-v0.12.17.tar.gz 19938029 BLAKE2B 0118fb016c70afc9940c3b9e2fbed9fd3a56ae7fd8bff6f2ec69320f1e3a71868f7e882783871e842d163b5195628040736e679ca715ebddc6eb6a76fff1288f SHA512 86c22b17f57018083b07096beeca10e6dfa7569b3d1a25a3b12dd82796db3c9536e6136e0dd0ff62b4de116413f3722b36ce396faa46d8640f80ab09ccfcbca7
24 DIST node-v4.8.5.tar.xz 13316060 BLAKE2B fb32f176b9d4add3e9695f0bee7ebd0bba66770d479b1fade572de4694566603f08875da6ff97a1904edd1156708b58670fb1c4717e213aab6ad44ae5d470f40 SHA512 64d936ca14648b5648dedb41f2ee8d39466788762d335fbfc9ce4cb7484d05b6c24ad912fb4b1579a08f466be50b129a96be700fd89cbca5e1de84baa63ddd12
25 +DIST node-v4.8.7.tar.xz 13370828 BLAKE2B b1ee93a586b66f8582783b1be50667547afe4bf48038ebc0b8148db55542cbc0520ac84ef88e4a7f453cabc245f484c32dbc238c1932bbc708791ceeb5c9d2ab SHA512 25837a31023747723b146c45984a5b2096b61c0aa43cbf45fc8ff50b4bd5079bd0bc9f1dfd3fb076817448dc5537eb93ffb2f345280b7756ba93b67ad757c696
26 DIST node-v6.11.5.tar.xz 15699404 BLAKE2B ba2df91bf5ef38cedb60b42919cf56f16807e619a81876fc92a5741e49da7ec91c4239d00f549c5e80d0bb8282bb9b396dd984507916cd18d61b403a3a7cef94 SHA512 62490725ef7957294c1bddf21ef0626c7472876791210168116501255ecee58457e9de9b044e10033706243299bbfd1495efeca169596fbf26f5eeba6d8fa4c9
27 DIST node-v6.12.2.tar.xz 15760164 BLAKE2B 89daf5d52a430a729f9c55f10483805a6b802abdffa2a3bbcaa8ce71c78321eadedaabe1b28cd781c6b894923821bbb1743754cbabafda0a0e9abb7b6b11fa78 SHA512 914eea968dacb086f5083ee0845a982969a5c56ab183c8da17812d8386095db1e9c2d07dee4f6186091d64cde605d1ffc15d17025ea28d1c3ee3bceefff6c399
28 +DIST node-v6.12.3.tar.xz 15767900 BLAKE2B 2a986c8099d14b199e33676e1a7d416919407558a42d14e526794baa29d8788c74a5ff47e8d2a8509a747682bea393b45e31965569a4b72976b7691f2a84e971 SHA512 dcf30bc221aa949e6ca3bd9321ac68adb05d93af0b06119b4b73bfd4cfa2c31897520d90247ac0f783946c1fc2efe77178f52225150dad4522ac9408d036a8e4
29 DIST node-v6.9.4.tar.xz 15519264 BLAKE2B 4dfad88b06b209272b8468501cc3c87c40425781fb55011ee93326555c2df88a166ffaff1877563668e06389703053849361739556f1bc87c1e2386d48b9542e SHA512 86d3e2889031c2b50c021bd3fd63194c2c22c44291d51dff1b5e1652b01853c09d2880c2f58fdad062e3e2a3f637a3f0d78dac66b835b676790cf272e64f8dce
30 DIST node-v8.9.3.tar.xz 18298212 BLAKE2B 7d19fcb77c496fb3aa717d426a3db4630e382738f0fe3273bba3137814470a5fe5e9593c18934cfd62816a0ac33d195eb241c810f4756d84eaa8f974606a485b SHA512 7bd037189925387bfd1339eef5be9af10af0a063914b4cdb2a1f3befec2e76eb566f7d14874b8c70a02172ebeb4d1c1fdbb0715ca8f18b0b5711a38b30214bc8
31 +DIST node-v8.9.4.tar.xz 18338980 BLAKE2B 81180fc0c9b10cebc051a72649fb40650c89a05d427b826a6f3937e2b108b97edd27dd1c1521e57168e5a92b37e590429735c07c3198e4b912774c305ae61693 SHA512 9656b57145c2b3048ff9ad70f91dbff33a7349dca564efe3b2ff585e2ffad004ea8de920a7a049ff4c5487683986d78b5a578306c2c99f3b1a3de96d9ad1dece
32 DIST node-v9.2.1.tar.xz 18346796 BLAKE2B 8fe82a9b50636fef21f9bba05e89381f6785f18599adb5183d4276df4d0e5b2a4d1bb3d8137143fb87d8638ce82f6812ff237764f7b76f1bee65199a93c91e88 SHA512 379a340186c8299df02a90dce730250d46b502ef58ca4720ede48a5053d0f1e6ee958003dd9e3c0b76f4575980217d9dc5a9cd93a2a4e58da324d04d6d5edc7e
33 DIST node-v9.3.0.tar.xz 18385364 BLAKE2B 825fd8786b68020f7bb2735e519cd5ecb49552766646425613780736e7c20f555007e90048abd3e985d27656a39da6737ced5c905f113b0e531549312751e2d8 SHA512 bafc3bbd01ce0cc00f13e6f34b8ed361cff337c71b90836132c8188b1103ba2d6aab145258b6afafafc2455fa8a5de54be265435a553793946fd6d308095ae3e
34
35 diff --git a/net-libs/nodejs/nodejs-4.8.7.ebuild b/net-libs/nodejs/nodejs-4.8.7.ebuild
36 new file mode 100644
37 index 00000000000..44227b1490c
38 --- /dev/null
39 +++ b/net-libs/nodejs/nodejs-4.8.7.ebuild
40 @@ -0,0 +1,143 @@
41 +# Copyright 1999-2018 Gentoo Foundation
42 +# Distributed under the terms of the GNU General Public License v2
43 +
44 +EAPI=5
45 +
46 +PYTHON_COMPAT=( python2_7 )
47 +PYTHON_REQ_USE="threads"
48 +
49 +inherit flag-o-matic pax-utils python-single-r1 toolchain-funcs
50 +
51 +DESCRIPTION="A JavaScript runtime built on Chrome's V8 JavaScript engine"
52 +HOMEPAGE="https://nodejs.org/"
53 +SRC_URI="https://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz"
54 +
55 +LICENSE="Apache-1.1 Apache-2.0 BSD BSD-2 MIT"
56 +SLOT="0"
57 +KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86 ~x64-macos"
58 +IUSE="cpu_flags_x86_sse2 debug icu +npm snapshot +ssl test"
59 +
60 +RDEPEND="icu? ( >=dev-libs/icu-55:= )
61 + npm? ( ${PYTHON_DEPS} )
62 + >=net-libs/http-parser-2.5.2:=
63 + >=dev-libs/libuv-1.8.0:=
64 + >=dev-libs/openssl-1.0.2g:0=[-bindist]
65 + sys-libs/zlib"
66 +DEPEND="${RDEPEND}
67 + ${PYTHON_DEPS}
68 + test? ( net-misc/curl )"
69 +
70 +S="${WORKDIR}/node-v${PV}"
71 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
72 +
73 +pkg_pretend() {
74 + (use x86 && ! use cpu_flags_x86_sse2) && \
75 + die "Your CPU doesn't support the required SSE2 instruction."
76 +
77 + ( [[ ${MERGE_TYPE} != "binary" ]] && ! test-flag-CXX -std=c++11 ) && \
78 + die "Your compiler doesn't support C++11. Use GCC 4.8, Clang 3.3 or newer."
79 +}
80 +
81 +src_prepare() {
82 + tc-export CC CXX PKG_CONFIG
83 + export V=1 # Verbose build
84 + export BUILDTYPE=Release
85 +
86 + # fix compilation on Darwin
87 + # https://code.google.com/p/gyp/issues/detail?id=260
88 + sed -i -e "/append('-arch/d" tools/gyp/pylib/gyp/xcode_emulation.py || die
89 +
90 + # make sure we use python2.* while using gyp
91 + sed -i -e "s/python/${EPYTHON}/" deps/npm/node_modules/node-gyp/gyp/gyp || die
92 + sed -i -e "s/|| 'python'/|| '${EPYTHON}'/" deps/npm/node_modules/node-gyp/lib/configure.js || die
93 +
94 + # less verbose install output (stating the same as portage, basically)
95 + sed -i -e "/print/d" tools/install.py || die
96 +
97 + # proper libdir, hat tip @ryanpcmcquen https://github.com/iojs/io.js/issues/504
98 + local LIBDIR=$(get_libdir)
99 + sed -i -e "s|lib/|${LIBDIR}/|g" tools/install.py || die
100 + sed -i -e "s/'lib'/'${LIBDIR}'/" lib/module.js || die
101 + sed -i -e "s|\"lib\"|\"${LIBDIR}\"|" deps/npm/lib/npm.js || die
102 +
103 + # Avoid a test that I've only been able to reproduce from emerge. It doesnt
104 + # seem sandbox related either (invoking it from a sandbox works fine).
105 + # The issue is that no stdin handle is openened when asked for one.
106 + # It doesn't really belong upstream , so it'll just be removed until someone
107 + # with more gentoo-knowledge than me (jbergstroem) figures it out.
108 + rm test/parallel/test-stdout-close-unref.js || die
109 +
110 + # debug builds. change install path, remove optimisations and override buildtype
111 + if use debug; then
112 + sed -i -e "s|out/Release/|out/Debug/|g" tools/install.py || die
113 + BUILDTYPE=Debug
114 + fi
115 +
116 + epatch_user
117 +}
118 +
119 +src_configure() {
120 + local myarch=""
121 + local myconf+=( --shared-openssl --shared-libuv --shared-http-parser --shared-zlib )
122 + use npm || myconf+=( --without-npm )
123 + use icu && myconf+=( --with-intl=system-icu )
124 + use snapshot && myconf+=( --with-snapshot )
125 + use ssl || myconf+=( --without-ssl )
126 + use debug && myconf+=( --debug )
127 +
128 + case ${ABI} in
129 + amd64) myarch="x64";;
130 + arm) myarch="arm";;
131 + arm64) myarch="arm64";;
132 + ppc64) myarch="ppc64";;
133 + x32) myarch="x32";;
134 + x86) myarch="ia32";;
135 + *) die "Unrecognized ARCH ${ARCH}";;
136 + esac
137 +
138 + GYP_DEFINES="linux_use_gold_flags=0
139 + linux_use_bundled_binutils=0
140 + linux_use_bundled_gold=0" \
141 + "${PYTHON}" configure \
142 + --prefix="${EPREFIX}"/usr \
143 + --dest-cpu=${myarch} \
144 + --without-dtrace \
145 + "${myconf[@]}" || die
146 +}
147 +
148 +src_compile() {
149 + emake -C out mksnapshot
150 + pax-mark m "out/${BUILDTYPE}/mksnapshot"
151 + emake -C out
152 +}
153 +
154 +src_install() {
155 + local LIBDIR="${ED}/usr/$(get_libdir)"
156 + emake install DESTDIR="${ED}" PREFIX=/usr
157 + if use npm; then
158 + dodoc -r "${LIBDIR}"/node_modules/npm/html
159 + rm -rf "${LIBDIR}"/node_modules/npm/{doc,html} || die
160 + find "${LIBDIR}"/node_modules -type f -name "LICENSE*" -or -name "LICENCE*" -delete || die
161 + fi
162 +
163 + # set up a symlink structure that npm expects..
164 + dodir /usr/include/node/deps/{v8,uv}
165 + dosym . /usr/include/node/src
166 + for var in deps/{uv,v8}/include; do
167 + dosym ../.. /usr/include/node/${var}
168 + done
169 +
170 + pax-mark -m "${ED}"/usr/bin/node
171 +}
172 +
173 +src_test() {
174 + out/${BUILDTYPE}/cctest || die
175 + "${PYTHON}" tools/test.py --mode=${BUILDTYPE,,} -J message parallel sequential || die
176 +}
177 +
178 +pkg_postinst() {
179 + einfo "When using node-gyp to install native modules, you can avoid"
180 + einfo "having to download the full tarball by doing the following:"
181 + einfo ""
182 + einfo "node-gyp --nodedir /usr/include/node <command>"
183 +}
184
185 diff --git a/net-libs/nodejs/nodejs-6.12.3.ebuild b/net-libs/nodejs/nodejs-6.12.3.ebuild
186 new file mode 100644
187 index 00000000000..ab8e2550ebd
188 --- /dev/null
189 +++ b/net-libs/nodejs/nodejs-6.12.3.ebuild
190 @@ -0,0 +1,200 @@
191 +# Copyright 1999-2018 Gentoo Foundation
192 +# Distributed under the terms of the GNU General Public License v2
193 +
194 +EAPI=6
195 +RESTRICT="test"
196 +
197 +PYTHON_COMPAT=( python2_7 )
198 +PYTHON_REQ_USE="threads"
199 +
200 +inherit bash-completion-r1 eutils flag-o-matic pax-utils python-single-r1 toolchain-funcs
201 +
202 +DESCRIPTION="A JavaScript runtime built on Chrome's V8 JavaScript engine"
203 +HOMEPAGE="https://nodejs.org/"
204 +SRC_URI="https://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz"
205 +
206 +LICENSE="Apache-1.1 Apache-2.0 BSD BSD-2 MIT"
207 +SLOT="0"
208 +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x64-macos"
209 +IUSE="cpu_flags_x86_sse2 debug doc icu inspector +npm +snapshot +ssl test"
210 +REQUIRED_USE="
211 + inspector? ( icu ssl )
212 +"
213 +
214 +RDEPEND="
215 + >=dev-libs/libuv-1.15.0:=
216 + >=dev-libs/openssl-1.0.2n:0=[-bindist]
217 + >=net-libs/http-parser-2.7.0:=
218 + sys-libs/zlib
219 + icu? ( >=dev-libs/icu-58.2:= )
220 +"
221 +DEPEND="
222 + ${RDEPEND}
223 + ${PYTHON_DEPS}
224 + test? ( net-misc/curl )
225 +"
226 +
227 +S="${WORKDIR}/node-v${PV}"
228 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
229 +
230 +PATCHES=(
231 + "${FILESDIR}"/gentoo-global-npm-config.patch
232 +)
233 +
234 +pkg_pretend() {
235 + (use x86 && ! use cpu_flags_x86_sse2) && \
236 + die "Your CPU doesn't support the required SSE2 instruction."
237 +
238 + ( [[ ${MERGE_TYPE} != "binary" ]] && ! test-flag-CXX -std=c++11 ) && \
239 + die "Your compiler doesn't support C++11. Use GCC 4.8, Clang 3.3 or newer."
240 +}
241 +
242 +src_prepare() {
243 + tc-export CC CXX PKG_CONFIG
244 + export V=1
245 + export BUILDTYPE=Release
246 +
247 + # fix compilation on Darwin
248 + # https://code.google.com/p/gyp/issues/detail?id=260
249 + sed -i -e "/append('-arch/d" tools/gyp/pylib/gyp/xcode_emulation.py || die
250 +
251 + # make sure we use python2.* while using gyp
252 + sed -i -e "s/python/${EPYTHON}/" deps/npm/node_modules/node-gyp/gyp/gyp || die
253 + sed -i -e "s/|| 'python'/|| '${EPYTHON}'/" deps/npm/node_modules/node-gyp/lib/configure.js || die
254 +
255 + # less verbose install output (stating the same as portage, basically)
256 + sed -i -e "/print/d" tools/install.py || die
257 +
258 + # proper libdir, hat tip @ryanpcmcquen https://github.com/iojs/io.js/issues/504
259 + local LIBDIR=$(get_libdir)
260 + sed -i -e "s|lib/|${LIBDIR}/|g" tools/install.py || die
261 + sed -i -e "s/'lib'/'${LIBDIR}'/" lib/module.js || die
262 + sed -i -e "s|\"lib\"|\"${LIBDIR}\"|" deps/npm/lib/npm.js || die
263 +
264 + # Avoid writing a depfile, not useful
265 + sed -i -e "/DEPFLAGS =/d" tools/gyp/pylib/gyp/generator/make.py || die
266 +
267 + # Avoid a test that I've only been able to reproduce from emerge. It doesnt
268 + # seem sandbox related either (invoking it from a sandbox works fine).
269 + # The issue is that no stdin handle is openened when asked for one.
270 + # It doesn't really belong upstream , so it'll just be removed until someone
271 + # with more gentoo-knowledge than me (jbergstroem) figures it out.
272 + rm test/parallel/test-stdout-close-unref.js || die
273 +
274 + # debug builds. change install path, remove optimisations and override buildtype
275 + if use debug; then
276 + sed -i -e "s|out/Release/|out/Debug/|g" tools/install.py || die
277 + BUILDTYPE=Debug
278 + fi
279 +
280 + default
281 +}
282 +
283 +src_configure() {
284 + local myarch=""
285 + local myconf=( --shared-openssl --shared-libuv --shared-http-parser --shared-zlib )
286 + use debug && myconf+=( --debug )
287 + use icu && myconf+=( --with-intl=system-icu )
288 + use inspector || myconf+=( --without-inspector )
289 + use npm || myconf+=( --without-npm )
290 + use snapshot && myconf+=( --with-snapshot )
291 + use ssl || myconf+=( --without-ssl )
292 +
293 + case ${ABI} in
294 + amd64) myarch="x64";;
295 + arm) myarch="arm";;
296 + arm64) myarch="arm64";;
297 + ppc64) myarch="ppc64";;
298 + x32) myarch="x32";;
299 + x86) myarch="ia32";;
300 + *) myarch="${ABI}";;
301 + esac
302 +
303 + GYP_DEFINES="linux_use_gold_flags=0
304 + linux_use_bundled_binutils=0
305 + linux_use_bundled_gold=0" \
306 + "${PYTHON}" configure \
307 + --prefix="${EPREFIX}"/usr \
308 + --dest-cpu=${myarch} \
309 + --without-dtrace \
310 + "${myconf[@]}" || die
311 +}
312 +
313 +src_compile() {
314 + emake -C out mksnapshot
315 + pax-mark m "out/${BUILDTYPE}/mksnapshot"
316 + emake -C out
317 +}
318 +
319 +src_install() {
320 + local LIBDIR="${ED}/usr/$(get_libdir)"
321 + emake install DESTDIR="${D}"
322 + pax-mark -m "${ED}"usr/bin/node
323 +
324 + # set up a symlink structure that node-gyp expects..
325 + dodir /usr/include/node/deps/{v8,uv}
326 + dosym . /usr/include/node/src
327 + for var in deps/{uv,v8}/include; do
328 + dosym ../.. /usr/include/node/${var}
329 + done
330 +
331 + if use doc; then
332 + # Patch docs to make them offline readable
333 + for i in `grep -rl 'fonts.googleapis.com' "${S}"/out/doc/api/*`; do
334 + sed -i '/fonts.googleapis.com/ d' $i;
335 + done
336 + # Install docs!
337 + dohtml -r "${S}"/doc/*
338 + fi
339 +
340 + if use npm; then
341 + dodir /etc/npm
342 +
343 + # Install bash completion for `npm`
344 + # We need to temporarily replace default config path since
345 + # npm otherwise tries to write outside of the sandbox
346 + local npm_config="usr/$(get_libdir)/node_modules/npm/lib/config/core.js"
347 + sed -i -e "s|'/etc'|'${ED}/etc'|g" "${ED}/${npm_config}" || die
348 + local tmp_npm_completion_file="$(emktemp)"
349 + "${ED}/usr/bin/npm" completion > "${tmp_npm_completion_file}"
350 + newbashcomp "${tmp_npm_completion_file}" npm
351 + sed -i -e "s|'${ED}/etc'|'/etc'|g" "${ED}/${npm_config}" || die
352 +
353 + # Move man pages
354 + doman "${LIBDIR}"/node_modules/npm/man/man{1,5,7}/*
355 +
356 + # Clean up
357 + rm "${LIBDIR}"/node_modules/npm/{.mailmap,.npmignore,Makefile} || die
358 + rm -rf "${LIBDIR}"/node_modules/npm/{doc,html,man} || die
359 +
360 + local find_exp="-or -name"
361 + local find_name=()
362 + for match in "AUTHORS*" "CHANGELOG*" "CONTRIBUT*" "README*" \
363 + ".travis.yml" ".eslint*" ".wercker.yml" ".npmignore" \
364 + "*.md" "*.markdown" "*.bat" "*.cmd"; do
365 + find_name+=( ${find_exp} "${match}" )
366 + done
367 +
368 + # Remove various development and/or inappropriate files and
369 + # useless docs of dependend packages.
370 + find "${LIBDIR}"/node_modules \
371 + \( -type d -name examples \) -or \( -type f \( \
372 + -iname "LICEN?E*" \
373 + "${find_name[@]}" \
374 + \) \) -exec rm -rf "{}" \;
375 + fi
376 +}
377 +
378 +src_test() {
379 + out/${BUILDTYPE}/cctest || die
380 + "${PYTHON}" tools/test.py --mode=${BUILDTYPE,,} -J message parallel sequential || die
381 +}
382 +
383 +pkg_postinst() {
384 + einfo "The global npm config lives in /etc/npm. This deviates slightly"
385 + einfo "from upstream which otherwise would have it live in /usr/etc/."
386 + einfo ""
387 + einfo "Protip: When using node-gyp to install native modules, you can"
388 + einfo "avoid having to download extras by doing the following:"
389 + einfo "$ node-gyp --nodedir /usr/include/node <command>"
390 +}
391
392 diff --git a/net-libs/nodejs/nodejs-8.9.4.ebuild b/net-libs/nodejs/nodejs-8.9.4.ebuild
393 new file mode 100644
394 index 00000000000..8adc5609710
395 --- /dev/null
396 +++ b/net-libs/nodejs/nodejs-8.9.4.ebuild
397 @@ -0,0 +1,201 @@
398 +# Copyright 1999-2018 Gentoo Foundation
399 +# Distributed under the terms of the GNU General Public License v2
400 +
401 +EAPI=6
402 +RESTRICT="test"
403 +
404 +PYTHON_COMPAT=( python2_7 )
405 +PYTHON_REQ_USE="threads"
406 +
407 +inherit bash-completion-r1 eutils flag-o-matic pax-utils python-single-r1 toolchain-funcs
408 +
409 +DESCRIPTION="A JavaScript runtime built on Chrome's V8 JavaScript engine"
410 +HOMEPAGE="https://nodejs.org/"
411 +SRC_URI="https://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz"
412 +
413 +LICENSE="Apache-1.1 Apache-2.0 BSD BSD-2 MIT"
414 +SLOT="0"
415 +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x64-macos"
416 +IUSE="cpu_flags_x86_sse2 debug doc icu inspector +npm +snapshot +ssl systemtap test"
417 +REQUIRED_USE="
418 + ${PYTHON_REQUIRED_USE}
419 + inspector? ( icu ssl )
420 +"
421 +
422 +RDEPEND="
423 + >=dev-libs/libuv-1.15.0:=
424 + >=net-libs/http-parser-2.7.0:=
425 + >=net-libs/nghttp2-1.25.0
426 + sys-libs/zlib
427 + icu? ( >=dev-libs/icu-59.1:= )
428 + ssl? ( >=dev-libs/openssl-1.0.2n:0=[-bindist] )
429 +"
430 +DEPEND="${RDEPEND}
431 + ${PYTHON_DEPS}
432 + systemtap? ( dev-util/systemtap )
433 + test? ( net-misc/curl )"
434 +
435 +S="${WORKDIR}/node-v${PV}"
436 +
437 +PATCHES=(
438 + "${FILESDIR}"/gentoo-global-npm-config.patch
439 +)
440 +
441 +pkg_pretend() {
442 + (use x86 && ! use cpu_flags_x86_sse2) && \
443 + die "Your CPU doesn't support the required SSE2 instruction."
444 +
445 + ( [[ ${MERGE_TYPE} != "binary" ]] && ! test-flag-CXX -std=c++11 ) && \
446 + die "Your compiler doesn't support C++11. Use GCC 4.8, Clang 3.3 or newer."
447 +}
448 +
449 +src_prepare() {
450 + tc-export CC CXX PKG_CONFIG
451 + export V=1
452 + export BUILDTYPE=Release
453 +
454 + # fix compilation on Darwin
455 + # https://code.google.com/p/gyp/issues/detail?id=260
456 + sed -i -e "/append('-arch/d" tools/gyp/pylib/gyp/xcode_emulation.py || die
457 +
458 + # make sure we use python2.* while using gyp
459 + sed -i -e "s/python/${EPYTHON}/" deps/npm/node_modules/node-gyp/gyp/gyp || die
460 + sed -i -e "s/|| 'python2'/|| '${EPYTHON}'/" deps/npm/node_modules/node-gyp/lib/configure.js || die
461 +
462 + # less verbose install output (stating the same as portage, basically)
463 + sed -i -e "/print/d" tools/install.py || die
464 +
465 + # proper libdir, hat tip @ryanpcmcquen https://github.com/iojs/io.js/issues/504
466 + local LIBDIR=$(get_libdir)
467 + sed -i -e "s|lib/|${LIBDIR}/|g" tools/install.py || die
468 + sed -i -e "s/'lib'/'${LIBDIR}'/" lib/module.js deps/npm/lib/npm.js || die
469 +
470 + # Avoid writing a depfile, not useful
471 + sed -i -e "/DEPFLAGS =/d" tools/gyp/pylib/gyp/generator/make.py || die
472 +
473 + sed -i -e "/'-O3'/d" common.gypi deps/v8/gypfiles/toolchain.gypi || die
474 +
475 + # Avoid a test that I've only been able to reproduce from emerge. It doesnt
476 + # seem sandbox related either (invoking it from a sandbox works fine).
477 + # The issue is that no stdin handle is openened when asked for one.
478 + # It doesn't really belong upstream , so it'll just be removed until someone
479 + # with more gentoo-knowledge than me (jbergstroem) figures it out.
480 + rm test/parallel/test-stdout-close-unref.js || die
481 +
482 + # debug builds. change install path, remove optimisations and override buildtype
483 + if use debug; then
484 + sed -i -e "s|out/Release/|out/Debug/|g" tools/install.py || die
485 + BUILDTYPE=Debug
486 + fi
487 +
488 + default
489 +}
490 +
491 +src_configure() {
492 + local myconf=( --shared-http-parser --shared-libuv --shared-nghttp2 --shared-zlib )
493 + use debug && myconf+=( --debug )
494 + use icu && myconf+=( --with-intl=system-icu ) || myconf+=( --with-intl=none )
495 + use inspector || myconf+=( --without-inspector )
496 + use npm || myconf+=( --without-npm )
497 + use snapshot && myconf+=( --with-snapshot )
498 + use ssl && myconf+=( --shared-openssl ) || myconf+=( --without-ssl )
499 +
500 + local myarch=""
501 + case ${ABI} in
502 + amd64) myarch="x64";;
503 + arm) myarch="arm";;
504 + arm64) myarch="arm64";;
505 + ppc64) myarch="ppc64";;
506 + x32) myarch="x32";;
507 + x86) myarch="ia32";;
508 + *) myarch="${ABI}";;
509 + esac
510 +
511 + GYP_DEFINES="linux_use_gold_flags=0
512 + linux_use_bundled_binutils=0
513 + linux_use_bundled_gold=0" \
514 + "${PYTHON}" configure \
515 + --prefix="${EPREFIX}"/usr \
516 + --dest-cpu=${myarch} \
517 + $(use_with systemtap dtrace) \
518 + "${myconf[@]}" || die
519 +}
520 +
521 +src_compile() {
522 + emake -C out mksnapshot
523 + pax-mark m "out/${BUILDTYPE}/mksnapshot"
524 + emake -C out
525 +}
526 +
527 +src_install() {
528 + local LIBDIR="${ED}/usr/$(get_libdir)"
529 + emake install DESTDIR="${D}"
530 + pax-mark -m "${ED}"usr/bin/node
531 +
532 + # set up a symlink structure that node-gyp expects..
533 + dodir /usr/include/node/deps/{v8,uv}
534 + dosym . /usr/include/node/src
535 + for var in deps/{uv,v8}/include; do
536 + dosym ../.. /usr/include/node/${var}
537 + done
538 +
539 + if use doc; then
540 + # Patch docs to make them offline readable
541 + for i in `grep -rl 'fonts.googleapis.com' "${S}"/out/doc/api/*`; do
542 + sed -i '/fonts.googleapis.com/ d' $i;
543 + done
544 + # Install docs!
545 + dohtml -r "${S}"/doc/*
546 + fi
547 +
548 + if use npm; then
549 + dodir /etc/npm
550 +
551 + # Install bash completion for `npm`
552 + # We need to temporarily replace default config path since
553 + # npm otherwise tries to write outside of the sandbox
554 + local npm_config="usr/$(get_libdir)/node_modules/npm/lib/config/core.js"
555 + sed -i -e "s|'/etc'|'${ED}/etc'|g" "${ED}/${npm_config}" || die
556 + local tmp_npm_completion_file="$(emktemp)"
557 + "${ED}/usr/bin/npm" completion > "${tmp_npm_completion_file}"
558 + newbashcomp "${tmp_npm_completion_file}" npm
559 + sed -i -e "s|'${ED}/etc'|'/etc'|g" "${ED}/${npm_config}" || die
560 +
561 + # Move man pages
562 + doman "${LIBDIR}"/node_modules/npm/man/man{1,5,7}/*
563 +
564 + # Clean up
565 + rm "${LIBDIR}"/node_modules/npm/{.mailmap,.npmignore,Makefile} || die
566 + rm -rf "${LIBDIR}"/node_modules/npm/{doc,html,man} || die
567 +
568 + local find_exp="-or -name"
569 + local find_name=()
570 + for match in "AUTHORS*" "CHANGELOG*" "CONTRIBUT*" "README*" \
571 + ".travis.yml" ".eslint*" ".wercker.yml" ".npmignore" \
572 + "*.md" "*.markdown" "*.bat" "*.cmd"; do
573 + find_name+=( ${find_exp} "${match}" )
574 + done
575 +
576 + # Remove various development and/or inappropriate files and
577 + # useless docs of dependend packages.
578 + find "${LIBDIR}"/node_modules \
579 + \( -type d -name examples \) -or \( -type f \( \
580 + -iname "LICEN?E*" \
581 + "${find_name[@]}" \
582 + \) \) -exec rm -rf "{}" \;
583 + fi
584 +}
585 +
586 +src_test() {
587 + out/${BUILDTYPE}/cctest || die
588 + "${PYTHON}" tools/test.py --mode=${BUILDTYPE,,} -J message parallel sequential || die
589 +}
590 +
591 +pkg_postinst() {
592 + einfo "The global npm config lives in /etc/npm. This deviates slightly"
593 + einfo "from upstream which otherwise would have it live in /usr/etc/."
594 + einfo ""
595 + einfo "Protip: When using node-gyp to install native modules, you can"
596 + einfo "avoid having to download extras by doing the following:"
597 + einfo "$ node-gyp --nodedir /usr/include/node <command>"
598 +}