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/, net-libs/nodejs/files/
Date: Sun, 09 Dec 2018 15:00:04
Message-Id: 1544367595.2103ef4fa7dfd9fc7058c3e32961a3388536e33e.jer@gentoo
1 commit: 2103ef4fa7dfd9fc7058c3e32961a3388536e33e
2 Author: Jeroen Roovers <jer <AT> gentoo <DOT> org>
3 AuthorDate: Sun Dec 9 14:59:34 2018 +0000
4 Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org>
5 CommitDate: Sun Dec 9 14:59:55 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2103ef4f
7
8 net-libs/nodejs: Version 11.4.0
9
10 Package-Manager: Portage-2.3.52, Repoman-2.3.12
11 Signed-off-by: Jeroen Roovers <jer <AT> gentoo.org>
12
13 net-libs/nodejs/Manifest | 1 +
14 net-libs/nodejs/files/nodejs-11.4.0-llhttp.patch | 20 +++
15 net-libs/nodejs/nodejs-11.4.0.ebuild | 206 +++++++++++++++++++++++
16 3 files changed, 227 insertions(+)
17
18 diff --git a/net-libs/nodejs/Manifest b/net-libs/nodejs/Manifest
19 index d3e06cc163a..1f00ae0fc8f 100644
20 --- a/net-libs/nodejs/Manifest
21 +++ b/net-libs/nodejs/Manifest
22 @@ -1,6 +1,7 @@
23 DIST node-v0.12.18.tar.gz 19842591 BLAKE2B f94f4de6e2875267be194580c645087a262b90da99f10d651a22838c041da07056df81204bb04ce8da083a080062509dcca4d1e3ac2250d651ead8a4cc025028 SHA512 6866608a43eb213f3b715ea0fcc28983fd959ab679c567a1b464f62acd936506f2bce88ea48a60209d8ef8d98259f4b47cd3434893eb4ff82a132775edb37b7b
24 DIST node-v10.14.0.tar.xz 20193912 BLAKE2B a72411c9b7bfc9e257089d26cfc7a00321d1db7836b9a292544971fbceaaeae8b178ef53735175621d42169eb6839173340b00e441e498187bf4fffc02edca71 SHA512 82900373993ae2a068ccc9217eadc700a91956893f0a9973c5003ca648e16859a5b37919ea15c06bc1bd746957db6915ad75aa3d8ddb18c1b949c5723617c0c9
25 DIST node-v11.3.0.tar.xz 20332400 BLAKE2B b237cb6b9a8004f06c72734fec0f9cea6b7ca86d1d289fbad4a232fd7e966d5e20e25929db9ff4a0dc32b6d917aaee12966e53895777cc7a1c2a426ada9e8dbc SHA512 d43b2f3b9835cce5ae411d96ee381a93fa60fa726cb6639580f5ae680fb9f461b1da63dc5f2cee3272341be85cff82073246a501460151e19622e75674ef7627
26 +DIST node-v11.4.0.tar.xz 20406416 BLAKE2B 45c5f2d42aa328c5f5530be99e89e01fe70947e41c9c6b9def599d62df57fb48ce575f36da36369756e98fe3c6d4d0093c0f2f28e0c571874e711cca6d705582 SHA512 1d2fc3cb545f0262bcec674ffb47cd9391876744bcac5f1d95e59022fa1afef921f2dbb2d0ae957b8162349a085fba8ad526d71f63ebc38213e8e9b56908ed31
27 DIST node-v4.9.1.tar.xz 13250164 BLAKE2B 7a689b99bb4bf507f7f21dd2c096a5766d023a8174c0f468cab37365af1920b8700da04157e1a406917790524255ef32c243a74662fd50ef7d3567d189dac9cf SHA512 690c9fdf608e5194069a10955bdd94ec87cb1c308f13bc4d2cae92fa01436ace10fadf58f2e51d477dde6c570b23edc1c71fafea79bfc9cab2903eb2fa5f87aa
28 DIST node-v6.14.4.tar.xz 15842824 BLAKE2B fc56364be64fe5824e2bb50d861ebf8f58f9895f2c9c108b8df3315b127ffb2755eac85c28165ac9779adab4611ce8f5ea1a5745f43ebaa1389e82b8215c6396 SHA512 1ead0c097ec125230dd631f19a5c3ec06a1371f9ca3b392b5ad08fcc227dd0142f33ad52f96890c2c17448a4951a635b9099dfff00d7d8b3ffb59b07904d1bfa
29 DIST node-v6.15.1.tar.xz 15845836 BLAKE2B 8adedbc72bbc0899ec4782894c19ad550c9d41d4069ed640471c7d97185d413b0f9e9a29b9538df5e1b39f59a04abc4adfb2bbdcda9b8803c18a650a2779e92b SHA512 e1d927c91a949b8c681c0ab2c8cbd62d7c202d76abeb9791b1260cf64a01c8aeaa50697e1ed33658586565fa85223abcaeb9370024313a5a5e31297ed4fe310b
30
31 diff --git a/net-libs/nodejs/files/nodejs-11.4.0-llhttp.patch b/net-libs/nodejs/files/nodejs-11.4.0-llhttp.patch
32 new file mode 100644
33 index 00000000000..1b6eb9fb7fa
34 --- /dev/null
35 +++ b/net-libs/nodejs/files/nodejs-11.4.0-llhttp.patch
36 @@ -0,0 +1,20 @@
37 +--- a/node.gypi
38 ++++ b/node.gypi
39 +@@ -169,11 +169,15 @@
40 +
41 + [ 'node_shared_http_parser=="false"', {
42 + 'dependencies': [
43 +- 'deps/http_parser/http_parser.gyp:http_parser',
44 +- 'deps/llhttp/llhttp.gyp:llhttp'
45 ++ 'deps/http_parser/http_parser.gyp:http_parser'
46 + ],
47 + } ],
48 +
49 ++ [ '"true"', { 'dependencies': [
50 ++ 'deps/llhttp/llhttp.gyp:llhttp'
51 ++ ],
52 ++ }],
53 ++
54 + [ 'node_shared_cares=="false"', {
55 + 'dependencies': [ 'deps/cares/cares.gyp:cares' ],
56 + }],
57
58 diff --git a/net-libs/nodejs/nodejs-11.4.0.ebuild b/net-libs/nodejs/nodejs-11.4.0.ebuild
59 new file mode 100644
60 index 00000000000..ede61e4e147
61 --- /dev/null
62 +++ b/net-libs/nodejs/nodejs-11.4.0.ebuild
63 @@ -0,0 +1,206 @@
64 +# Copyright 1999-2018 Gentoo Authors
65 +# Distributed under the terms of the GNU General Public License v2
66 +
67 +EAPI=6
68 +
69 +PYTHON_COMPAT=( python2_7 )
70 +PYTHON_REQ_USE="threads"
71 +
72 +inherit bash-completion-r1 eutils flag-o-matic pax-utils python-single-r1 toolchain-funcs
73 +
74 +DESCRIPTION="A JavaScript runtime built on Chrome's V8 JavaScript engine"
75 +HOMEPAGE="https://nodejs.org/"
76 +SRC_URI="https://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz"
77 +
78 +LICENSE="Apache-1.1 Apache-2.0 BSD BSD-2 MIT"
79 +SLOT="0"
80 +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x64-macos"
81 +IUSE="cpu_flags_x86_sse2 debug doc icu inspector +npm +snapshot +ssl systemtap test"
82 +REQUIRED_USE="
83 + ${PYTHON_REQUIRED_USE}
84 + inspector? ( icu ssl )
85 + npm? ( ssl )
86 +"
87 +
88 +RDEPEND="
89 + >=dev-libs/libuv-1.24.0:=
90 + >=net-dns/c-ares-1.15.0
91 + >=net-libs/http-parser-2.8.0:=
92 + >=net-libs/nghttp2-1.34.0
93 + sys-libs/zlib
94 + icu? ( >=dev-libs/icu-63.1:= )
95 + ssl? ( =dev-libs/openssl-1.1.0*:0= )
96 +"
97 +DEPEND="
98 + ${RDEPEND}
99 + ${PYTHON_DEPS}
100 + systemtap? ( dev-util/systemtap )
101 + test? ( net-misc/curl )
102 +"
103 +S="${WORKDIR}/node-v${PV}"
104 +PATCHES=(
105 + "${FILESDIR}"/${PN}-10.3.0-global-npm-config.patch
106 + "${FILESDIR}"/${PN}-11.4.0-llhttp.patch
107 +)
108 +
109 +pkg_pretend() {
110 + (use x86 && ! use cpu_flags_x86_sse2) && \
111 + die "Your CPU doesn't support the required SSE2 instruction."
112 +
113 + ( [[ ${MERGE_TYPE} != "binary" ]] && ! test-flag-CXX -std=c++11 ) && \
114 + die "Your compiler doesn't support C++11. Use GCC 4.8, Clang 3.3 or newer."
115 +}
116 +
117 +src_prepare() {
118 + tc-export CC CXX PKG_CONFIG
119 + export V=1
120 + export BUILDTYPE=Release
121 +
122 + # fix compilation on Darwin
123 + # https://code.google.com/p/gyp/issues/detail?id=260
124 + sed -i -e "/append('-arch/d" tools/gyp/pylib/gyp/xcode_emulation.py || die
125 +
126 + # make sure we use python2.* while using gyp
127 + sed -i -e "s/python/${EPYTHON}/" deps/npm/node_modules/node-gyp/gyp/gyp || die
128 + sed -i -e "s/|| 'python2'/|| '${EPYTHON}'/" deps/npm/node_modules/node-gyp/lib/configure.js || die
129 +
130 + # less verbose install output (stating the same as portage, basically)
131 + sed -i -e "/print/d" tools/install.py || die
132 +
133 + # proper libdir, hat tip @ryanpcmcquen https://github.com/iojs/io.js/issues/504
134 + local LIBDIR=$(get_libdir)
135 + sed -i -e "s|lib/|${LIBDIR}/|g" tools/install.py || die
136 + sed -i -e "s/'lib'/'${LIBDIR}'/" deps/npm/lib/npm.js || die
137 +
138 + # Avoid writing a depfile, not useful
139 + sed -i -e "/DEPFLAGS =/d" tools/gyp/pylib/gyp/generator/make.py || die
140 +
141 + sed -i -e "/'-O3'/d" common.gypi deps/v8/gypfiles/toolchain.gypi || die
142 +
143 + # Avoid a test that I've only been able to reproduce from emerge. It doesnt
144 + # seem sandbox related either (invoking it from a sandbox works fine).
145 + # The issue is that no stdin handle is openened when asked for one.
146 + # It doesn't really belong upstream , so it'll just be removed until someone
147 + # with more gentoo-knowledge than me (jbergstroem) figures it out.
148 + rm test/parallel/test-stdout-close-unref.js || die
149 +
150 + # debug builds. change install path, remove optimisations and override buildtype
151 + if use debug; then
152 + sed -i -e "s|out/Release/|out/Debug/|g" tools/install.py || die
153 + BUILDTYPE=Debug
154 + fi
155 +
156 + default
157 +}
158 +
159 +src_configure() {
160 + local myconf=( --shared-cares --shared-http-parser --shared-libuv --shared-nghttp2 --shared-zlib )
161 + use debug && myconf+=( --debug )
162 + use icu && myconf+=( --with-intl=system-icu ) || myconf+=( --with-intl=none )
163 + use inspector || myconf+=( --without-inspector )
164 + use npm || myconf+=( --without-npm )
165 + use snapshot && myconf+=( --with-snapshot )
166 + use ssl && myconf+=( --shared-openssl ) || myconf+=( --without-ssl )
167 +
168 + local myarch=""
169 + case ${ABI} in
170 + amd64) myarch="x64";;
171 + arm) myarch="arm";;
172 + arm64) myarch="arm64";;
173 + ppc64) myarch="ppc64";;
174 + x32) myarch="x32";;
175 + x86) myarch="ia32";;
176 + *) myarch="${ABI}";;
177 + esac
178 +
179 + GYP_DEFINES="linux_use_gold_flags=0
180 + linux_use_bundled_binutils=0
181 + linux_use_bundled_gold=0" \
182 + "${PYTHON}" configure \
183 + --prefix="${EPREFIX}"/usr \
184 + --dest-cpu=${myarch} \
185 + $(use_with systemtap dtrace) \
186 + "${myconf[@]}" || die
187 +}
188 +
189 +src_compile() {
190 + emake -C out mksnapshot
191 + pax-mark m "out/${BUILDTYPE}/mksnapshot"
192 + emake -C out
193 +}
194 +
195 +src_install() {
196 + local LIBDIR="${ED}/usr/$(get_libdir)"
197 + emake install DESTDIR="${D}"
198 + pax-mark -m "${ED}"usr/bin/node
199 +
200 + # set up a symlink structure that node-gyp expects..
201 + dodir /usr/include/node/deps/{v8,uv}
202 + dosym . /usr/include/node/src
203 + for var in deps/{uv,v8}/include; do
204 + dosym ../.. /usr/include/node/${var}
205 + done
206 +
207 + if use doc; then
208 + # Patch docs to make them offline readable
209 + for i in `grep -rl 'fonts.googleapis.com' "${S}"/out/doc/api/*`; do
210 + sed -i '/fonts.googleapis.com/ d' $i;
211 + done
212 + # Install docs
213 + docinto html
214 + dodoc -r "${S}"/doc/*
215 + fi
216 +
217 + if use npm; then
218 + dodir /etc/npm
219 +
220 + # Install bash completion for `npm`
221 + # We need to temporarily replace default config path since
222 + # npm otherwise tries to write outside of the sandbox
223 + local npm_config="usr/$(get_libdir)/node_modules/npm/lib/config/core.js"
224 + sed -i -e "s|'/etc'|'${ED}/etc'|g" "${ED}/${npm_config}" || die
225 + local tmp_npm_completion_file="$(emktemp)"
226 + "${ED}/usr/bin/npm" completion > "${tmp_npm_completion_file}"
227 + newbashcomp "${tmp_npm_completion_file}" npm
228 + sed -i -e "s|'${ED}/etc'|'/etc'|g" "${ED}/${npm_config}" || die
229 +
230 + # Move man pages
231 + doman "${LIBDIR}"/node_modules/npm/man/man{1,5,7}/*
232 +
233 + # Clean up
234 + rm "${LIBDIR}"/node_modules/npm/{.mailmap,.npmignore,Makefile} || die
235 + rm -rf "${LIBDIR}"/node_modules/npm/{doc,html,man} || die
236 +
237 + local find_exp="-or -name"
238 + local find_name=()
239 + for match in "AUTHORS*" "CHANGELOG*" "CONTRIBUT*" "README*" \
240 + ".travis.yml" ".eslint*" ".wercker.yml" ".npmignore" \
241 + "*.md" "*.markdown" "*.bat" "*.cmd"; do
242 + find_name+=( ${find_exp} "${match}" )
243 + done
244 +
245 + # Remove various development and/or inappropriate files and
246 + # useless docs of dependend packages.
247 + find "${LIBDIR}"/node_modules \
248 + \( -type d -name examples \) -or \( -type f \( \
249 + -iname "LICEN?E*" \
250 + "${find_name[@]}" \
251 + \) \) -exec rm -rf "{}" \;
252 + fi
253 +
254 + mv "${D}"/usr/share/doc/node "${D}"/usr/share/doc/${PF} || die
255 +}
256 +
257 +src_test() {
258 + out/${BUILDTYPE}/cctest || die
259 + "${PYTHON}" tools/test.py --mode=${BUILDTYPE,,} -J message parallel sequential || die
260 +}
261 +
262 +pkg_postinst() {
263 + einfo "The global npm config lives in /etc/npm. This deviates slightly"
264 + einfo "from upstream which otherwise would have it live in /usr/etc/."
265 + einfo ""
266 + einfo "Protip: When using node-gyp to install native modules, you can"
267 + einfo "avoid having to download extras by doing the following:"
268 + einfo "$ node-gyp --nodedir /usr/include/node <command>"
269 +}