Gentoo Archives: gentoo-commits

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