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