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: Thu, 05 Sep 2019 05:11:23
Message-Id: 1567660274.4bae522f319b1d986edea344f8a3789049442337.jer@gentoo
1 commit: 4bae522f319b1d986edea344f8a3789049442337
2 Author: Jeroen Roovers <jer <AT> gentoo <DOT> org>
3 AuthorDate: Thu Sep 5 05:10:02 2019 +0000
4 Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org>
5 CommitDate: Thu Sep 5 05:11:14 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4bae522f
7
8 net-libs/nodejs: Version 12.10.0
9
10 Package-Manager: Portage-2.3.75, Repoman-2.3.17
11 Signed-off-by: Jeroen Roovers <jer <AT> gentoo.org>
12
13 net-libs/nodejs/Manifest | 1 +
14 net-libs/nodejs/nodejs-12.10.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 664dd51eb72..bc4372a060d 100644
19 --- a/net-libs/nodejs/Manifest
20 +++ b/net-libs/nodejs/Manifest
21 @@ -1,5 +1,6 @@
22 DIST node-v0.12.18.tar.gz 19842591 BLAKE2B f94f4de6e2875267be194580c645087a262b90da99f10d651a22838c041da07056df81204bb04ce8da083a080062509dcca4d1e3ac2250d651ead8a4cc025028 SHA512 6866608a43eb213f3b715ea0fcc28983fd959ab679c567a1b464f62acd936506f2bce88ea48a60209d8ef8d98259f4b47cd3434893eb4ff82a132775edb37b7b
23 DIST node-v10.16.3.tar.xz 21505540 BLAKE2B 2ae6c3ce96a42cb72a388ca7727affb1e2eae06b997098bd8cad2b339b888f1f188c868d39631c51e10ef7b3a5a9173a3b016afe9fa7a4fb74c24a584781c329 SHA512 5d5457adaae87e41699cdf5bd62d32e9590248f7dadd583614cca9078a1749a4ee477433ebbe4278ec872fdfc377d99097c1e06073e0fd47c8c6597256ccdeb7
24 +DIST node-v12.10.0.tar.xz 22726116 BLAKE2B deb6ecaec54233050eaeb335d58020b8a82009bbab51c41c00784cab3003e57dbc96f3c25715deefbb5b3aee704b3db920cbb650af33cbcb1a62c1bb654f48f8 SHA512 7eb57b40effa9627b93c74ddc01ce1c044e878c669969c506ed40f72a7946c7c6951931c4fe4fbef456386ad459f7f4f1d0f04177e38343375aa463974ca1dba
25 DIST node-v12.9.0.tar.xz 22724192 BLAKE2B 6d71db0013650372ca10ff66bc34593b91d93169f90351bedd1044fab248047d3dbc6cb40e2026fd9dd460e4f6f95a4b24d234899e6ea3665489745100550ef8 SHA512 d6de30d0e38719dd2997e5312a81d86757d46de01f3214b04c3ee28a643c945fdc27d2179d06ceb7bc12cdafcefd1edee5da2618463ee214bee8e57bdacd0a8b
26 DIST node-v12.9.1.tar.xz 22714668 BLAKE2B c2ab1d67d1f9cf9dee4a1fcb0f1f8f23e2536f526290baf9d5dd05867695f763d8cd8e501b044cb42b383a897f5e016c7a57aecc2d5a4ca58ab3d50020db1f07 SHA512 efe5fbf0545a3e9c37c7598abd89841073cfafefc04a9b5f9f95c8c51357bf3d5384701fd5524ff8fcaef833bca87c72cbf1f8755ee406e9437ad8ad875af18e
27 DIST node-v4.9.1.tar.xz 13250164 BLAKE2B 7a689b99bb4bf507f7f21dd2c096a5766d023a8174c0f468cab37365af1920b8700da04157e1a406917790524255ef32c243a74662fd50ef7d3567d189dac9cf SHA512 690c9fdf608e5194069a10955bdd94ec87cb1c308f13bc4d2cae92fa01436ace10fadf58f2e51d477dde6c570b23edc1c71fafea79bfc9cab2903eb2fa5f87aa
28
29 diff --git a/net-libs/nodejs/nodejs-12.10.0.ebuild b/net-libs/nodejs/nodejs-12.10.0.ebuild
30 new file mode 100644
31 index 00000000000..c6d70169aef
32 --- /dev/null
33 +++ b/net-libs/nodejs/nodejs-12.10.0.ebuild
34 @@ -0,0 +1,206 @@
35 +# Copyright 1999-2019 Gentoo Authors
36 +# Distributed under the terms of the GNU General Public License v2
37 +
38 +EAPI=7
39 +PYTHON_COMPAT=( python2_7 )
40 +PYTHON_REQ_USE="threads"
41 +inherit bash-completion-r1 flag-o-matic pax-utils python-any-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 inspector +npm +snapshot +ssl systemtap test"
51 +REQUIRED_USE="
52 + inspector? ( icu ssl )
53 + npm? ( ssl )
54 +"
55 +
56 +RDEPEND="
57 + >=dev-libs/libuv-1.31.0:=
58 + >=net-dns/c-ares-1.15.0
59 + >=net-libs/http-parser-2.8.0:=
60 + >=net-libs/nghttp2-1.39.2
61 + sys-libs/zlib
62 + icu? ( >=dev-libs/icu-64.2:= )
63 + ssl? ( >=dev-libs/openssl-1.1.1:0= )
64 +"
65 +DEPEND="
66 + ${RDEPEND}
67 + ${PYTHON_DEPS}
68 + systemtap? ( dev-util/systemtap )
69 + test? ( net-misc/curl )
70 +"
71 +PATCHES=(
72 + "${FILESDIR}"/${PN}-10.3.0-global-npm-config.patch
73 + "${FILESDIR}"/${PN}-99999999-llhttp.patch
74 +)
75 +S="${WORKDIR}/node-v${PV}"
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 +
97 + # less verbose install output (stating the same as portage, basically)
98 + sed -i -e "/print/d" tools/install.py || die
99 +
100 + # proper libdir, hat tip @ryanpcmcquen https://github.com/iojs/io.js/issues/504
101 + local LIBDIR=$(get_libdir)
102 + sed -i -e "s|lib/|${LIBDIR}/|g" tools/install.py || die
103 + sed -i -e "s/'lib'/'${LIBDIR}'/" deps/npm/lib/npm.js || die
104 +
105 + # Avoid writing a depfile, not useful
106 + sed -i -e "/DEPFLAGS =/d" tools/gyp/pylib/gyp/generator/make.py || die
107 +
108 + sed -i -e "/'-O3'/d" common.gypi node.gypi || die
109 +
110 + # Avoid a test that I've only been able to reproduce from emerge. It doesnt
111 + # seem sandbox related either (invoking it from a sandbox works fine).
112 + # The issue is that no stdin handle is openened when asked for one.
113 + # It doesn't really belong upstream , so it'll just be removed until someone
114 + # with more gentoo-knowledge than me (jbergstroem) figures it out.
115 + rm test/parallel/test-stdout-close-unref.js || die
116 +
117 + # debug builds. change install path, remove optimisations and override buildtype
118 + if use debug; then
119 + sed -i -e "s|out/Release/|out/Debug/|g" tools/install.py || die
120 + BUILDTYPE=Debug
121 + fi
122 +
123 + default
124 +}
125 +
126 +src_configure() {
127 + local myconf=(
128 + --shared-cares --shared-http-parser --shared-libuv --shared-nghttp2
129 + --shared-zlib
130 + )
131 + use debug && myconf+=( --debug )
132 + use icu && myconf+=( --with-intl=system-icu ) || myconf+=( --with-intl=none )
133 + use inspector || myconf+=( --without-inspector )
134 + use npm || myconf+=( --without-npm )
135 + use snapshot && myconf+=( --with-snapshot )
136 + use ssl && myconf+=( --shared-openssl --openssl-use-def-ca-store ) || myconf+=( --without-ssl )
137 +
138 + local myarch=""
139 + case ${ABI} in
140 + amd64) myarch="x64";;
141 + arm) myarch="arm";;
142 + arm64) myarch="arm64";;
143 + ppc64) myarch="ppc64";;
144 + x32) myarch="x32";;
145 + x86) myarch="ia32";;
146 + *) myarch="${ABI}";;
147 + esac
148 +
149 + GYP_DEFINES="linux_use_gold_flags=0
150 + linux_use_bundled_binutils=0
151 + linux_use_bundled_gold=0" \
152 + "${PYTHON}" configure \
153 + --prefix="${EPREFIX}"/usr \
154 + --dest-cpu=${myarch} \
155 + $(use_with systemtap dtrace) \
156 + "${myconf[@]}" || die
157 +}
158 +
159 +src_compile() {
160 + emake -C out mksnapshot
161 + pax-mark m "out/${BUILDTYPE}/mksnapshot"
162 + emake -C out
163 +}
164 +
165 +src_install() {
166 + local LIBDIR="${ED}/usr/$(get_libdir)"
167 + default
168 +
169 + pax-mark -m "${ED}"/usr/bin/node
170 +
171 + # set up a symlink structure that node-gyp expects..
172 + dodir /usr/include/node/deps/{v8,uv}
173 + dosym . /usr/include/node/src
174 + for var in deps/{uv,v8}/include; do
175 + dosym ../.. /usr/include/node/${var}
176 + done
177 +
178 + if use doc; then
179 + # Patch docs to make them offline readable
180 + for i in `grep -rl 'fonts.googleapis.com' "${S}"/out/doc/api/*`; do
181 + sed -i '/fonts.googleapis.com/ d' $i;
182 + done
183 + # Install docs
184 + docinto html
185 + dodoc -r "${S}"/doc/*
186 + fi
187 +
188 + if use npm; then
189 + dodir /etc/npm
190 +
191 + # Install bash completion for `npm`
192 + # We need to temporarily replace default config path since
193 + # npm otherwise tries to write outside of the sandbox
194 + local npm_config="usr/$(get_libdir)/node_modules/npm/lib/config/core.js"
195 + sed -i -e "s|'/etc'|'${ED}/etc'|g" "${ED}/${npm_config}" || die
196 + local tmp_npm_completion_file="$(emktemp)"
197 + "${ED}/usr/bin/npm" completion > "${tmp_npm_completion_file}"
198 + newbashcomp "${tmp_npm_completion_file}" npm
199 + sed -i -e "s|'${ED}/etc'|'/etc'|g" "${ED}/${npm_config}" || die
200 +
201 + # Move man pages
202 + doman "${LIBDIR}"/node_modules/npm/man/man{1,5,7}/*
203 +
204 + # Clean up
205 + rm "${LIBDIR}"/node_modules/npm/{.mailmap,.npmignore,Makefile} || die
206 + rm -rf "${LIBDIR}"/node_modules/npm/{doc,html,man} || die
207 +
208 + local find_exp="-or -name"
209 + local find_name=()
210 + for match in "AUTHORS*" "CHANGELOG*" "CONTRIBUT*" "README*" \
211 + ".travis.yml" ".eslint*" ".wercker.yml" ".npmignore" \
212 + "*.md" "*.markdown" "*.bat" "*.cmd"; do
213 + find_name+=( ${find_exp} "${match}" )
214 + done
215 +
216 + # Remove various development and/or inappropriate files and
217 + # useless docs of dependend packages.
218 + find "${LIBDIR}"/node_modules \
219 + \( -type d -name examples \) -or \( -type f \( \
220 + -iname "LICEN?E*" \
221 + "${find_name[@]}" \
222 + \) \) -exec rm -rf "{}" \;
223 + fi
224 +
225 + mv "${ED}"/usr/share/doc/node "${ED}"/usr/share/doc/${PF} || die
226 +}
227 +
228 +src_test() {
229 + out/${BUILDTYPE}/cctest || die
230 + "${PYTHON}" tools/test.py --mode=${BUILDTYPE,,} -J message parallel sequential || die
231 +}
232 +
233 +pkg_postinst() {
234 + elog "The global npm config lives in /etc/npm. This deviates slightly"
235 + elog "from upstream which otherwise would have it live in /usr/etc/."
236 + elog ""
237 + elog "Protip: When using node-gyp to install native modules, you can"
238 + elog "avoid having to download extras by doing the following:"
239 + elog "$ node-gyp --nodedir /usr/include/node <command>"
240 +}