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/files/, net-libs/nodejs/
Date: Tue, 24 Oct 2017 04:49:29
Message-Id: 1508820556.1552d931b0812314bb69e11bfccd7bfd9da99cf0.jer@gentoo
1 commit: 1552d931b0812314bb69e11bfccd7bfd9da99cf0
2 Author: Jeroen Roovers <jer <AT> gentoo <DOT> org>
3 AuthorDate: Tue Oct 24 04:45:27 2017 +0000
4 Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org>
5 CommitDate: Tue Oct 24 04:49:16 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1552d931
7
8 net-libs/nodejs: Version bump (more on this later).
9
10 Package-Manager: Portage-2.3.12, Repoman-2.3.3
11
12 net-libs/nodejs/Manifest | 1 +
13 .../nodejs/files/nodejs-8.7.0-shared-nghttp2.patch | 105 +++++++++++
14 net-libs/nodejs/nodejs-8.7.0.ebuild | 196 +++++++++++++++++++++
15 3 files changed, 302 insertions(+)
16
17 diff --git a/net-libs/nodejs/Manifest b/net-libs/nodejs/Manifest
18 index 76b36b7107e..ba24f7870bd 100644
19 --- a/net-libs/nodejs/Manifest
20 +++ b/net-libs/nodejs/Manifest
21 @@ -7,3 +7,4 @@ DIST node-v7.10.0.tar.xz 16751724 SHA256 dc34dd15524ba821ffcae7b245eabe8631e2614
22 DIST node-v8.2.1.tar.xz 17897168 SHA256 02c46d8914540eea73d0ad33bf9f371a28aa0dc8c5d740948491fef044ad8c8b SHA512 8d84998e8408b89e003929d7fce89c31703aea59ca5826246422d4d1935941730b0b9907a8a9af088ec8ccad60d8919da04104037083a2363daf118682a3b82a WHIRLPOOL dbbf430699f88b1c86b1a818b9c2fe424d3c63eb36c2b85b54de78954d8f01dc47a2f66a6cecf30c43e8ab29236f0a7509a26afc4586501abcda4494a78a21c7
23 DIST node-v8.4.0.tar.xz 18265792 SHA256 5d5aa2a101dcc617231a475812eb8ed87cac21491f1dcc7997b9dd463563f361 SHA512 7d0d97ca64db0bf87f1892490f8b7758a879d2ac22532b69e8e0ee5c04bd11073fd917353eeeabdcfbebc83540715d8c520ec9bf9ea1afc82d8ee7b6caf819f1 WHIRLPOOL 23f50be06615350564577349f6388d6563cbcae9e9b0229133baaab30852be7c759fbb4f265816ab999fa2bfa8666b47fb3ba438e09beff8e030fa2db547001c
24 DIST node-v8.5.0.tar.xz 18326412 SHA256 e1cde5d8e5049e7e1b61aef128f26162059d885dc8cab5014bf5cbf693f75c3c SHA512 7ef83a6da7ba9d61c19df0530dfee7b769c0bc7ab066fc29fdb54c9b09085a3536699c7c92889cea8fbf3d6241cc66c383cd351451da8019fea4e0d25d043f3d WHIRLPOOL 63576159748e9423a0b1df7d032d4f5edc23d33f22fd76d3dc0f0b4804606abf57011097dcf4fd2d3707b22babe69bcd976133b7450558925b5d679872abd382
25 +DIST node-v8.7.0.tar.xz 18186384 SHA256 5a17d08c68ee7c1e748fd32534edda766cb57c13ed98e693f3075bc9d9a0b59a SHA512 5ce41d2d7f1c07330c4d9acc8129840d03fb820dac2f87be3f277a372ed6d84d6e1516e1d804e2277d500f32f9838d4307122b26962029d4f811904523f72530 WHIRLPOOL f4541efef681204684d491c9a2539560602c017087fa895e41b3ee9616ce6860a22634179bb904e816eee45b5f5ebc06bada5bb55be05e6e1418cac45cc55966
26
27 diff --git a/net-libs/nodejs/files/nodejs-8.7.0-shared-nghttp2.patch b/net-libs/nodejs/files/nodejs-8.7.0-shared-nghttp2.patch
28 new file mode 100644
29 index 00000000000..5f5a2c7b7ff
30 --- /dev/null
31 +++ b/net-libs/nodejs/files/nodejs-8.7.0-shared-nghttp2.patch
32 @@ -0,0 +1,105 @@
33 +--- a/configure
34 ++++ b/configure
35 +@@ -182,6 +182,27 @@
36 + dest='shared_http_parser_libpath',
37 + help='a directory to search for the shared http_parser DLL')
38 +
39 ++shared_optgroup.add_option('--shared-nghttp2',
40 ++ action='store_true',
41 ++ dest='shared_nghttp2',
42 ++ help='link to a shared nghttp2 DLL instead of static linking')
43 ++
44 ++shared_optgroup.add_option('--shared-nghttp2-includes',
45 ++ action='store',
46 ++ dest='shared_nghttp2_includes',
47 ++ help='directory containing nghttp2 header files')
48 ++
49 ++shared_optgroup.add_option('--shared-nghttp2-libname',
50 ++ action='store',
51 ++ dest='shared_nghttp2_libname',
52 ++ default='nghttp2',
53 ++ help='alternative lib name to link to [default: %default]')
54 ++
55 ++shared_optgroup.add_option('--shared-nghttp2-libpath',
56 ++ action='store',
57 ++ dest='shared_nghttp2_libpath',
58 ++ help='a directory to search for the shared nghttp2 DLL')
59 ++
60 + shared_optgroup.add_option('--shared-libuv',
61 + action='store_true',
62 + dest='shared_libuv',
63 +@@ -1360,6 +1381,7 @@
64 + configure_node(output)
65 + configure_library('zlib', output)
66 + configure_library('http_parser', output)
67 ++configure_library('nghttp2', output)
68 + configure_library('libuv', output)
69 + configure_library('libcares', output)
70 + # stay backwards compatible with shared cares builds
71 +--- a/node.gyp
72 ++++ b/node.gyp
73 +@@ -14,6 +14,7 @@
74 + 'node_module_version%': '',
75 + 'node_shared_zlib%': 'false',
76 + 'node_shared_http_parser%': 'false',
77 ++ 'node_shared_nghttp2%': 'false',
78 + 'node_shared_cares%': 'false',
79 + 'node_shared_libuv%': 'false',
80 + 'node_use_openssl%': 'true',
81 +@@ -151,8 +152,15 @@
82 + 'type': '<(node_target_type)',
83 +
84 + 'dependencies': [
85 +- 'node_js2c#host',
86 +- 'deps/nghttp2/nghttp2.gyp:nghttp2'
87 ++ 'node_js2c#host'
88 ++ ],
89 ++
90 ++ 'conditions': [
91 ++ [ 'node_shared_nghttp2=="false"', {
92 ++ 'dependencies': [
93 ++ 'deps/nghttp2/nghttp2.gyp:nghttp2'
94 ++ ]
95 ++ }]
96 + ],
97 +
98 + 'includes': [
99 +@@ -163,8 +171,7 @@
100 + 'src',
101 + 'tools/msvs/genfiles',
102 + 'deps/uv/src/ares',
103 +- '<(SHARED_INTERMEDIATE_DIR)', # for node_natives.h
104 +- 'deps/nghttp2/lib/includes'
105 ++ '<(SHARED_INTERMEDIATE_DIR)' # for node_natives.h
106 + ],
107 +
108 + 'sources': [
109 +@@ -691,6 +696,15 @@
110 + 'deps/http_parser/http_parser.gyp:http_parser'
111 + ]
112 + }],
113 ++ [ 'node_shared_nghttp2=="false"', {
114 ++ 'dependencies': [
115 ++ 'deps/nghttp2/nghttp2.gyp:nghttp2'
116 ++ ],
117 ++ 'defines': [
118 ++ # We're using the nghttp2 static lib
119 ++ 'NGHTTP2_STATICLIB'
120 ++ ]
121 ++ }],
122 + [ 'node_shared_libuv=="false"', {
123 + 'dependencies': [
124 + 'deps/uv/uv.gyp:libuv'
125 +--- a/node.gypi
126 ++++ b/node.gypi
127 +@@ -251,6 +251,10 @@
128 + 'dependencies': [ 'deps/http_parser/http_parser.gyp:http_parser' ],
129 + }],
130 +
131 ++ [ 'node_shared_nghttp2=="false"', {
132 ++ 'dependencies': [ 'deps/nghttp2/nghttp2.gyp:nghttp2' ],
133 ++ }],
134 ++
135 + [ 'node_shared_cares=="false"', {
136 + 'dependencies': [ 'deps/cares/cares.gyp:cares' ],
137 + }],
138
139 diff --git a/net-libs/nodejs/nodejs-8.7.0.ebuild b/net-libs/nodejs/nodejs-8.7.0.ebuild
140 new file mode 100644
141 index 00000000000..2739d2a8cd9
142 --- /dev/null
143 +++ b/net-libs/nodejs/nodejs-8.7.0.ebuild
144 @@ -0,0 +1,196 @@
145 +# Copyright 1999-2017 Gentoo Foundation
146 +# Distributed under the terms of the GNU General Public License v2
147 +
148 +EAPI=6
149 +RESTRICT="test"
150 +
151 +PYTHON_COMPAT=( python2_7 )
152 +PYTHON_REQ_USE="threads"
153 +
154 +inherit bash-completion-r1 eutils flag-o-matic pax-utils python-single-r1 toolchain-funcs
155 +
156 +DESCRIPTION="A JavaScript runtime built on Chrome's V8 JavaScript engine"
157 +HOMEPAGE="https://nodejs.org/"
158 +SRC_URI="https://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz"
159 +
160 +LICENSE="Apache-1.1 Apache-2.0 BSD BSD-2 MIT"
161 +SLOT="0"
162 +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x64-macos"
163 +IUSE="cpu_flags_x86_sse2 debug doc icu +npm +snapshot +ssl systemtap test"
164 +
165 +RDEPEND="icu? ( >=dev-libs/icu-56:= )
166 + npm? ( ${PYTHON_DEPS} )
167 + >=net-libs/http-parser-2.7.0:=
168 + >=dev-libs/libuv-1.15.0:=
169 + >=net-libs/nghttp2-1.25.0
170 + >=dev-libs/openssl-1.0.2g:0=[-bindist]
171 + sys-libs/zlib"
172 +DEPEND="${RDEPEND}
173 + ${PYTHON_DEPS}
174 + systemtap? ( dev-util/systemtap )
175 + test? ( net-misc/curl )"
176 +
177 +S="${WORKDIR}/node-v${PV}"
178 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
179 +
180 +PATCHES=(
181 + "${FILESDIR}"/gentoo-global-npm-config.patch
182 + "${FILESDIR}"/nodejs-8.7.0-shared-nghttp2.patch
183 +)
184 +
185 +pkg_pretend() {
186 + (use x86 && ! use cpu_flags_x86_sse2) && \
187 + die "Your CPU doesn't support the required SSE2 instruction."
188 +
189 + ( [[ ${MERGE_TYPE} != "binary" ]] && ! test-flag-CXX -std=c++11 ) && \
190 + die "Your compiler doesn't support C++11. Use GCC 4.8, Clang 3.3 or newer."
191 +}
192 +
193 +src_prepare() {
194 + tc-export CC CXX PKG_CONFIG
195 + export V=1
196 + export BUILDTYPE=Release
197 +
198 + # fix compilation on Darwin
199 + # https://code.google.com/p/gyp/issues/detail?id=260
200 + sed -i -e "/append('-arch/d" tools/gyp/pylib/gyp/xcode_emulation.py || die
201 +
202 + # make sure we use python2.* while using gyp
203 + sed -i -e "s/python/${EPYTHON}/" deps/npm/node_modules/node-gyp/gyp/gyp || die
204 + sed -i -e "s/|| 'python'/|| '${EPYTHON}'/" deps/npm/node_modules/node-gyp/lib/configure.js || die
205 +
206 + # less verbose install output (stating the same as portage, basically)
207 + sed -i -e "/print/d" tools/install.py || die
208 +
209 + # proper libdir, hat tip @ryanpcmcquen https://github.com/iojs/io.js/issues/504
210 + local LIBDIR=$(get_libdir)
211 + sed -i -e "s|lib/|${LIBDIR}/|g" tools/install.py || die
212 + sed -i -e "s/'lib'/'${LIBDIR}'/" lib/module.js || die
213 + sed -i -e "s|\"lib\"|\"${LIBDIR}\"|" deps/npm/lib/npm.js || die
214 +
215 + # Avoid writing a depfile, not useful
216 + sed -i -e "/DEPFLAGS =/d" tools/gyp/pylib/gyp/generator/make.py || die
217 +
218 + # Avoid a test that I've only been able to reproduce from emerge. It doesnt
219 + # seem sandbox related either (invoking it from a sandbox works fine).
220 + # The issue is that no stdin handle is openened when asked for one.
221 + # It doesn't really belong upstream , so it'll just be removed until someone
222 + # with more gentoo-knowledge than me (jbergstroem) figures it out.
223 + rm test/parallel/test-stdout-close-unref.js || die
224 +
225 + # debug builds. change install path, remove optimisations and override buildtype
226 + if use debug; then
227 + sed -i -e "s|out/Release/|out/Debug/|g" tools/install.py || die
228 + BUILDTYPE=Debug
229 + fi
230 +
231 + default
232 +}
233 +
234 +src_configure() {
235 + local myarch=""
236 + local myconf=( --shared-http-parser --shared-libuv --shared-nghttp2 --shared-openssl --shared-zlib )
237 + use npm || myconf+=( --without-npm )
238 + use icu && myconf+=( --with-intl=system-icu )
239 + use snapshot && myconf+=( --with-snapshot )
240 + use ssl || myconf+=( --without-ssl )
241 + use debug && myconf+=( --debug )
242 +
243 + case ${ABI} in
244 + amd64) myarch="x64";;
245 + arm) myarch="arm";;
246 + arm64) myarch="arm64";;
247 + ppc64) myarch="ppc64";;
248 + x32) myarch="x32";;
249 + x86) myarch="ia32";;
250 + *) myarch="${ABI}";;
251 + esac
252 +
253 + GYP_DEFINES="linux_use_gold_flags=0
254 + linux_use_bundled_binutils=0
255 + linux_use_bundled_gold=0" \
256 + "${PYTHON}" configure \
257 + --prefix="${EPREFIX}"/usr \
258 + --dest-cpu=${myarch} \
259 + $(use_with systemtap dtrace) \
260 + "${myconf[@]}" || die
261 +}
262 +
263 +src_compile() {
264 + emake -C out mksnapshot
265 + pax-mark m "out/${BUILDTYPE}/mksnapshot"
266 + emake -C out
267 +}
268 +
269 +src_install() {
270 + local LIBDIR="${ED}/usr/$(get_libdir)"
271 + emake install DESTDIR="${D}"
272 + pax-mark -m "${ED}"usr/bin/node
273 +
274 + # set up a symlink structure that node-gyp expects..
275 + dodir /usr/include/node/deps/{v8,uv}
276 + dosym . /usr/include/node/src
277 + for var in deps/{uv,v8}/include; do
278 + dosym ../.. /usr/include/node/${var}
279 + done
280 +
281 + if use doc; then
282 + # Patch docs to make them offline readable
283 + for i in `grep -rl 'fonts.googleapis.com' "${S}"/out/doc/api/*`; do
284 + sed -i '/fonts.googleapis.com/ d' $i;
285 + done
286 + # Install docs!
287 + dohtml -r "${S}"/doc/*
288 + fi
289 +
290 + if use npm; then
291 + dodir /etc/npm
292 +
293 + # Install bash completion for `npm`
294 + # We need to temporarily replace default config path since
295 + # npm otherwise tries to write outside of the sandbox
296 + local npm_config="usr/$(get_libdir)/node_modules/npm/lib/config/core.js"
297 + sed -i -e "s|'/etc'|'${ED}/etc'|g" "${ED}/${npm_config}" || die
298 + local tmp_npm_completion_file="$(emktemp)"
299 + "${ED}/usr/bin/npm" completion > "${tmp_npm_completion_file}"
300 + newbashcomp "${tmp_npm_completion_file}" npm
301 + sed -i -e "s|'${ED}/etc'|'/etc'|g" "${ED}/${npm_config}" || die
302 +
303 + # Move man pages
304 + doman "${LIBDIR}"/node_modules/npm/man/man{1,5,7}/*
305 +
306 + # Clean up
307 + rm "${LIBDIR}"/node_modules/npm/{.mailmap,.npmignore,Makefile} || die
308 + rm -rf "${LIBDIR}"/node_modules/npm/{doc,html,man} || die
309 +
310 + local find_exp="-or -name"
311 + local find_name=()
312 + for match in "AUTHORS*" "CHANGELOG*" "CONTRIBUT*" "README*" \
313 + ".travis.yml" ".eslint*" ".wercker.yml" ".npmignore" \
314 + "*.md" "*.markdown" "*.bat" "*.cmd"; do
315 + find_name+=( ${find_exp} "${match}" )
316 + done
317 +
318 + # Remove various development and/or inappropriate files and
319 + # useless docs of dependend packages.
320 + find "${LIBDIR}"/node_modules \
321 + \( -type d -name examples \) -or \( -type f \( \
322 + -iname "LICEN?E*" \
323 + "${find_name[@]}" \
324 + \) \) -exec rm -rf "{}" \;
325 + fi
326 +}
327 +
328 +src_test() {
329 + out/${BUILDTYPE}/cctest || die
330 + "${PYTHON}" tools/test.py --mode=${BUILDTYPE,,} -J message parallel sequential || die
331 +}
332 +
333 +pkg_postinst() {
334 + einfo "The global npm config lives in /etc/npm. This deviates slightly"
335 + einfo "from upstream which otherwise would have it live in /usr/etc/."
336 + einfo ""
337 + einfo "Protip: When using node-gyp to install native modules, you can"
338 + einfo "avoid having to download extras by doing the following:"
339 + einfo "$ node-gyp --nodedir /usr/include/node <command>"
340 +}