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, 30 Oct 2018 10:10:22
Message-Id: 1540894206.8ad71cc9595f5532f8fc9c1b439ad8c3e1e261f2.jer@gentoo
1 commit: 8ad71cc9595f5532f8fc9c1b439ad8c3e1e261f2
2 Author: Jeroen Roovers <jer <AT> gentoo <DOT> org>
3 AuthorDate: Tue Oct 30 10:09:16 2018 +0000
4 Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org>
5 CommitDate: Tue Oct 30 10:10:06 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8ad71cc9
7
8 net-libs/nodejs: Version 10.13.0
9
10 Package-Manager: Portage-2.3.51, Repoman-2.3.11
11 Signed-off-by: Jeroen Roovers <jer <AT> gentoo.org>
12
13 net-libs/nodejs/Manifest | 1 +
14 net-libs/nodejs/nodejs-10.13.0.ebuild | 205 ++++++++++++++++++++++++++++++++++
15 2 files changed, 206 insertions(+)
16
17 diff --git a/net-libs/nodejs/Manifest b/net-libs/nodejs/Manifest
18 index c0ce8936621..1f5fde7a9a1 100644
19 --- a/net-libs/nodejs/Manifest
20 +++ b/net-libs/nodejs/Manifest
21 @@ -2,6 +2,7 @@ DIST node-v0.12.18.tar.gz 19842591 BLAKE2B f94f4de6e2875267be194580c645087a262b9
22 DIST node-v10.10.0.tar.xz 19960760 BLAKE2B dc16e2afba4be727c5169ac5cd77324e0e8d7270c96da141da21a175cfbd64a38f7b51b86264396f3866174abc9095f7c840303208f7193739a1970818d4ff3a SHA512 482518a72cb0bdd5d987a7855856eadaa4fecea933ff7791918edf3097588246782d86b27568c06764ef9f2bca62b64a4d65e4cbd0e934931a72dc5719db7446
23 DIST node-v10.11.0.tar.xz 20144576 BLAKE2B 956d940554748f420589adab0f14bd6fcc6a4781cdecd537abd6eb9aa43e9cf754ef009b20d416f1ef4c9a01ef91a27a59a8c080c1c0a49a59388f75713d6286 SHA512 00a678a829de9b836e77dd0806799029b657cf000369ca653540d7e1b82c3895da43dbbfe4d3c2b3b2b1e711bf55b3835a351fad18affdd0c25dcceea8e3406c
24 DIST node-v10.12.0.tar.xz 20185168 BLAKE2B 1a827ed08222900ef196921a57d64466fc558412bb27a26759553686c69d59d8e6686394a484156d254a01030077b09c9abfec87a7716aee06dbe9937a861efd SHA512 3b59bbe7b795e7a85520f6b4691806d8939d26cc2a5e5d22e6406d3d373ee7758da225bd25b6f6b71b105e3d7ef4c58220bfa5e558afd0cd873fbd7d6ba9efc4
25 +DIST node-v10.13.0.tar.xz 20184740 BLAKE2B 4c063889341eb2aa128096466cfdc2c91631a760ec7dea3e06b30990252cf6575b96a6d61dd1ba467c8d134b75ee51c897d4ec5c8f60b64ba51d3bc4113df63c SHA512 90431414f45c858efd6ed6259916b778e29712b57bc758f12fa7d7fafe5073c85fc379e56c86795936515f4c4f772ac308d3f6d0569c46305a7d49dc55c884c8
26 DIST node-v10.9.0.tar.xz 19987812 BLAKE2B 4a5bd257cd527500b691b15d177bde53158b5e46e710ffeaa45224bae821cfaffdf59f24ad6bdc822cf468b90c1a4422a2f82d29e1d4b2dc0f838e3e0ab5b4ac SHA512 19c7366b4c9d1e255b5ac56e974ff86b9ca87c363534b467ecc3c59e170b891e86c479a2bcda6647c6df686b018caaedea84270e848b93a4f1c80ff04af12461
27 DIST node-v11.0.0.tar.xz 20142548 BLAKE2B 97fc14392c449abde0c2b4ef27f020ac215747a5cca327b07ed735dd9867a01f1a64bfa19a62758111b0fbdca92b5536c15d7946bf968b5c3eab9c0b55f7dd26 SHA512 232243f37a8344775b2e0302601ec23310a8915e0913dc0cb0133df75cb7aad315ca0a6d039f8f9e6ae0d9f98aa8049532d80d470cf9ea0e309f8183be870000
28 DIST node-v4.8.7.tar.xz 13370828 BLAKE2B b1ee93a586b66f8582783b1be50667547afe4bf48038ebc0b8148db55542cbc0520ac84ef88e4a7f453cabc245f484c32dbc238c1932bbc708791ceeb5c9d2ab SHA512 25837a31023747723b146c45984a5b2096b61c0aa43cbf45fc8ff50b4bd5079bd0bc9f1dfd3fb076817448dc5537eb93ffb2f345280b7756ba93b67ad757c696
29
30 diff --git a/net-libs/nodejs/nodejs-10.13.0.ebuild b/net-libs/nodejs/nodejs-10.13.0.ebuild
31 new file mode 100644
32 index 00000000000..763d9f78f28
33 --- /dev/null
34 +++ b/net-libs/nodejs/nodejs-10.13.0.ebuild
35 @@ -0,0 +1,205 @@
36 +# Copyright 1999-2018 Gentoo Authors
37 +# Distributed under the terms of the GNU General Public License v2
38 +
39 +EAPI=6
40 +
41 +PYTHON_COMPAT=( python2_7 )
42 +PYTHON_REQ_USE="threads"
43 +
44 +inherit bash-completion-r1 eutils flag-o-matic pax-utils python-single-r1 toolchain-funcs
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 systemtap test"
54 +REQUIRED_USE="
55 + ${PYTHON_REQUIRED_USE}
56 + inspector? ( icu ssl )
57 + npm? ( ssl )
58 +"
59 +
60 +RDEPEND="
61 + >=dev-libs/libuv-1.23.2:=
62 + >=net-dns/c-ares-1.14.0
63 + >=net-libs/http-parser-2.8.0:=
64 + >=net-libs/nghttp2-1.34.0
65 + sys-libs/zlib
66 + icu? ( >=dev-libs/icu-62.1:= )
67 + ssl? ( =dev-libs/openssl-1.1.0*:0=[-bindist] )
68 +"
69 +DEPEND="
70 + ${RDEPEND}
71 + ${PYTHON_DEPS}
72 + systemtap? ( dev-util/systemtap )
73 + test? ( net-misc/curl )
74 +"
75 +S="${WORKDIR}/node-v${PV}"
76 +PATCHES=(
77 + "${FILESDIR}"/${PN}-10.3.0-global-npm-config.patch
78 +)
79 +
80 +pkg_pretend() {
81 + (use x86 && ! use cpu_flags_x86_sse2) && \
82 + die "Your CPU doesn't support the required SSE2 instruction."
83 +
84 + ( [[ ${MERGE_TYPE} != "binary" ]] && ! test-flag-CXX -std=c++11 ) && \
85 + die "Your compiler doesn't support C++11. Use GCC 4.8, Clang 3.3 or newer."
86 +}
87 +
88 +src_prepare() {
89 + tc-export CC CXX PKG_CONFIG
90 + export V=1
91 + export BUILDTYPE=Release
92 +
93 + # fix compilation on Darwin
94 + # https://code.google.com/p/gyp/issues/detail?id=260
95 + sed -i -e "/append('-arch/d" tools/gyp/pylib/gyp/xcode_emulation.py || die
96 +
97 + # make sure we use python2.* while using gyp
98 + sed -i -e "s/python/${EPYTHON}/" deps/npm/node_modules/node-gyp/gyp/gyp || die
99 + sed -i -e "s/|| 'python2'/|| '${EPYTHON}'/" deps/npm/node_modules/node-gyp/lib/configure.js || die
100 +
101 + # less verbose install output (stating the same as portage, basically)
102 + sed -i -e "/print/d" tools/install.py || die
103 +
104 + # proper libdir, hat tip @ryanpcmcquen https://github.com/iojs/io.js/issues/504
105 + local LIBDIR=$(get_libdir)
106 + sed -i -e "s|lib/|${LIBDIR}/|g" tools/install.py || die
107 + sed -i -e "s/'lib'/'${LIBDIR}'/" deps/npm/lib/npm.js || die
108 +
109 + # Avoid writing a depfile, not useful
110 + sed -i -e "/DEPFLAGS =/d" tools/gyp/pylib/gyp/generator/make.py || die
111 +
112 + sed -i -e "/'-O3'/d" common.gypi deps/v8/gypfiles/toolchain.gypi || die
113 +
114 + # Avoid a test that I've only been able to reproduce from emerge. It doesnt
115 + # seem sandbox related either (invoking it from a sandbox works fine).
116 + # The issue is that no stdin handle is openened when asked for one.
117 + # It doesn't really belong upstream , so it'll just be removed until someone
118 + # with more gentoo-knowledge than me (jbergstroem) figures it out.
119 + rm test/parallel/test-stdout-close-unref.js || die
120 +
121 + # debug builds. change install path, remove optimisations and override buildtype
122 + if use debug; then
123 + sed -i -e "s|out/Release/|out/Debug/|g" tools/install.py || die
124 + BUILDTYPE=Debug
125 + fi
126 +
127 + default
128 +}
129 +
130 +src_configure() {
131 + local myconf=( --shared-cares --shared-http-parser --shared-libuv --shared-nghttp2 --shared-zlib )
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 ) || 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 + emake install DESTDIR="${D}"
169 + pax-mark -m "${ED}"usr/bin/node
170 +
171 + # set up a symlink structure that node-gyp expects..
172 + dodir /usr/include/node/deps/{v8,uv}
173 + dosym . /usr/include/node/src
174 + for var in deps/{uv,v8}/include; do
175 + dosym ../.. /usr/include/node/${var}
176 + done
177 +
178 + if use doc; then
179 + # Patch docs to make them offline readable
180 + for i in `grep -rl 'fonts.googleapis.com' "${S}"/out/doc/api/*`; do
181 + sed -i '/fonts.googleapis.com/ d' $i;
182 + done
183 + # Install docs
184 + docinto html
185 + dodoc -r "${S}"/doc/*
186 + fi
187 +
188 + if use npm; then
189 + dodir /etc/npm
190 +
191 + # Install bash completion for `npm`
192 + # We need to temporarily replace default config path since
193 + # npm otherwise tries to write outside of the sandbox
194 + local npm_config="usr/$(get_libdir)/node_modules/npm/lib/config/core.js"
195 + sed -i -e "s|'/etc'|'${ED}/etc'|g" "${ED}/${npm_config}" || die
196 + local tmp_npm_completion_file="$(emktemp)"
197 + "${ED}/usr/bin/npm" completion > "${tmp_npm_completion_file}"
198 + newbashcomp "${tmp_npm_completion_file}" npm
199 + sed -i -e "s|'${ED}/etc'|'/etc'|g" "${ED}/${npm_config}" || die
200 +
201 + # Move man pages
202 + doman "${LIBDIR}"/node_modules/npm/man/man{1,5,7}/*
203 +
204 + # Clean up
205 + rm "${LIBDIR}"/node_modules/npm/{.mailmap,.npmignore,Makefile} || die
206 + rm -rf "${LIBDIR}"/node_modules/npm/{doc,html,man} || die
207 +
208 + local find_exp="-or -name"
209 + local find_name=()
210 + for match in "AUTHORS*" "CHANGELOG*" "CONTRIBUT*" "README*" \
211 + ".travis.yml" ".eslint*" ".wercker.yml" ".npmignore" \
212 + "*.md" "*.markdown" "*.bat" "*.cmd"; do
213 + find_name+=( ${find_exp} "${match}" )
214 + done
215 +
216 + # Remove various development and/or inappropriate files and
217 + # useless docs of dependend packages.
218 + find "${LIBDIR}"/node_modules \
219 + \( -type d -name examples \) -or \( -type f \( \
220 + -iname "LICEN?E*" \
221 + "${find_name[@]}" \
222 + \) \) -exec rm -rf "{}" \;
223 + fi
224 +
225 + mv "${D}"/usr/share/doc/node "${D}"/usr/share/doc/${PF} || die
226 +}
227 +
228 +src_test() {
229 + out/${BUILDTYPE}/cctest || die
230 + "${PYTHON}" tools/test.py --mode=${BUILDTYPE,,} -J message parallel sequential || die
231 +}
232 +
233 +pkg_postinst() {
234 + einfo "The global npm config lives in /etc/npm. This deviates slightly"
235 + einfo "from upstream which otherwise would have it live in /usr/etc/."
236 + einfo ""
237 + einfo "Protip: When using node-gyp to install native modules, you can"
238 + einfo "avoid having to download extras by doing the following:"
239 + einfo "$ node-gyp --nodedir /usr/include/node <command>"
240 +}