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: Sun, 31 Mar 2019 09:57:09
Message-Id: 1554026218.59e63efc47d8a3f34d8edd6242ad1e9472418f28.jer@gentoo
1 commit: 59e63efc47d8a3f34d8edd6242ad1e9472418f28
2 Author: Jeroen Roovers <jer <AT> gentoo <DOT> org>
3 AuthorDate: Sun Mar 31 09:44:39 2019 +0000
4 Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org>
5 CommitDate: Sun Mar 31 09:56:58 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=59e63efc
7
8 net-libs/nodejs: Version 11.13.0
9
10 Package-Manager: Portage-2.3.62, 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/nodejs-11.13.0.ebuild | 209 ++++++++++++++++++++++++++++++++++
15 2 files changed, 210 insertions(+)
16
17 diff --git a/net-libs/nodejs/Manifest b/net-libs/nodejs/Manifest
18 index de3f7946880..6ac3972d59a 100644
19 --- a/net-libs/nodejs/Manifest
20 +++ b/net-libs/nodejs/Manifest
21 @@ -3,6 +3,7 @@ DIST node-v10.15.2.tar.xz 20232972 BLAKE2B 3ffaa0890ddec6b9d00a0b3f32fc62e55a665
22 DIST node-v10.15.3.tar.xz 20262632 BLAKE2B d65d4e274fa829be5cda1970b0ebe7081e8476334cb825e5727324c3202bc015f4ba39589608284d0f8c0b722079c06d1587de5299a3c81ccb7b0eacbdaccf84 SHA512 cf741f733af7a7e1fbd37b0f98110078494b4771dbdfccacfda95a5ea4cda6cdcea4f8d31dddcf27477213614e4ab6cf7d1a1f900cb92936333730737ac4f9e8
23 DIST node-v11.11.0.tar.xz 22094004 BLAKE2B 3ca03a659fc1104bf280510277a74167a2a188ba0798c4723730fb850cae3d4ddc4d5f4bbad88dc9dde8b7f57b02f5d9c47d047bb15668e3488e0a002e225cfb SHA512 c89fd154dfbaa999806429c6e416c4fa2f0d5f3cfb9ac6de8b21f9195681ae0170325ae6fd7ab811f4f394d03c1d56db77ae1c730d5e8ff6a64b9a6dfa2286e8
24 DIST node-v11.12.0.tar.xz 22077236 BLAKE2B 1cd7252983c0e444e0ce183a11af0912c994b2e36a8f50a86ca543f59548629fb3b857a0d106340f44124637e06cf90b2e079a17a30c2bd8386bd6575fac1fd9 SHA512 54d19ee6cb5127298276287f536dca9d4c9389038bb23fc48e8ef0246bcfcf59961ae704a94c68eb67104a230e3b23cbb7c8559aca83f542b35a46b2797d31e4
25 +DIST node-v11.13.0.tar.xz 22085284 BLAKE2B e771c6109b4ca60b3037ec6a4f8138af75b505f35584a239f30d2a349d6de68db2f2183b89a7d5a4bbe2aef1e29fbbea54bc93697362f56c12e2e0b54fcadcd3 SHA512 89411c9b9cbf1df09cbf2b5e3a910d7ef2e4046a27a5af858c53a20f51b9ab2f9aad4e4c7c41936520e1feed249118fc46e4e4458e7980a878f364082c24fd35
26 DIST node-v4.9.1.tar.xz 13250164 BLAKE2B 7a689b99bb4bf507f7f21dd2c096a5766d023a8174c0f468cab37365af1920b8700da04157e1a406917790524255ef32c243a74662fd50ef7d3567d189dac9cf SHA512 690c9fdf608e5194069a10955bdd94ec87cb1c308f13bc4d2cae92fa01436ace10fadf58f2e51d477dde6c570b23edc1c71fafea79bfc9cab2903eb2fa5f87aa
27 DIST node-v6.14.4.tar.xz 15842824 BLAKE2B fc56364be64fe5824e2bb50d861ebf8f58f9895f2c9c108b8df3315b127ffb2755eac85c28165ac9779adab4611ce8f5ea1a5745f43ebaa1389e82b8215c6396 SHA512 1ead0c097ec125230dd631f19a5c3ec06a1371f9ca3b392b5ad08fcc227dd0142f33ad52f96890c2c17448a4951a635b9099dfff00d7d8b3ffb59b07904d1bfa
28 DIST node-v6.17.0.tar.xz 15853760 BLAKE2B f1872b2ed43c447beff2b3278e49f9f10bbef58bba2640f6ecd889facfa4c5e5ae142f3b30721faae615df42c0870d7c09147930a259fa81c161b29559e2a340 SHA512 8ae9bfa0336a7d0d9f4a372330de1f877354a3d68bdd6977285787f81999012e42faf4ccef5981fe565ea9e2f18c5490b857bab29359fdf906b5a9fb14628858
29
30 diff --git a/net-libs/nodejs/nodejs-11.13.0.ebuild b/net-libs/nodejs/nodejs-11.13.0.ebuild
31 new file mode 100644
32 index 00000000000..e6048ec9137
33 --- /dev/null
34 +++ b/net-libs/nodejs/nodejs-11.13.0.ebuild
35 @@ -0,0 +1,209 @@
36 +# Copyright 1999-2019 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.27.0:=
62 + >=net-dns/c-ares-1.15.0
63 + >=net-libs/http-parser-2.9.0:=
64 + >=net-libs/nghttp2-1.34.0
65 + sys-libs/zlib
66 + icu? ( >=dev-libs/icu-63.1:= )
67 + ssl? ( >=dev-libs/openssl-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 + "${FILESDIR}"/${PN}-99999999-llhttp.patch
78 +)
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 + local myconf=(
133 + --shared-cares --shared-http-parser --shared-libuv --shared-nghttp2
134 + --shared-zlib
135 + )
136 + use debug && myconf+=( --debug )
137 + use icu && myconf+=( --with-intl=system-icu ) || myconf+=( --with-intl=none )
138 + use inspector || myconf+=( --without-inspector )
139 + use npm || myconf+=( --without-npm )
140 + use snapshot && myconf+=( --with-snapshot )
141 + use ssl && myconf+=( --shared-openssl ) || myconf+=( --without-ssl )
142 +
143 + local myarch=""
144 + case ${ABI} in
145 + amd64) myarch="x64";;
146 + arm) myarch="arm";;
147 + arm64) myarch="arm64";;
148 + ppc64) myarch="ppc64";;
149 + x32) myarch="x32";;
150 + x86) myarch="ia32";;
151 + *) myarch="${ABI}";;
152 + esac
153 +
154 + GYP_DEFINES="linux_use_gold_flags=0
155 + linux_use_bundled_binutils=0
156 + linux_use_bundled_gold=0" \
157 + "${PYTHON}" configure \
158 + --prefix="${EPREFIX}"/usr \
159 + --dest-cpu=${myarch} \
160 + $(use_with systemtap dtrace) \
161 + "${myconf[@]}" || die
162 +}
163 +
164 +src_compile() {
165 + emake -C out mksnapshot
166 + pax-mark m "out/${BUILDTYPE}/mksnapshot"
167 + emake -C out
168 +}
169 +
170 +src_install() {
171 + local LIBDIR="${ED}/usr/$(get_libdir)"
172 + emake install DESTDIR="${D}"
173 + pax-mark -m "${ED}"usr/bin/node
174 +
175 + # set up a symlink structure that node-gyp expects..
176 + dodir /usr/include/node/deps/{v8,uv}
177 + dosym . /usr/include/node/src
178 + for var in deps/{uv,v8}/include; do
179 + dosym ../.. /usr/include/node/${var}
180 + done
181 +
182 + if use doc; then
183 + # Patch docs to make them offline readable
184 + for i in `grep -rl 'fonts.googleapis.com' "${S}"/out/doc/api/*`; do
185 + sed -i '/fonts.googleapis.com/ d' $i;
186 + done
187 + # Install docs
188 + docinto html
189 + dodoc -r "${S}"/doc/*
190 + fi
191 +
192 + if use npm; then
193 + dodir /etc/npm
194 +
195 + # Install bash completion for `npm`
196 + # We need to temporarily replace default config path since
197 + # npm otherwise tries to write outside of the sandbox
198 + local npm_config="usr/$(get_libdir)/node_modules/npm/lib/config/core.js"
199 + sed -i -e "s|'/etc'|'${ED}/etc'|g" "${ED}/${npm_config}" || die
200 + local tmp_npm_completion_file="$(emktemp)"
201 + "${ED}/usr/bin/npm" completion > "${tmp_npm_completion_file}"
202 + newbashcomp "${tmp_npm_completion_file}" npm
203 + sed -i -e "s|'${ED}/etc'|'/etc'|g" "${ED}/${npm_config}" || die
204 +
205 + # Move man pages
206 + doman "${LIBDIR}"/node_modules/npm/man/man{1,5,7}/*
207 +
208 + # Clean up
209 + rm "${LIBDIR}"/node_modules/npm/{.mailmap,.npmignore,Makefile} || die
210 + rm -rf "${LIBDIR}"/node_modules/npm/{doc,html,man} || die
211 +
212 + local find_exp="-or -name"
213 + local find_name=()
214 + for match in "AUTHORS*" "CHANGELOG*" "CONTRIBUT*" "README*" \
215 + ".travis.yml" ".eslint*" ".wercker.yml" ".npmignore" \
216 + "*.md" "*.markdown" "*.bat" "*.cmd"; do
217 + find_name+=( ${find_exp} "${match}" )
218 + done
219 +
220 + # Remove various development and/or inappropriate files and
221 + # useless docs of dependend packages.
222 + find "${LIBDIR}"/node_modules \
223 + \( -type d -name examples \) -or \( -type f \( \
224 + -iname "LICEN?E*" \
225 + "${find_name[@]}" \
226 + \) \) -exec rm -rf "{}" \;
227 + fi
228 +
229 + mv "${ED}"/usr/share/doc/node "${ED}"/usr/share/doc/${PF} || die
230 +}
231 +
232 +src_test() {
233 + out/${BUILDTYPE}/cctest || die
234 + "${PYTHON}" tools/test.py --mode=${BUILDTYPE,,} -J message parallel sequential || die
235 +}
236 +
237 +pkg_postinst() {
238 + elog "The global npm config lives in /etc/npm. This deviates slightly"
239 + elog "from upstream which otherwise would have it live in /usr/etc/."
240 + elog ""
241 + elog "Protip: When using node-gyp to install native modules, you can"
242 + elog "avoid having to download extras by doing the following:"
243 + elog "$ node-gyp --nodedir /usr/include/node <command>"
244 +}