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, 09 Jan 2020 23:03:15
Message-Id: 1578610988.63e0fcbf27e50800c7a06fc3e59e592a14bb619a.jer@gentoo
1 commit: 63e0fcbf27e50800c7a06fc3e59e592a14bb619a
2 Author: Jeroen Roovers <jer <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jan 9 22:07:52 2020 +0000
4 Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org>
5 CommitDate: Thu Jan 9 23:03:08 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=63e0fcbf
7
8 net-libs/nodejs: Version 10.18.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-10.18.1.ebuild | 200 ++++++++++++++++++++++++++++++++++
15 2 files changed, 201 insertions(+)
16
17 diff --git a/net-libs/nodejs/Manifest b/net-libs/nodejs/Manifest
18 index c38e2453800..3b079722844 100644
19 --- a/net-libs/nodejs/Manifest
20 +++ b/net-libs/nodejs/Manifest
21 @@ -1,5 +1,6 @@
22 DIST node-v10.17.0.tar.xz 21514260 BLAKE2B a37793d78e14d1d2ca861c39f27c5e1dbb47ad26f14aa97139fd9f9be039bd47e528f10c9977725f1ca4b5f4e31a1066715091ffaa488f764c67290bc1c84541 SHA512 4eec936fa8d848b7e261f83b6e25c1bfb06355a7146dcca91b0f64fc401ca32dd1b0758c127b81be7f0d1cc59c3b24b4ec2c17282b4bdb91c5bf71f42f2f7cbc
23 DIST node-v10.18.0.tar.xz 21913328 BLAKE2B 84b0b5157671dcc3e96bb2cfd11e085251fd2942c03b27491f712f5603797bab7503d8f7c0eb45ca8e348b20a0555c1767d4d1964fff474c8590a47eb01523a5 SHA512 8fc9062e150af6f054f1ebebbdf67151b16f14bcca9cbb35338a4c7fcd7fa1c3f05c4a7ace12d4153180cec0007a195cbc94942c4d04c3895384dc18951d2c1c
24 +DIST node-v10.18.1.tar.xz 21920068 BLAKE2B 9dc0887a33f0888a347628e5bf15eb3687f15cba264a00317a15336fda48e41da9b4c45df6d0f223f2017c6b55b99eda0c4cd6f5913673da29c52a61450d03e2 SHA512 0979d264ef5286caea61a527771e2ac2fbe1b909a151061dbb7d9e0fde9461edd76b6060f55cfbd49d3ae2e7e10595a2eb4d2e98182e735e7df10940120fb9b6
25 DIST node-v12.13.0.tar.xz 22862096 BLAKE2B b0121f45b535bac7baa0103db538070b4beb4b40a6c871c217eebfb1abb5a7821d83d46946047b3385af182f901c0390eb85134c9201be2d03b5745b297271f8 SHA512 a7aa8b1f010ea1df122d9d7b88ee0a9d10e0d79ae2f3d18c706ac6ce36e2e2039c21ea6f3dba3a22a79ed3f6069850a8a3c463dbd64e1e8f4a9dbe8901a89cc8
26 DIST node-v12.14.0.tar.xz 23244684 BLAKE2B 0e25cbba5e256b139efd45908236f008834afdf01f57a8e84c7e55ba950e56b786cd52eba9a02986eb0e1d38cbf6df38e1cd719d7dcd8085e8c71767adf8155e SHA512 12e887709a54be911c5a81ab7b7be995247b47ebbd2954ca942f9ed8a784ae1a8e4bdb2613e5bb671196f9101d8861cd29e10650a3f0c414db4d096df94b309b
27 DIST node-v12.14.1.tar.xz 23258936 BLAKE2B 125289ce3e342c2e5e7bbb6f0b1af109f0ba8fbf2d6630f2cdc4aa31c25a3d846afe773e84daed9824360a6680a2d21378af4fbc42c6337399a143f92850a82f SHA512 2e2b6fa8351b59450ab5491b5e31dc36ce4d9be13c55a14e6e4d95a82cc8334f9fc35261a56a8843903f8021ff333a333bb4d5f24c92b5d7483d4779c3d88342
28
29 diff --git a/net-libs/nodejs/nodejs-10.18.1.ebuild b/net-libs/nodejs/nodejs-10.18.1.ebuild
30 new file mode 100644
31 index 00000000000..489857c39f9
32 --- /dev/null
33 +++ b/net-libs/nodejs/nodejs-10.18.1.ebuild
34 @@ -0,0 +1,200 @@
35 +# Copyright 1999-2020 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 xdg-utils
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.28.0:=
58 + >=net-dns/c-ares-1.15.0
59 + >=net-libs/http-parser-2.9.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 +)
74 +RESTRICT="test"
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 + sed -i -e "s/|| 'python2'/|| '${EPYTHON}'/" deps/npm/node_modules/node-gyp/lib/configure.js || die
97 +
98 + # less verbose install output (stating the same as portage, basically)
99 + sed -i -e "/print/d" tools/install.py || die
100 +
101 + # proper libdir, hat tip @ryanpcmcquen https://github.com/iojs/io.js/issues/504
102 + local LIBDIR=$(get_libdir)
103 + sed -i -e "s|lib/|${LIBDIR}/|g" tools/install.py || die
104 + sed -i -e "s/'lib'/'${LIBDIR}'/" deps/npm/lib/npm.js || die
105 +
106 + # Avoid writing a depfile, not useful
107 + sed -i -e "/DEPFLAGS =/d" tools/gyp/pylib/gyp/generator/make.py || die
108 +
109 + sed -i -e "/'-O3'/d" common.gypi deps/v8/gypfiles/toolchain.gypi || die
110 +
111 + # Avoid a test that I've only been able to reproduce from emerge. It doesnt
112 + # seem sandbox related either (invoking it from a sandbox works fine).
113 + # The issue is that no stdin handle is openened when asked for one.
114 + # It doesn't really belong upstream , so it'll just be removed until someone
115 + # with more gentoo-knowledge than me (jbergstroem) figures it out.
116 + rm test/parallel/test-stdout-close-unref.js || die
117 +
118 + # debug builds. change install path, remove optimisations and override buildtype
119 + if use debug; then
120 + sed -i -e "s|out/Release/|out/Debug/|g" tools/install.py || die
121 + BUILDTYPE=Debug
122 + fi
123 +
124 + default
125 +}
126 +
127 +src_configure() {
128 + xdg_environment_reset
129 +
130 + local myconf=( --shared-cares --shared-http-parser --shared-libuv --shared-nghttp2 --shared-zlib )
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 ) || 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 + emake install DESTDIR="${D}"
168 + pax-mark -m "${ED}"/usr/bin/node
169 +
170 + # set up a symlink structure that node-gyp expects..
171 + dodir /usr/include/node/deps/{v8,uv}
172 + dosym . /usr/include/node/src
173 + for var in deps/{uv,v8}/include; do
174 + dosym ../.. /usr/include/node/${var}
175 + done
176 +
177 + if use doc; then
178 + docinto html
179 + dodoc -r "${S}"/doc/*
180 + fi
181 +
182 + if use npm; then
183 + dodir /etc/npm
184 +
185 + # Install bash completion for `npm`
186 + # We need to temporarily replace default config path since
187 + # npm otherwise tries to write outside of the sandbox
188 + local npm_config="usr/$(get_libdir)/node_modules/npm/lib/config/core.js"
189 + sed -i -e "s|'/etc'|'${ED}/etc'|g" "${ED}/${npm_config}" || die
190 + local tmp_npm_completion_file="$(emktemp)"
191 + "${ED}/usr/bin/npm" completion > "${tmp_npm_completion_file}"
192 + newbashcomp "${tmp_npm_completion_file}" npm
193 + sed -i -e "s|'${ED}/etc'|'/etc'|g" "${ED}/${npm_config}" || die
194 +
195 + # Move man pages
196 + doman "${LIBDIR}"/node_modules/npm/man/man{1,5,7}/*
197 +
198 + # Clean up
199 + rm "${LIBDIR}"/node_modules/npm/{.mailmap,.npmignore,Makefile} || die
200 + rm -rf "${LIBDIR}"/node_modules/npm/{doc,html,man} || die
201 +
202 + local find_exp="-or -name"
203 + local find_name=()
204 + for match in "AUTHORS*" "CHANGELOG*" "CONTRIBUT*" "README*" \
205 + ".travis.yml" ".eslint*" ".wercker.yml" ".npmignore" \
206 + "*.md" "*.markdown" "*.bat" "*.cmd"; do
207 + find_name+=( ${find_exp} "${match}" )
208 + done
209 +
210 + # Remove various development and/or inappropriate files and
211 + # useless docs of dependend packages.
212 + find "${LIBDIR}"/node_modules \
213 + \( -type d -name examples \) -or \( -type f \( \
214 + -iname "LICEN?E*" \
215 + "${find_name[@]}" \
216 + \) \) -exec rm -rf "{}" \;
217 + fi
218 +
219 + mv "${D}"/usr/share/doc/node "${D}"/usr/share/doc/${PF} || die
220 +}
221 +
222 +src_test() {
223 + out/${BUILDTYPE}/cctest || die
224 + "${PYTHON}" tools/test.py --mode=${BUILDTYPE,,} -J message parallel sequential || die
225 +}
226 +
227 +pkg_postinst() {
228 + einfo "The global npm config lives in /etc/npm. This deviates slightly"
229 + einfo "from upstream which otherwise would have it live in /usr/etc/."
230 + einfo ""
231 + einfo "Protip: When using node-gyp to install native modules, you can"
232 + einfo "avoid having to download extras by doing the following:"
233 + einfo "$ node-gyp --nodedir /usr/include/node <command>"
234 +}