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