1 |
commit: 224ae61f77174ca30c1424737cdacd821c623789 |
2 |
Author: Jeroen Roovers <jer <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Sep 16 07:39:36 2020 +0000 |
4 |
Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Sep 16 07:40:17 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=224ae61f |
7 |
|
8 |
net-libs/nodejs: Versions 10.19.0 10.22.1 |
9 |
|
10 |
Package-Manager: Portage-3.0.7, Repoman-3.0.1 |
11 |
RepoMan-Options: --force |
12 |
Bug: https://bugs.gentoo.org/742893 |
13 |
Closes: https://bugs.gentoo.org/739340 |
14 |
Signed-off-by: Jeroen Roovers <jer <AT> gentoo.org> |
15 |
|
16 |
net-libs/nodejs/Manifest | 2 + |
17 |
net-libs/nodejs/nodejs-10.19.0.ebuild | 205 ++++++++++++++++++++++++++++++++++ |
18 |
net-libs/nodejs/nodejs-10.22.1.ebuild | 205 ++++++++++++++++++++++++++++++++++ |
19 |
3 files changed, 412 insertions(+) |
20 |
|
21 |
diff --git a/net-libs/nodejs/Manifest b/net-libs/nodejs/Manifest |
22 |
index 840184ab69b..1035af43b85 100644 |
23 |
--- a/net-libs/nodejs/Manifest |
24 |
+++ b/net-libs/nodejs/Manifest |
25 |
@@ -1,3 +1,5 @@ |
26 |
+DIST node-v10.19.0.tar.xz 21906168 BLAKE2B 395504ef3befa47d8b967114e019e6a76c799871e7eb21e2c6c0453655ffa07f17f42209daddeb5417342cfbad71ba1a35ae15a2d210b692bc60be270c2fc415 SHA512 512efc58415ed789938c434af131d76bdd51772cac9f7e380afaa79d83cc9c433a979068fc7272adba6ba6551d195267978e1fc819236926b0d1fd6cf91c5eee |
27 |
+DIST node-v10.22.1.tar.xz 21864488 BLAKE2B c57480c4bf0ac9ab3c847be970a07c8d2212fef92eb6a83c5b5cfa6a2d7a19566a6f11cfe4da4c6949c214693ec3e49920d9f267e92a0cc6fc01d7ef816ed2af SHA512 99f607f872cb3e94ca3ebde302c8db52886e0a6a252c876b8d51ed3dfd00bfd9bf7edce4036a56fa27a72f3ffa497a7052416e5d2d24df825673f339d9ddc675 |
28 |
DIST node-v12.16.1.tar.xz 23481768 BLAKE2B 29371b952c14907778c064269108f1da5e3818c32773e73090c61edcd07190c418189db6a505987ca71f99bb868880e297de5d2181b9a880774eaaf515985f26 SHA512 fe1e9fabb6fe52e3bc4275b33e6c5e4a761550b04964c0ae7dbef7172f5d415207bb2985751d068e357ce45a0ba414b07c0abd1531ef839b9463e98eeae8f9a4 |
29 |
DIST node-v12.18.3.tar.xz 23679596 BLAKE2B 496a8fa0f0368634a900c5961b442cb9ef9e0cf7cb0fc974a9e29624fc40077a61bd6371851d5487b9eeeb50ebf6a238e5db5c801fef000c7cb15bd990cadae2 SHA512 a1c72d4664fbead4e63736abe46417b13dcd0581c7c9f8a94ca5c5b2bd782fefabac63e63f824dda6a771c3b5e647749e3156a611dcb100aad11c3f23e17ed5d |
30 |
DIST node-v12.18.4.tar.xz 23679924 BLAKE2B 14de3c83851b89f85f7d6f549d9e43e3e97c7a84de94eef8c3a2789e960595749726b8039fdff1be822377355ede2bb95bba4fd1d17c3e5165c844a80eb32e53 SHA512 07101a9acc8dee5189f8484746715b57d4227d819e38a79c100da33f803b0f061e7b37fbd4114ce2bc3eea647726f8786880d3096dfab187c177679f3e1c78e8 |
31 |
|
32 |
diff --git a/net-libs/nodejs/nodejs-10.19.0.ebuild b/net-libs/nodejs/nodejs-10.19.0.ebuild |
33 |
new file mode 100644 |
34 |
index 00000000000..409bd25dff5 |
35 |
--- /dev/null |
36 |
+++ b/net-libs/nodejs/nodejs-10.19.0.ebuild |
37 |
@@ -0,0 +1,205 @@ |
38 |
+# Copyright 1999-2020 Gentoo Authors |
39 |
+# Distributed under the terms of the GNU General Public License v2 |
40 |
+ |
41 |
+EAPI=7 |
42 |
+PYTHON_COMPAT=( python2_7 ) |
43 |
+PYTHON_REQ_USE="threads" |
44 |
+inherit bash-completion-r1 eutils flag-o-matic pax-utils python-any-r1 toolchain-funcs xdg-utils |
45 |
+ |
46 |
+DESCRIPTION="A JavaScript runtime built on Chrome's V8 JavaScript engine" |
47 |
+HOMEPAGE="https://nodejs.org/" |
48 |
+SRC_URI="https://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz" |
49 |
+ |
50 |
+LICENSE="Apache-1.1 Apache-2.0 BSD BSD-2 MIT" |
51 |
+SLOT="0" |
52 |
+KEYWORDS="amd64 arm arm64 ~ppc ~ppc64 x86 ~amd64-linux ~x64-macos" |
53 |
+IUSE="cpu_flags_x86_sse2 debug doc icu inspector +npm +snapshot +ssl +system-ssl systemtap test" |
54 |
+REQUIRED_USE=" |
55 |
+ inspector? ( icu ssl ) |
56 |
+ npm? ( ssl ) |
57 |
+ system-ssl? ( ssl ) |
58 |
+" |
59 |
+ |
60 |
+RDEPEND=" |
61 |
+ >=dev-libs/libuv-1.28.0:= |
62 |
+ >=net-dns/c-ares-1.15.0 |
63 |
+ >=net-libs/http-parser-2.9.3:= |
64 |
+ >=net-libs/nghttp2-1.39.2 |
65 |
+ sys-libs/zlib |
66 |
+ icu? ( >=dev-libs/icu-64.2:= ) |
67 |
+ system-ssl? ( >=dev-libs/openssl-1.1.1:0= ) |
68 |
+" |
69 |
+DEPEND=" |
70 |
+ ${RDEPEND} |
71 |
+ ${PYTHON_DEPS} |
72 |
+ systemtap? ( dev-util/systemtap ) |
73 |
+ test? ( net-misc/curl ) |
74 |
+" |
75 |
+PATCHES=( |
76 |
+ "${FILESDIR}"/${PN}-10.3.0-global-npm-config.patch |
77 |
+) |
78 |
+RESTRICT="test" |
79 |
+S="${WORKDIR}/node-v${PV}" |
80 |
+ |
81 |
+pkg_pretend() { |
82 |
+ (use x86 && ! use cpu_flags_x86_sse2) && \ |
83 |
+ die "Your CPU doesn't support the required SSE2 instruction." |
84 |
+ |
85 |
+ ( [[ ${MERGE_TYPE} != "binary" ]] && ! test-flag-CXX -std=c++11 ) && \ |
86 |
+ die "Your compiler doesn't support C++11. Use GCC 4.8, Clang 3.3 or newer." |
87 |
+} |
88 |
+ |
89 |
+src_prepare() { |
90 |
+ tc-export CC CXX PKG_CONFIG |
91 |
+ export V=1 |
92 |
+ export BUILDTYPE=Release |
93 |
+ |
94 |
+ # fix compilation on Darwin |
95 |
+ # https://code.google.com/p/gyp/issues/detail?id=260 |
96 |
+ sed -i -e "/append('-arch/d" tools/gyp/pylib/gyp/xcode_emulation.py || die |
97 |
+ |
98 |
+ # make sure we use python2.* while using gyp |
99 |
+ sed -i -e "s/python/${EPYTHON}/" deps/npm/node_modules/node-gyp/gyp/gyp || die |
100 |
+ sed -i -e "s/|| 'python2'/|| '${EPYTHON}'/" deps/npm/node_modules/node-gyp/lib/configure.js || die |
101 |
+ |
102 |
+ # less verbose install output (stating the same as portage, basically) |
103 |
+ sed -i -e "/print/d" tools/install.py || die |
104 |
+ |
105 |
+ # proper libdir, hat tip @ryanpcmcquen https://github.com/iojs/io.js/issues/504 |
106 |
+ local LIBDIR=$(get_libdir) |
107 |
+ sed -i -e "s|lib/|${LIBDIR}/|g" tools/install.py || die |
108 |
+ sed -i -e "s/'lib'/'${LIBDIR}'/" deps/npm/lib/npm.js || die |
109 |
+ |
110 |
+ # Avoid writing a depfile, not useful |
111 |
+ sed -i -e "/DEPFLAGS =/d" tools/gyp/pylib/gyp/generator/make.py || die |
112 |
+ |
113 |
+ sed -i -e "/'-O3'/d" common.gypi deps/v8/gypfiles/toolchain.gypi || die |
114 |
+ |
115 |
+ # Avoid a test that I've only been able to reproduce from emerge. It doesnt |
116 |
+ # seem sandbox related either (invoking it from a sandbox works fine). |
117 |
+ # The issue is that no stdin handle is openened when asked for one. |
118 |
+ # It doesn't really belong upstream , so it'll just be removed until someone |
119 |
+ # with more gentoo-knowledge than me (jbergstroem) figures it out. |
120 |
+ rm test/parallel/test-stdout-close-unref.js || die |
121 |
+ |
122 |
+ # debug builds. change install path, remove optimisations and override buildtype |
123 |
+ if use debug; then |
124 |
+ sed -i -e "s|out/Release/|out/Debug/|g" tools/install.py || die |
125 |
+ BUILDTYPE=Debug |
126 |
+ fi |
127 |
+ |
128 |
+ default |
129 |
+} |
130 |
+ |
131 |
+src_configure() { |
132 |
+ xdg_environment_reset |
133 |
+ |
134 |
+ local myconf=( --shared-cares --shared-http-parser --shared-libuv --shared-nghttp2 --shared-zlib ) |
135 |
+ use debug && myconf+=( --debug ) |
136 |
+ use icu && myconf+=( --with-intl=system-icu ) || myconf+=( --with-intl=none ) |
137 |
+ use inspector || myconf+=( --without-inspector ) |
138 |
+ use npm || myconf+=( --without-npm ) |
139 |
+ use snapshot && myconf+=( --with-snapshot ) |
140 |
+ if use ssl; then |
141 |
+ use system-ssl && myconf+=( --shared-openssl ) |
142 |
+ else |
143 |
+ myconf+=( --without-ssl ) |
144 |
+ fi |
145 |
+ |
146 |
+ local myarch="" |
147 |
+ case ${ABI} in |
148 |
+ amd64) myarch="x64";; |
149 |
+ arm) myarch="arm";; |
150 |
+ arm64) myarch="arm64";; |
151 |
+ ppc64) myarch="ppc64";; |
152 |
+ x32) myarch="x32";; |
153 |
+ x86) myarch="ia32";; |
154 |
+ *) myarch="${ABI}";; |
155 |
+ esac |
156 |
+ |
157 |
+ GYP_DEFINES="linux_use_gold_flags=0 |
158 |
+ linux_use_bundled_binutils=0 |
159 |
+ linux_use_bundled_gold=0" \ |
160 |
+ "${PYTHON}" configure \ |
161 |
+ --prefix="${EPREFIX}"/usr \ |
162 |
+ --dest-cpu=${myarch} \ |
163 |
+ $(use_with systemtap dtrace) \ |
164 |
+ "${myconf[@]}" || die |
165 |
+} |
166 |
+ |
167 |
+src_compile() { |
168 |
+ emake -C out mksnapshot |
169 |
+ pax-mark m "out/${BUILDTYPE}/mksnapshot" |
170 |
+ emake -C out |
171 |
+} |
172 |
+ |
173 |
+src_install() { |
174 |
+ local LIBDIR="${ED}/usr/$(get_libdir)" |
175 |
+ emake install DESTDIR="${D}" |
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 "${D}"/usr/share/doc/node "${D}"/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 |
+ einfo "The global npm config lives in /etc/npm. This deviates slightly" |
237 |
+ einfo "from upstream which otherwise would have it live in /usr/etc/." |
238 |
+ einfo "" |
239 |
+ einfo "Protip: When using node-gyp to install native modules, you can" |
240 |
+ einfo "avoid having to download extras by doing the following:" |
241 |
+ einfo "$ node-gyp --nodedir /usr/include/node <command>" |
242 |
+} |
243 |
|
244 |
diff --git a/net-libs/nodejs/nodejs-10.22.1.ebuild b/net-libs/nodejs/nodejs-10.22.1.ebuild |
245 |
new file mode 100644 |
246 |
index 00000000000..81b76b0a529 |
247 |
--- /dev/null |
248 |
+++ b/net-libs/nodejs/nodejs-10.22.1.ebuild |
249 |
@@ -0,0 +1,205 @@ |
250 |
+# Copyright 1999-2020 Gentoo Authors |
251 |
+# Distributed under the terms of the GNU General Public License v2 |
252 |
+ |
253 |
+EAPI=7 |
254 |
+PYTHON_COMPAT=( python2_7 ) |
255 |
+PYTHON_REQ_USE="threads" |
256 |
+inherit bash-completion-r1 eutils flag-o-matic pax-utils python-any-r1 toolchain-funcs xdg-utils |
257 |
+ |
258 |
+DESCRIPTION="A JavaScript runtime built on Chrome's V8 JavaScript engine" |
259 |
+HOMEPAGE="https://nodejs.org/" |
260 |
+SRC_URI="https://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz" |
261 |
+ |
262 |
+LICENSE="Apache-1.1 Apache-2.0 BSD BSD-2 MIT" |
263 |
+SLOT="0" |
264 |
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x64-macos" |
265 |
+IUSE="cpu_flags_x86_sse2 debug doc icu inspector +npm +snapshot +ssl +system-ssl systemtap test" |
266 |
+REQUIRED_USE=" |
267 |
+ inspector? ( icu ssl ) |
268 |
+ npm? ( ssl ) |
269 |
+ system-ssl? ( ssl ) |
270 |
+" |
271 |
+ |
272 |
+RDEPEND=" |
273 |
+ >=dev-libs/libuv-1.39.0:= |
274 |
+ >=net-dns/c-ares-1.15.0 |
275 |
+ >=net-libs/http-parser-2.9.3:= |
276 |
+ >=net-libs/nghttp2-1.41.0 |
277 |
+ sys-libs/zlib |
278 |
+ icu? ( >=dev-libs/icu-64.2:= ) |
279 |
+ system-ssl? ( >=dev-libs/openssl-1.1.1:0= ) |
280 |
+" |
281 |
+DEPEND=" |
282 |
+ ${RDEPEND} |
283 |
+ ${PYTHON_DEPS} |
284 |
+ systemtap? ( dev-util/systemtap ) |
285 |
+ test? ( net-misc/curl ) |
286 |
+" |
287 |
+PATCHES=( |
288 |
+ "${FILESDIR}"/${PN}-10.3.0-global-npm-config.patch |
289 |
+) |
290 |
+RESTRICT="test" |
291 |
+S="${WORKDIR}/node-v${PV}" |
292 |
+ |
293 |
+pkg_pretend() { |
294 |
+ (use x86 && ! use cpu_flags_x86_sse2) && \ |
295 |
+ die "Your CPU doesn't support the required SSE2 instruction." |
296 |
+ |
297 |
+ ( [[ ${MERGE_TYPE} != "binary" ]] && ! test-flag-CXX -std=c++11 ) && \ |
298 |
+ die "Your compiler doesn't support C++11. Use GCC 4.8, Clang 3.3 or newer." |
299 |
+} |
300 |
+ |
301 |
+src_prepare() { |
302 |
+ tc-export CC CXX PKG_CONFIG |
303 |
+ export V=1 |
304 |
+ export BUILDTYPE=Release |
305 |
+ |
306 |
+ # fix compilation on Darwin |
307 |
+ # https://code.google.com/p/gyp/issues/detail?id=260 |
308 |
+ sed -i -e "/append('-arch/d" tools/gyp/pylib/gyp/xcode_emulation.py || die |
309 |
+ |
310 |
+ # make sure we use python2.* while using gyp |
311 |
+ sed -i -e "s/python/${EPYTHON}/" deps/npm/node_modules/node-gyp/gyp/gyp || die |
312 |
+ sed -i -e "s/|| 'python2'/|| '${EPYTHON}'/" deps/npm/node_modules/node-gyp/lib/configure.js || die |
313 |
+ |
314 |
+ # less verbose install output (stating the same as portage, basically) |
315 |
+ sed -i -e "/print/d" tools/install.py || die |
316 |
+ |
317 |
+ # proper libdir, hat tip @ryanpcmcquen https://github.com/iojs/io.js/issues/504 |
318 |
+ local LIBDIR=$(get_libdir) |
319 |
+ sed -i -e "s|lib/|${LIBDIR}/|g" tools/install.py || die |
320 |
+ sed -i -e "s/'lib'/'${LIBDIR}'/" deps/npm/lib/npm.js || die |
321 |
+ |
322 |
+ # Avoid writing a depfile, not useful |
323 |
+ sed -i -e "/DEPFLAGS =/d" tools/gyp/pylib/gyp/generator/make.py || die |
324 |
+ |
325 |
+ sed -i -e "/'-O3'/d" common.gypi deps/v8/gypfiles/toolchain.gypi || die |
326 |
+ |
327 |
+ # Avoid a test that I've only been able to reproduce from emerge. It doesnt |
328 |
+ # seem sandbox related either (invoking it from a sandbox works fine). |
329 |
+ # The issue is that no stdin handle is openened when asked for one. |
330 |
+ # It doesn't really belong upstream , so it'll just be removed until someone |
331 |
+ # with more gentoo-knowledge than me (jbergstroem) figures it out. |
332 |
+ rm test/parallel/test-stdout-close-unref.js || die |
333 |
+ |
334 |
+ # debug builds. change install path, remove optimisations and override buildtype |
335 |
+ if use debug; then |
336 |
+ sed -i -e "s|out/Release/|out/Debug/|g" tools/install.py || die |
337 |
+ BUILDTYPE=Debug |
338 |
+ fi |
339 |
+ |
340 |
+ default |
341 |
+} |
342 |
+ |
343 |
+src_configure() { |
344 |
+ xdg_environment_reset |
345 |
+ |
346 |
+ local myconf=( --shared-cares --shared-http-parser --shared-libuv --shared-nghttp2 --shared-zlib ) |
347 |
+ use debug && myconf+=( --debug ) |
348 |
+ use icu && myconf+=( --with-intl=system-icu ) || myconf+=( --with-intl=none ) |
349 |
+ use inspector || myconf+=( --without-inspector ) |
350 |
+ use npm || myconf+=( --without-npm ) |
351 |
+ use snapshot && myconf+=( --with-snapshot ) |
352 |
+ if use ssl; then |
353 |
+ use system-ssl && myconf+=( --shared-openssl ) |
354 |
+ else |
355 |
+ myconf+=( --without-ssl ) |
356 |
+ fi |
357 |
+ |
358 |
+ local myarch="" |
359 |
+ case ${ABI} in |
360 |
+ amd64) myarch="x64";; |
361 |
+ arm) myarch="arm";; |
362 |
+ arm64) myarch="arm64";; |
363 |
+ ppc64) myarch="ppc64";; |
364 |
+ x32) myarch="x32";; |
365 |
+ x86) myarch="ia32";; |
366 |
+ *) myarch="${ABI}";; |
367 |
+ esac |
368 |
+ |
369 |
+ GYP_DEFINES="linux_use_gold_flags=0 |
370 |
+ linux_use_bundled_binutils=0 |
371 |
+ linux_use_bundled_gold=0" \ |
372 |
+ "${PYTHON}" configure \ |
373 |
+ --prefix="${EPREFIX}"/usr \ |
374 |
+ --dest-cpu=${myarch} \ |
375 |
+ $(use_with systemtap dtrace) \ |
376 |
+ "${myconf[@]}" || die |
377 |
+} |
378 |
+ |
379 |
+src_compile() { |
380 |
+ emake -C out mksnapshot |
381 |
+ pax-mark m "out/${BUILDTYPE}/mksnapshot" |
382 |
+ emake -C out |
383 |
+} |
384 |
+ |
385 |
+src_install() { |
386 |
+ local LIBDIR="${ED}/usr/$(get_libdir)" |
387 |
+ emake install DESTDIR="${D}" |
388 |
+ pax-mark -m "${ED}"/usr/bin/node |
389 |
+ |
390 |
+ # set up a symlink structure that node-gyp expects.. |
391 |
+ dodir /usr/include/node/deps/{v8,uv} |
392 |
+ dosym . /usr/include/node/src |
393 |
+ for var in deps/{uv,v8}/include; do |
394 |
+ dosym ../.. /usr/include/node/${var} |
395 |
+ done |
396 |
+ |
397 |
+ if use doc; then |
398 |
+ docinto html |
399 |
+ dodoc -r "${S}"/doc/* |
400 |
+ fi |
401 |
+ |
402 |
+ if use npm; then |
403 |
+ dodir /etc/npm |
404 |
+ |
405 |
+ # Install bash completion for `npm` |
406 |
+ # We need to temporarily replace default config path since |
407 |
+ # npm otherwise tries to write outside of the sandbox |
408 |
+ local npm_config="usr/$(get_libdir)/node_modules/npm/lib/config/core.js" |
409 |
+ sed -i -e "s|'/etc'|'${ED}/etc'|g" "${ED}/${npm_config}" || die |
410 |
+ local tmp_npm_completion_file="$(emktemp)" |
411 |
+ "${ED}/usr/bin/npm" completion > "${tmp_npm_completion_file}" |
412 |
+ newbashcomp "${tmp_npm_completion_file}" npm |
413 |
+ sed -i -e "s|'${ED}/etc'|'/etc'|g" "${ED}/${npm_config}" || die |
414 |
+ |
415 |
+ # Move man pages |
416 |
+ doman "${LIBDIR}"/node_modules/npm/man/man{1,5,7}/* |
417 |
+ |
418 |
+ # Clean up |
419 |
+ rm "${LIBDIR}"/node_modules/npm/{.mailmap,.npmignore,Makefile} || die |
420 |
+ rm -rf "${LIBDIR}"/node_modules/npm/{doc,html,man} || die |
421 |
+ |
422 |
+ local find_exp="-or -name" |
423 |
+ local find_name=() |
424 |
+ for match in "AUTHORS*" "CHANGELOG*" "CONTRIBUT*" "README*" \ |
425 |
+ ".travis.yml" ".eslint*" ".wercker.yml" ".npmignore" \ |
426 |
+ "*.md" "*.markdown" "*.bat" "*.cmd"; do |
427 |
+ find_name+=( ${find_exp} "${match}" ) |
428 |
+ done |
429 |
+ |
430 |
+ # Remove various development and/or inappropriate files and |
431 |
+ # useless docs of dependend packages. |
432 |
+ find "${LIBDIR}"/node_modules \ |
433 |
+ \( -type d -name examples \) -or \( -type f \( \ |
434 |
+ -iname "LICEN?E*" \ |
435 |
+ "${find_name[@]}" \ |
436 |
+ \) \) -exec rm -rf "{}" \; |
437 |
+ fi |
438 |
+ |
439 |
+ mv "${D}"/usr/share/doc/node "${D}"/usr/share/doc/${PF} || die |
440 |
+} |
441 |
+ |
442 |
+src_test() { |
443 |
+ out/${BUILDTYPE}/cctest || die |
444 |
+ "${PYTHON}" tools/test.py --mode=${BUILDTYPE,,} -J message parallel sequential || die |
445 |
+} |
446 |
+ |
447 |
+pkg_postinst() { |
448 |
+ einfo "The global npm config lives in /etc/npm. This deviates slightly" |
449 |
+ einfo "from upstream which otherwise would have it live in /usr/etc/." |
450 |
+ einfo "" |
451 |
+ einfo "Protip: When using node-gyp to install native modules, you can" |
452 |
+ einfo "avoid having to download extras by doing the following:" |
453 |
+ einfo "$ node-gyp --nodedir /usr/include/node <command>" |
454 |
+} |