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, 08 Jan 2020 06:12:53
Message-Id: 1578463966.3889b78495208c45ca92b9cd5dd156fc858cc20f.jer@gentoo
1 commit: 3889b78495208c45ca92b9cd5dd156fc858cc20f
2 Author: Jeroen Roovers <jer <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jan 8 05:53:51 2020 +0000
4 Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org>
5 CommitDate: Wed Jan 8 06:12:46 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3889b784
7
8 net-libs/nodejs: Version 12.14.1
9
10 Package-Manager: Portage-2.3.84, Repoman-2.3.20
11 Signed-off-by: Jeroen Roovers <jer <AT> gentoo.org>
12
13 net-libs/nodejs/Manifest | 1 +
14 net-libs/nodejs/nodejs-12.14.1.ebuild | 208 ++++++++++++++++++++++++++++++++++
15 2 files changed, 209 insertions(+)
16
17 diff --git a/net-libs/nodejs/Manifest b/net-libs/nodejs/Manifest
18 index 3ce91c9ba15..4759219d478 100644
19 --- a/net-libs/nodejs/Manifest
20 +++ b/net-libs/nodejs/Manifest
21 @@ -2,6 +2,7 @@ DIST node-v10.17.0.tar.xz 21514260 BLAKE2B a37793d78e14d1d2ca861c39f27c5e1dbb47a
22 DIST node-v10.18.0.tar.xz 21913328 BLAKE2B 84b0b5157671dcc3e96bb2cfd11e085251fd2942c03b27491f712f5603797bab7503d8f7c0eb45ca8e348b20a0555c1767d4d1964fff474c8590a47eb01523a5 SHA512 8fc9062e150af6f054f1ebebbdf67151b16f14bcca9cbb35338a4c7fcd7fa1c3f05c4a7ace12d4153180cec0007a195cbc94942c4d04c3895384dc18951d2c1c
23 DIST node-v12.13.0.tar.xz 22862096 BLAKE2B b0121f45b535bac7baa0103db538070b4beb4b40a6c871c217eebfb1abb5a7821d83d46946047b3385af182f901c0390eb85134c9201be2d03b5745b297271f8 SHA512 a7aa8b1f010ea1df122d9d7b88ee0a9d10e0d79ae2f3d18c706ac6ce36e2e2039c21ea6f3dba3a22a79ed3f6069850a8a3c463dbd64e1e8f4a9dbe8901a89cc8
24 DIST node-v12.14.0.tar.xz 23244684 BLAKE2B 0e25cbba5e256b139efd45908236f008834afdf01f57a8e84c7e55ba950e56b786cd52eba9a02986eb0e1d38cbf6df38e1cd719d7dcd8085e8c71767adf8155e SHA512 12e887709a54be911c5a81ab7b7be995247b47ebbd2954ca942f9ed8a784ae1a8e4bdb2613e5bb671196f9101d8861cd29e10650a3f0c414db4d096df94b309b
25 +DIST node-v12.14.1.tar.xz 23258936 BLAKE2B 125289ce3e342c2e5e7bbb6f0b1af109f0ba8fbf2d6630f2cdc4aa31c25a3d846afe773e84daed9824360a6680a2d21378af4fbc42c6337399a143f92850a82f SHA512 2e2b6fa8351b59450ab5491b5e31dc36ce4d9be13c55a14e6e4d95a82cc8334f9fc35261a56a8843903f8021ff333a333bb4d5f24c92b5d7483d4779c3d88342
26 DIST node-v13.4.0.tar.xz 32685788 BLAKE2B 4dfa1a6279ad26c0226a8bcdbf5e64c4fce686cacca805302f1a4dc113b60f96340fdb9968bdcd10db71a2c80007f5e0b94fe2cf78590aa9d62e5de61901ce81 SHA512 25da5a8561b6d811c78f23bd9bffa3789c4bca35270c350ed028ca6c72b59cf6e71997873d7fee024b6abc9cc1a000b0dc9bc6b6963128e198e36c8379bb2b8f
27 DIST node-v13.5.0.tar.xz 32706024 BLAKE2B 570b2d676919cb333e2f36529e886039f7abfc4f7cd705cabbb2a1115918aa9ffc9d1e54a90e8deac09488f248c007721c090ed0500f113af81b2cda2e8248be SHA512 85bad55334e6ef63be0dbf90cef856c0a0835aa1b32e6ffc418b6a52f88f7ee266505f769f4204c000c766869cd85f7d914c9a3592dd52bcabdb6cb906f433e3
28 DIST node-v8.12.0.tar.xz 18310452 BLAKE2B 79634fc57cd76a97e72bab4be37da91d5eff4d13cdaa2b48e83f013885fa3590ba4a28378baf036ed26b7304bf234753d1d4014f72571496f5bb6cd5b221e5f0 SHA512 665d2dba287d78bcd723d7b4d00a6897fb996f4aa69a541e010a3dfeb2614257892117fcce7123966b1ecaddc9269a6667e0e262df693baea1f476c96de55c42
29
30 diff --git a/net-libs/nodejs/nodejs-12.14.1.ebuild b/net-libs/nodejs/nodejs-12.14.1.ebuild
31 new file mode 100644
32 index 00000000000..a9a42fa11ba
33 --- /dev/null
34 +++ b/net-libs/nodejs/nodejs-12.14.1.ebuild
35 @@ -0,0 +1,208 @@
36 +# Copyright 1999-2020 Gentoo Authors
37 +# Distributed under the terms of the GNU General Public License v2
38 +
39 +EAPI=7
40 +PYTHON_COMPAT=( python{2_7,3_{6,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.33.1:=
61 + >=net-dns/c-ares-1.15.0
62 + >=net-libs/http-parser-2.9.0:=
63 + >=net-libs/nghttp2-1.40.0
64 + sys-libs/zlib
65 + icu? ( >=dev-libs/icu-64.2:= )
66 + ssl? ( >=dev-libs/openssl-1.1.1:0= )
67 +"
68 +BDEPEND="
69 + ${PYTHON_DEPS}
70 + systemtap? ( dev-util/systemtap )
71 + test? ( net-misc/curl )
72 +"
73 +DEPEND="
74 + ${RDEPEND}
75 +"
76 +PATCHES=(
77 + "${FILESDIR}"/${PN}-10.3.0-global-npm-config.patch
78 + "${FILESDIR}"/${PN}-99999999-llhttp.patch
79 +)
80 +RESTRICT="test"
81 +S="${WORKDIR}/node-v${PV}"
82 +
83 +pkg_pretend() {
84 + (use x86 && ! use cpu_flags_x86_sse2) && \
85 + die "Your CPU doesn't support the required SSE2 instruction."
86 +
87 + ( [[ ${MERGE_TYPE} != "binary" ]] && ! test-flag-CXX -std=c++11 ) && \
88 + die "Your compiler doesn't support C++11. Use GCC 4.8, Clang 3.3 or newer."
89 +}
90 +
91 +src_prepare() {
92 + tc-export CC CXX PKG_CONFIG
93 + export V=1
94 + export BUILDTYPE=Release
95 +
96 + # fix compilation on Darwin
97 + # https://code.google.com/p/gyp/issues/detail?id=260
98 + sed -i -e "/append('-arch/d" tools/gyp/pylib/gyp/xcode_emulation.py || 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
134 + --shared-http-parser
135 + --shared-libuv
136 + --shared-nghttp2
137 + --shared-zlib
138 + )
139 + use debug && myconf+=( --debug )
140 + use icu && myconf+=( --with-intl=system-icu ) || myconf+=( --with-intl=none )
141 + use inspector || myconf+=( --without-inspector )
142 + use npm || myconf+=( --without-npm )
143 + use snapshot && myconf+=( --with-snapshot )
144 + use ssl && myconf+=( --shared-openssl --openssl-use-def-ca-store ) || myconf+=( --without-ssl )
145 +
146 + local myarch=""
147 + case ${ABI} in
148 + amd64) myarch="x64";;
149 + arm) myarch="arm";;
150 + arm64) myarch="arm64";;
151 + ppc64) myarch="ppc64";;
152 + x32) myarch="x32";;
153 + x86) myarch="ia32";;
154 + *) myarch="${ABI}";;
155 + esac
156 +
157 + GYP_DEFINES="linux_use_gold_flags=0
158 + linux_use_bundled_binutils=0
159 + linux_use_bundled_gold=0" \
160 + "${EPYTHON}" configure.py \
161 + --prefix="${EPREFIX}"/usr \
162 + --dest-cpu=${myarch} \
163 + $(use_with systemtap dtrace) \
164 + "${myconf[@]}" || die
165 +}
166 +
167 +src_compile() {
168 + emake -C out mksnapshot
169 + pax-mark m "out/${BUILDTYPE}/mksnapshot"
170 + emake -C out
171 +}
172 +
173 +src_install() {
174 + local LIBDIR="${ED}/usr/$(get_libdir)"
175 + default
176 +
177 + pax-mark -m "${ED}"/usr/bin/node
178 +
179 + # set up a symlink structure that node-gyp expects..
180 + dodir /usr/include/node/deps/{v8,uv}
181 + dosym . /usr/include/node/src
182 + for var in deps/{uv,v8}/include; do
183 + dosym ../.. /usr/include/node/${var}
184 + done
185 +
186 + if use doc; then
187 + docinto html
188 + dodoc -r "${S}"/doc/*
189 + fi
190 +
191 + if use npm; then
192 + dodir /etc/npm
193 +
194 + # Install bash completion for `npm`
195 + # We need to temporarily replace default config path since
196 + # npm otherwise tries to write outside of the sandbox
197 + local npm_config="usr/$(get_libdir)/node_modules/npm/lib/config/core.js"
198 + sed -i -e "s|'/etc'|'${ED}/etc'|g" "${ED}/${npm_config}" || die
199 + local tmp_npm_completion_file="$(emktemp)"
200 + "${ED}/usr/bin/npm" completion > "${tmp_npm_completion_file}"
201 + newbashcomp "${tmp_npm_completion_file}" npm
202 + sed -i -e "s|'${ED}/etc'|'/etc'|g" "${ED}/${npm_config}" || die
203 +
204 + # Move man pages
205 + doman "${LIBDIR}"/node_modules/npm/man/man{1,5,7}/*
206 +
207 + # Clean up
208 + rm "${LIBDIR}"/node_modules/npm/{.mailmap,.npmignore,Makefile} || die
209 + rm -rf "${LIBDIR}"/node_modules/npm/{doc,html,man} || die
210 +
211 + local find_exp="-or -name"
212 + local find_name=()
213 + for match in "AUTHORS*" "CHANGELOG*" "CONTRIBUT*" "README*" \
214 + ".travis.yml" ".eslint*" ".wercker.yml" ".npmignore" \
215 + "*.md" "*.markdown" "*.bat" "*.cmd"; do
216 + find_name+=( ${find_exp} "${match}" )
217 + done
218 +
219 + # Remove various development and/or inappropriate files and
220 + # useless docs of dependend packages.
221 + find "${LIBDIR}"/node_modules \
222 + \( -type d -name examples \) -or \( -type f \( \
223 + -iname "LICEN?E*" \
224 + "${find_name[@]}" \
225 + \) \) -exec rm -rf "{}" \;
226 + fi
227 +
228 + mv "${ED}"/usr/share/doc/node "${ED}"/usr/share/doc/${PF} || die
229 +}
230 +
231 +src_test() {
232 + out/${BUILDTYPE}/cctest || die
233 + "${PYTHON}" tools/test.py --mode=${BUILDTYPE,,} -J message parallel sequential || die
234 +}
235 +
236 +pkg_postinst() {
237 + elog "The global npm config lives in /etc/npm. This deviates slightly"
238 + elog "from upstream which otherwise would have it live in /usr/etc/."
239 + elog ""
240 + elog "Protip: When using node-gyp to install native modules, you can"
241 + elog "avoid having to download extras by doing the following:"
242 + elog "$ node-gyp --nodedir /usr/include/node <command>"
243 +}