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