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, 06 Dec 2017 05:27:08
Message-Id: 1512537985.1cedc85ca64cf5406a418faeb12ae57c4a0828ba.jer@gentoo
1 commit: 1cedc85ca64cf5406a418faeb12ae57c4a0828ba
2 Author: Jeroen Roovers <jer <AT> gentoo <DOT> org>
3 AuthorDate: Wed Dec 6 05:26:25 2017 +0000
4 Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org>
5 CommitDate: Wed Dec 6 05:26:25 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1cedc85c
7
8 net-libs/nodejs: Version bump.
9
10 Package-Manager: Portage-2.3.16, Repoman-2.3.6
11
12 net-libs/nodejs/Manifest | 1 +
13 net-libs/nodejs/nodejs-8.9.2.ebuild | 203 ++++++++++++++++++++++++++++++++++++
14 2 files changed, 204 insertions(+)
15
16 diff --git a/net-libs/nodejs/Manifest b/net-libs/nodejs/Manifest
17 index 40179db7960..04a83a69ca9 100644
18 --- a/net-libs/nodejs/Manifest
19 +++ b/net-libs/nodejs/Manifest
20 @@ -3,4 +3,5 @@ DIST node-v4.8.5.tar.xz 13316060 BLAKE2B fb32f176b9d4add3e9695f0bee7ebd0bba66770
21 DIST node-v6.11.5.tar.xz 15699404 BLAKE2B ba2df91bf5ef38cedb60b42919cf56f16807e619a81876fc92a5741e49da7ec91c4239d00f549c5e80d0bb8282bb9b396dd984507916cd18d61b403a3a7cef94 SHA512 62490725ef7957294c1bddf21ef0626c7472876791210168116501255ecee58457e9de9b044e10033706243299bbfd1495efeca169596fbf26f5eeba6d8fa4c9
22 DIST node-v6.9.4.tar.xz 15519264 BLAKE2B 4dfad88b06b209272b8468501cc3c87c40425781fb55011ee93326555c2df88a166ffaff1877563668e06389703053849361739556f1bc87c1e2386d48b9542e SHA512 86d3e2889031c2b50c021bd3fd63194c2c22c44291d51dff1b5e1652b01853c09d2880c2f58fdad062e3e2a3f637a3f0d78dac66b835b676790cf272e64f8dce
23 DIST node-v8.9.1.tar.xz 18290848 BLAKE2B b2a89d759bd19df6a6ea8db31ab3e63d111f24d9e00dbd8cdfc2d5d89a56ee7789c51b936516cdbce8384cc91591f4c1fb1eb0f2b3c18148a9211168cfe8121f SHA512 e1d93def34c1b91de90b807031e2f313661658cd045d44d290950190b10512770df05cb92e9657bab7ad6654d3359364193567cf693ddb2b3574d2a48e4ee256
24 +DIST node-v8.9.2.tar.xz 18294828 BLAKE2B dab8389814baa3b965050aa15f70410a1de376431d5be1026176ddccf44c94068e6ce724b3b0f0d4fb33fc16cb91ca91177926c1efed1453c200799da4ccea51 SHA512 94d442c69eea1548281bd068a6dd1fb2a8ccddda3615dd2a364e7f9095554f6d114e3aeba0034198cfa3e0782506a36c56a7c75a86a099478ca456d15fee0da7
25 DIST node-v9.2.0.tar.xz 18347108 BLAKE2B ff98445ac3e7649b4c6fde3a2fe8375e541f7e120d0b2dbd39a07f3953784793752a927c99a74da50f34cfe1447672f8b14af84a56e899fd46e52b9a7f8d19bc SHA512 3335a2ec17f4698bda58f2a2c9548546912b9a4109c0bff0ffc57bca14d40101bcc00356231c95c08733860286ac340e227ca79debac581835f84ae3967cdb4b
26
27 diff --git a/net-libs/nodejs/nodejs-8.9.2.ebuild b/net-libs/nodejs/nodejs-8.9.2.ebuild
28 new file mode 100644
29 index 00000000000..e3f1fec1f46
30 --- /dev/null
31 +++ b/net-libs/nodejs/nodejs-8.9.2.ebuild
32 @@ -0,0 +1,203 @@
33 +# Copyright 1999-2017 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 +"
56 +
57 +RDEPEND="
58 + >=dev-libs/libuv-1.15.0:=
59 + >=net-libs/http-parser-2.7.0:=
60 + >=net-libs/nghttp2-1.25.0
61 + sys-libs/zlib
62 + icu? ( >=dev-libs/icu-56:= )
63 + npm? ( ${PYTHON_DEPS} )
64 + ssl? ( >=dev-libs/openssl-1.0.2g: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}"/gentoo-global-npm-config.patch
75 + "${FILESDIR}"/nodejs-8.9.0-shared-nghttp2.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 -e "s|lib/|${LIBDIR}/|g" tools/install.py || die
105 + sed -i -e "s/'lib'/'${LIBDIR}'/" lib/module.js deps/npm/lib/npm.js || die
106 +
107 + # Avoid writing a depfile, not useful
108 + sed -i -e "/DEPFLAGS =/d" tools/gyp/pylib/gyp/generator/make.py || die
109 +
110 + sed -i -e "/'-O3'/d" common.gypi deps/v8/gypfiles/toolchain.gypi || die
111 +
112 + # Avoid a test that I've only been able to reproduce from emerge. It doesnt
113 + # seem sandbox related either (invoking it from a sandbox works fine).
114 + # The issue is that no stdin handle is openened when asked for one.
115 + # It doesn't really belong upstream , so it'll just be removed until someone
116 + # with more gentoo-knowledge than me (jbergstroem) figures it out.
117 + rm test/parallel/test-stdout-close-unref.js || die
118 +
119 + # debug builds. change install path, remove optimisations and override buildtype
120 + if use debug; then
121 + sed -i -e "s|out/Release/|out/Debug/|g" tools/install.py || die
122 + BUILDTYPE=Debug
123 + fi
124 +
125 + default
126 +}
127 +
128 +src_configure() {
129 + local myconf=( --shared-http-parser --shared-libuv --shared-nghttp2 --shared-zlib )
130 + use debug && myconf+=( --debug )
131 + use icu && myconf+=( --with-intl=system-icu ) || myconf+=( --with-intl=none )
132 + use inspector || myconf+=( --without-inspector )
133 + use npm || myconf+=( --without-npm )
134 + use snapshot && myconf+=( --with-snapshot )
135 + use ssl && myconf+=( --shared-openssl ) || myconf+=( --without-ssl )
136 +
137 + local myarch=""
138 + case ${ABI} in
139 + amd64) myarch="x64";;
140 + arm) myarch="arm";;
141 + arm64) myarch="arm64";;
142 + ppc64) myarch="ppc64";;
143 + x32) myarch="x32";;
144 + x86) myarch="ia32";;
145 + *) myarch="${ABI}";;
146 + esac
147 +
148 + GYP_DEFINES="linux_use_gold_flags=0
149 + linux_use_bundled_binutils=0
150 + linux_use_bundled_gold=0" \
151 + "${PYTHON}" configure \
152 + --prefix="${EPREFIX}"/usr \
153 + --dest-cpu=${myarch} \
154 + $(use_with systemtap dtrace) \
155 + "${myconf[@]}" || die
156 +}
157 +
158 +src_compile() {
159 + emake -C out mksnapshot
160 + pax-mark m "out/${BUILDTYPE}/mksnapshot"
161 + emake -C out
162 +}
163 +
164 +src_install() {
165 + local LIBDIR="${ED}/usr/$(get_libdir)"
166 + emake install DESTDIR="${D}"
167 + pax-mark -m "${ED}"usr/bin/node
168 +
169 + # set up a symlink structure that node-gyp expects..
170 + dodir /usr/include/node/deps/{v8,uv}
171 + dosym . /usr/include/node/src
172 + for var in deps/{uv,v8}/include; do
173 + dosym ../.. /usr/include/node/${var}
174 + done
175 +
176 + if use doc; then
177 + # Patch docs to make them offline readable
178 + for i in `grep -rl 'fonts.googleapis.com' "${S}"/out/doc/api/*`; do
179 + sed -i '/fonts.googleapis.com/ d' $i;
180 + done
181 + # Install docs!
182 + dohtml -r "${S}"/doc/*
183 + fi
184 +
185 + if use npm; then
186 + dodir /etc/npm
187 +
188 + # Install bash completion for `npm`
189 + # We need to temporarily replace default config path since
190 + # npm otherwise tries to write outside of the sandbox
191 + local npm_config="usr/$(get_libdir)/node_modules/npm/lib/config/core.js"
192 + sed -i -e "s|'/etc'|'${ED}/etc'|g" "${ED}/${npm_config}" || die
193 + local tmp_npm_completion_file="$(emktemp)"
194 + "${ED}/usr/bin/npm" completion > "${tmp_npm_completion_file}"
195 + newbashcomp "${tmp_npm_completion_file}" npm
196 + sed -i -e "s|'${ED}/etc'|'/etc'|g" "${ED}/${npm_config}" || die
197 +
198 + # Move man pages
199 + doman "${LIBDIR}"/node_modules/npm/man/man{1,5,7}/*
200 +
201 + # Clean up
202 + rm "${LIBDIR}"/node_modules/npm/{.mailmap,.npmignore,Makefile} || die
203 + rm -rf "${LIBDIR}"/node_modules/npm/{doc,html,man} || die
204 +
205 + local find_exp="-or -name"
206 + local find_name=()
207 + for match in "AUTHORS*" "CHANGELOG*" "CONTRIBUT*" "README*" \
208 + ".travis.yml" ".eslint*" ".wercker.yml" ".npmignore" \
209 + "*.md" "*.markdown" "*.bat" "*.cmd"; do
210 + find_name+=( ${find_exp} "${match}" )
211 + done
212 +
213 + # Remove various development and/or inappropriate files and
214 + # useless docs of dependend packages.
215 + find "${LIBDIR}"/node_modules \
216 + \( -type d -name examples \) -or \( -type f \( \
217 + -iname "LICEN?E*" \
218 + "${find_name[@]}" \
219 + \) \) -exec rm -rf "{}" \;
220 + fi
221 +}
222 +
223 +src_test() {
224 + out/${BUILDTYPE}/cctest || die
225 + "${PYTHON}" tools/test.py --mode=${BUILDTYPE,,} -J message parallel sequential || die
226 +}
227 +
228 +pkg_postinst() {
229 + einfo "The global npm config lives in /etc/npm. This deviates slightly"
230 + einfo "from upstream which otherwise would have it live in /usr/etc/."
231 + einfo ""
232 + einfo "Protip: When using node-gyp to install native modules, you can"
233 + einfo "avoid having to download extras by doing the following:"
234 + einfo "$ node-gyp --nodedir /usr/include/node <command>"
235 +}