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: Wed, 15 Nov 2017 15:13:42
Message-Id: 1510758816.143a0116d9c526f5010b52db31431e70f33aa134.jer@gentoo
1 commit: 143a0116d9c526f5010b52db31431e70f33aa134
2 Author: Jeroen Roovers <jer <AT> gentoo <DOT> org>
3 AuthorDate: Wed Nov 15 15:13:20 2017 +0000
4 Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org>
5 CommitDate: Wed Nov 15 15:13:36 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=143a0116
7
8 net-libs/nodejs: Version bump.
9
10 Package-Manager: Portage-2.3.13, Repoman-2.3.4
11
12 net-libs/nodejs/Manifest | 1 +
13 .../nodejs/files/nodejs-9.2.0-shared-nghttp2.patch | 89 ++++++++++
14 net-libs/nodejs/nodejs-9.2.0.ebuild | 197 +++++++++++++++++++++
15 3 files changed, 287 insertions(+)
16
17 diff --git a/net-libs/nodejs/Manifest b/net-libs/nodejs/Manifest
18 index e466edb6328..d6d171d04ad 100644
19 --- a/net-libs/nodejs/Manifest
20 +++ b/net-libs/nodejs/Manifest
21 @@ -4,3 +4,4 @@ DIST node-v6.11.5.tar.xz 15699404 SHA256 1c6de415216799fbaeca82304b3fef87accc710
22 DIST node-v6.9.4.tar.xz 15519264 SHA256 c51d7c61db40455d57428abcadc7eb0f0a08a8878cb1d8ea3c1e211c54532c35 SHA512 86d3e2889031c2b50c021bd3fd63194c2c22c44291d51dff1b5e1652b01853c09d2880c2f58fdad062e3e2a3f637a3f0d78dac66b835b676790cf272e64f8dce WHIRLPOOL d1bcf488ed1aae7959303b988c9467fc5d0930166c7bfe0e441392763e19f788496971c07560a9f62586bbb2be7ce741ece8346140d665d29593b9b8f649b002
23 DIST node-v8.9.1.tar.xz 18290848 SHA256 ef160c21f60f8aca64145985e01b4044435e381dc16e8f0640ed0223e84f17e0 SHA512 e1d93def34c1b91de90b807031e2f313661658cd045d44d290950190b10512770df05cb92e9657bab7ad6654d3359364193567cf693ddb2b3574d2a48e4ee256 WHIRLPOOL f1e47a0d078e0c1c29c993c8266337ae1fa0ee18ac81e053c4deabe85a94a5de0681ea9ed7f81119d108235055b849bc30557eb0d86345675580d76bd7c05f4d
24 DIST node-v9.1.0.tar.xz 18256556 SHA256 7e34d581332aedc85306859e613a81cce2531bdd30eef358cb54db8a4f5c3c49 SHA512 3e99c8c93cb05194e572a1fcf25032da2d94e5dffec1ec3044945d70c02a07f31d872501c0614dd9e8142ddb60e1c20cf13b59859be9c4e9e6beb3f7b8fc3aae WHIRLPOOL 70864c2bbb1e69f5e30a41098dd68ab399cc2e78e9d90237bdc08e425d7f1d06c6a8b74557f44e1b73f021d18096e60eaee00e5a0c51b58408ac11a13f0cc53a
25 +DIST node-v9.2.0.tar.xz 18347108 SHA256 64caf263eadc1aea072ce5d30ded7f4534aa7f59c8c6993eee4accad96e3bbc2 SHA512 3335a2ec17f4698bda58f2a2c9548546912b9a4109c0bff0ffc57bca14d40101bcc00356231c95c08733860286ac340e227ca79debac581835f84ae3967cdb4b WHIRLPOOL f14cd3f537d2f1f41ee299f2492f2dc275587846dc231f668ccb3c2d31720020b982474130ae7ce4b8ca709e2f67c510d3e65b7641fbc3fff0e3f9be3321ca2a
26
27 diff --git a/net-libs/nodejs/files/nodejs-9.2.0-shared-nghttp2.patch b/net-libs/nodejs/files/nodejs-9.2.0-shared-nghttp2.patch
28 new file mode 100644
29 index 00000000000..a145c0c7116
30 --- /dev/null
31 +++ b/net-libs/nodejs/files/nodejs-9.2.0-shared-nghttp2.patch
32 @@ -0,0 +1,89 @@
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 +@@ -180,8 +180,7 @@
100 + 'include_dirs': [
101 + 'src',
102 + 'tools/msvs/genfiles',
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 +--- a/node.gypi
110 ++++ b/node.gypi
111 +@@ -251,6 +251,10 @@
112 + 'dependencies': [ 'deps/http_parser/http_parser.gyp:http_parser' ],
113 + }],
114 +
115 ++ [ 'node_shared_nghttp2=="false"', {
116 ++ 'dependencies': [ 'deps/nghttp2/nghttp2.gyp:nghttp2' ],
117 ++ }],
118 ++
119 + [ 'node_shared_cares=="false"', {
120 + 'dependencies': [ 'deps/cares/cares.gyp:cares' ],
121 + }],
122
123 diff --git a/net-libs/nodejs/nodejs-9.2.0.ebuild b/net-libs/nodejs/nodejs-9.2.0.ebuild
124 new file mode 100644
125 index 00000000000..aaab3c90a4b
126 --- /dev/null
127 +++ b/net-libs/nodejs/nodejs-9.2.0.ebuild
128 @@ -0,0 +1,197 @@
129 +# Copyright 1999-2017 Gentoo Foundation
130 +# Distributed under the terms of the GNU General Public License v2
131 +
132 +EAPI=6
133 +RESTRICT="test"
134 +
135 +PYTHON_COMPAT=( python2_7 )
136 +PYTHON_REQ_USE="threads"
137 +
138 +inherit bash-completion-r1 eutils flag-o-matic pax-utils python-single-r1 toolchain-funcs
139 +
140 +DESCRIPTION="A JavaScript runtime built on Chrome's V8 JavaScript engine"
141 +HOMEPAGE="https://nodejs.org/"
142 +SRC_URI="https://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz"
143 +
144 +LICENSE="Apache-1.1 Apache-2.0 BSD BSD-2 MIT"
145 +SLOT="0"
146 +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x64-macos"
147 +IUSE="cpu_flags_x86_sse2 debug doc icu +npm +snapshot +ssl systemtap test"
148 +
149 +RDEPEND="icu? ( >=dev-libs/icu-59:= )
150 + npm? ( ${PYTHON_DEPS} )
151 + >=net-libs/http-parser-2.7.0:=
152 + >=dev-libs/libuv-1.16.1:=
153 + >=net-libs/nghttp2-1.25.0
154 + >=dev-libs/openssl-1.0.2g:0=[-bindist]
155 + sys-libs/zlib"
156 +DEPEND="${RDEPEND}
157 + ${PYTHON_DEPS}
158 + systemtap? ( dev-util/systemtap )
159 + test? ( net-misc/curl )"
160 +
161 +S="${WORKDIR}/node-v${PV}"
162 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
163 +
164 +PATCHES=(
165 + "${FILESDIR}"/gentoo-global-npm-config.patch
166 + "${FILESDIR}"/nodejs-9.2.0-shared-nghttp2.patch
167 +)
168 +
169 +pkg_pretend() {
170 + (use x86 && ! use cpu_flags_x86_sse2) && \
171 + die "Your CPU doesn't support the required SSE2 instruction."
172 +
173 + ( [[ ${MERGE_TYPE} != "binary" ]] && ! test-flag-CXX -std=c++11 ) && \
174 + die "Your compiler doesn't support C++11. Use GCC 4.8, Clang 3.3 or newer."
175 +}
176 +
177 +src_prepare() {
178 + tc-export CC CXX PKG_CONFIG
179 + export V=1
180 + export BUILDTYPE=Release
181 +
182 + # fix compilation on Darwin
183 + # https://code.google.com/p/gyp/issues/detail?id=260
184 + sed -i -e "/append('-arch/d" tools/gyp/pylib/gyp/xcode_emulation.py || die
185 +
186 + # make sure we use python2.* while using gyp
187 + sed -i -e "s/python/${EPYTHON}/" deps/npm/node_modules/node-gyp/gyp/gyp || die
188 + sed -i -e "s/|| 'python2'/|| '${EPYTHON}'/" deps/npm/node_modules/node-gyp/lib/configure.js || die
189 +
190 + # less verbose install output (stating the same as portage, basically)
191 + sed -i -e "/print/d" tools/install.py || die
192 +
193 + # proper libdir, hat tip @ryanpcmcquen https://github.com/iojs/io.js/issues/504
194 + local LIBDIR=$(get_libdir)
195 + sed -i -e "s|lib/|${LIBDIR}/|g" tools/install.py || die
196 + sed -i -e "s/'lib'/'${LIBDIR}'/" lib/module.js deps/npm/lib/npm.js || die
197 +
198 + # Avoid writing a depfile, not useful
199 + sed -i -e "/DEPFLAGS =/d" tools/gyp/pylib/gyp/generator/make.py || die
200 +
201 + sed -i -e "/'-O3'/d" common.gypi || die
202 +
203 + # Avoid a test that I've only been able to reproduce from emerge. It doesnt
204 + # seem sandbox related either (invoking it from a sandbox works fine).
205 + # The issue is that no stdin handle is openened when asked for one.
206 + # It doesn't really belong upstream , so it'll just be removed until someone
207 + # with more gentoo-knowledge than me (jbergstroem) figures it out.
208 + rm test/parallel/test-stdout-close-unref.js || die
209 +
210 + # debug builds. change install path, remove optimisations and override buildtype
211 + if use debug; then
212 + sed -i -e "s|out/Release/|out/Debug/|g" tools/install.py || die
213 + BUILDTYPE=Debug
214 + fi
215 +
216 + default
217 +}
218 +
219 +src_configure() {
220 + local myarch=""
221 + local myconf=( --shared-http-parser --shared-libuv --shared-nghttp2 --shared-openssl --shared-zlib )
222 + use npm || myconf+=( --without-npm )
223 + use icu && myconf+=( --with-intl=system-icu ) || myconf+=( --with-intl=none )
224 + use snapshot && myconf+=( --with-snapshot )
225 + use ssl || myconf+=( --without-ssl )
226 + use debug && myconf+=( --debug )
227 +
228 + case ${ABI} in
229 + amd64) myarch="x64";;
230 + arm) myarch="arm";;
231 + arm64) myarch="arm64";;
232 + ppc64) myarch="ppc64";;
233 + x32) myarch="x32";;
234 + x86) myarch="ia32";;
235 + *) myarch="${ABI}";;
236 + esac
237 +
238 + GYP_DEFINES="linux_use_gold_flags=0
239 + linux_use_bundled_binutils=0
240 + linux_use_bundled_gold=0" \
241 + "${PYTHON}" configure \
242 + --prefix="${EPREFIX}"/usr \
243 + --dest-cpu=${myarch} \
244 + $(use_with systemtap dtrace) \
245 + "${myconf[@]}" || die
246 +}
247 +
248 +src_compile() {
249 + emake -C out mksnapshot
250 + pax-mark m "out/${BUILDTYPE}/mksnapshot"
251 + emake -C out
252 +}
253 +
254 +src_install() {
255 + local LIBDIR="${ED}/usr/$(get_libdir)"
256 + emake install DESTDIR="${D}"
257 + pax-mark -m "${ED}"usr/bin/node
258 +
259 + # set up a symlink structure that node-gyp expects..
260 + dodir /usr/include/node/deps/{v8,uv}
261 + dosym . /usr/include/node/src
262 + for var in deps/{uv,v8}/include; do
263 + dosym ../.. /usr/include/node/${var}
264 + done
265 +
266 + if use doc; then
267 + # Patch docs to make them offline readable
268 + for i in `grep -rl 'fonts.googleapis.com' "${S}"/out/doc/api/*`; do
269 + sed -i '/fonts.googleapis.com/ d' $i;
270 + done
271 + # Install docs!
272 + dohtml -r "${S}"/doc/*
273 + fi
274 +
275 + if use npm; then
276 + dodir /etc/npm
277 +
278 + # Install bash completion for `npm`
279 + # We need to temporarily replace default config path since
280 + # npm otherwise tries to write outside of the sandbox
281 + local npm_config="usr/$(get_libdir)/node_modules/npm/lib/config/core.js"
282 + sed -i -e "s|'/etc'|'${ED}/etc'|g" "${ED}/${npm_config}" || die
283 + local tmp_npm_completion_file="$(emktemp)"
284 + "${ED}/usr/bin/npm" completion > "${tmp_npm_completion_file}"
285 + newbashcomp "${tmp_npm_completion_file}" npm
286 + sed -i -e "s|'${ED}/etc'|'/etc'|g" "${ED}/${npm_config}" || die
287 +
288 + # Move man pages
289 + doman "${LIBDIR}"/node_modules/npm/man/man{1,5,7}/*
290 +
291 + # Clean up
292 + rm "${LIBDIR}"/node_modules/npm/{.mailmap,.npmignore,Makefile} || die
293 + rm -rf "${LIBDIR}"/node_modules/npm/{doc,html,man} || die
294 +
295 + local find_exp="-or -name"
296 + local find_name=()
297 + for match in "AUTHORS*" "CHANGELOG*" "CONTRIBUT*" "README*" \
298 + ".travis.yml" ".eslint*" ".wercker.yml" ".npmignore" \
299 + "*.md" "*.markdown" "*.bat" "*.cmd"; do
300 + find_name+=( ${find_exp} "${match}" )
301 + done
302 +
303 + # Remove various development and/or inappropriate files and
304 + # useless docs of dependend packages.
305 + find "${LIBDIR}"/node_modules \
306 + \( -type d -name examples \) -or \( -type f \( \
307 + -iname "LICEN?E*" \
308 + "${find_name[@]}" \
309 + \) \) -exec rm -rf "{}" \;
310 + fi
311 +}
312 +
313 +src_test() {
314 + out/${BUILDTYPE}/cctest || die
315 + "${PYTHON}" tools/test.py --mode=${BUILDTYPE,,} -J message parallel sequential || die
316 +}
317 +
318 +pkg_postinst() {
319 + einfo "The global npm config lives in /etc/npm. This deviates slightly"
320 + einfo "from upstream which otherwise would have it live in /usr/etc/."
321 + einfo ""
322 + einfo "Protip: When using node-gyp to install native modules, you can"
323 + einfo "avoid having to download extras by doing the following:"
324 + einfo "$ node-gyp --nodedir /usr/include/node <command>"
325 +}