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, 03 Apr 2019 22:16:07
Message-Id: 1554329759.582f1b06fbc099955a1467af7399dd18f3a3f451.jer@gentoo
1 commit: 582f1b06fbc099955a1467af7399dd18f3a3f451
2 Author: Jeroen Roovers <jer <AT> gentoo <DOT> org>
3 AuthorDate: Wed Apr 3 22:15:06 2019 +0000
4 Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org>
5 CommitDate: Wed Apr 3 22:15:59 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=582f1b06
7
8 net-libs/nodejs: Version 6.17.1
9
10 Package-Manager: Portage-2.3.62, Repoman-2.3.12
11 Signed-off-by: Jeroen Roovers <jer <AT> gentoo.org>
12
13 net-libs/nodejs/Manifest | 1 +
14 net-libs/nodejs/nodejs-6.17.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 70996d7e66b..3a460a25476 100644
19 --- a/net-libs/nodejs/Manifest
20 +++ b/net-libs/nodejs/Manifest
21 @@ -4,5 +4,6 @@ DIST node-v11.13.0.tar.xz 22085284 BLAKE2B e771c6109b4ca60b3037ec6a4f8138af75b50
22 DIST node-v4.9.1.tar.xz 13250164 BLAKE2B 7a689b99bb4bf507f7f21dd2c096a5766d023a8174c0f468cab37365af1920b8700da04157e1a406917790524255ef32c243a74662fd50ef7d3567d189dac9cf SHA512 690c9fdf608e5194069a10955bdd94ec87cb1c308f13bc4d2cae92fa01436ace10fadf58f2e51d477dde6c570b23edc1c71fafea79bfc9cab2903eb2fa5f87aa
23 DIST node-v6.14.4.tar.xz 15842824 BLAKE2B fc56364be64fe5824e2bb50d861ebf8f58f9895f2c9c108b8df3315b127ffb2755eac85c28165ac9779adab4611ce8f5ea1a5745f43ebaa1389e82b8215c6396 SHA512 1ead0c097ec125230dd631f19a5c3ec06a1371f9ca3b392b5ad08fcc227dd0142f33ad52f96890c2c17448a4951a635b9099dfff00d7d8b3ffb59b07904d1bfa
24 DIST node-v6.17.0.tar.xz 15853760 BLAKE2B f1872b2ed43c447beff2b3278e49f9f10bbef58bba2640f6ecd889facfa4c5e5ae142f3b30721faae615df42c0870d7c09147930a259fa81c161b29559e2a340 SHA512 8ae9bfa0336a7d0d9f4a372330de1f877354a3d68bdd6977285787f81999012e42faf4ccef5981fe565ea9e2f18c5490b857bab29359fdf906b5a9fb14628858
25 +DIST node-v6.17.1.tar.xz 15858444 BLAKE2B ad050f71452f0ddf989e66a4eb02e88e4e5001faa2bcb0eae6b57784da87ba1d8251201e3a3d15245bb4d846f31f39854ddfae47aa1212c0526ec717438ba778 SHA512 6938c4864a96f5698ebc4e9a1228644820789d5402f42348eb1ff9ccd64f31bb91309a1f3301636b1117424c88b0b41b42baae51a1070d5c532604e5d7d7b868
26 DIST node-v8.12.0.tar.xz 18310452 BLAKE2B 79634fc57cd76a97e72bab4be37da91d5eff4d13cdaa2b48e83f013885fa3590ba4a28378baf036ed26b7304bf234753d1d4014f72571496f5bb6cd5b221e5f0 SHA512 665d2dba287d78bcd723d7b4d00a6897fb996f4aa69a541e010a3dfeb2614257892117fcce7123966b1ecaddc9269a6667e0e262df693baea1f476c96de55c42
27 DIST node-v8.15.1.tar.xz 18501532 BLAKE2B e6da98902d665997b2e85472424e00f817353dcfc118b1d309f1305099b145eb0eae33429554ab5d563366182b34b24ac78f8b78794f8d21318ebcd137622131 SHA512 23fb4e2580116a69a58514c2dc1f42098c7d594ea9d0cd6e7090f37e12e1805ca6546df66ee68fcb61b803e287ce34422f55129412f6bdcdaa97f515d9581e19
28
29 diff --git a/net-libs/nodejs/nodejs-6.17.1.ebuild b/net-libs/nodejs/nodejs-6.17.1.ebuild
30 new file mode 100644
31 index 00000000000..8db127221fd
32 --- /dev/null
33 +++ b/net-libs/nodejs/nodejs-6.17.1.ebuild
34 @@ -0,0 +1,200 @@
35 +# Copyright 1999-2019 Gentoo Authors
36 +# Distributed under the terms of the GNU General Public License v2
37 +
38 +EAPI=6
39 +
40 +PYTHON_COMPAT=( python2_7 )
41 +PYTHON_REQ_USE="threads"
42 +
43 +inherit bash-completion-r1 eutils flag-o-matic pax-utils python-single-r1 toolchain-funcs
44 +
45 +DESCRIPTION="A JavaScript runtime built on Chrome's V8 JavaScript engine"
46 +HOMEPAGE="https://nodejs.org/"
47 +SRC_URI="https://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz"
48 +
49 +LICENSE="Apache-1.1 Apache-2.0 BSD BSD-2 MIT"
50 +SLOT="0"
51 +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86"
52 +IUSE="cpu_flags_x86_sse2 debug doc icu inspector +npm +snapshot +ssl test"
53 +REQUIRED_USE="
54 + ${PYTHON_REQUIRED_USE}
55 + inspector? ( icu ssl )
56 +"
57 +
58 +RDEPEND="
59 + >=dev-libs/libuv-1.16.1:=
60 + >=net-libs/http-parser-2.9.0:=
61 + sys-libs/zlib
62 + icu? ( >=dev-libs/icu-58.2:= )
63 + ssl? ( >=dev-libs/openssl-1.0.2n:0=[-bindist] )
64 +"
65 +DEPEND="
66 + ${RDEPEND}
67 + ${PYTHON_DEPS}
68 + test? ( net-misc/curl )
69 +"
70 +PATCHES=(
71 + "${FILESDIR}"/gentoo-global-npm-config.patch
72 +)
73 +S="${WORKDIR}/node-v${PV}"
74 +
75 +pkg_pretend() {
76 + (use x86 && ! use cpu_flags_x86_sse2) && \
77 + die "Your CPU doesn't support the required SSE2 instruction."
78 +
79 + ( [[ ${MERGE_TYPE} != "binary" ]] && ! test-flag-CXX -std=c++11 ) && \
80 + die "Your compiler doesn't support C++11. Use GCC 4.8, Clang 3.3 or newer."
81 +}
82 +
83 +src_prepare() {
84 + tc-export CC CXX PKG_CONFIG
85 + export V=1
86 + export BUILDTYPE=Release
87 +
88 + # fix compilation on Darwin
89 + # https://code.google.com/p/gyp/issues/detail?id=260
90 + sed -i -e "/append('-arch/d" tools/gyp/pylib/gyp/xcode_emulation.py || die
91 +
92 + # make sure we use python2.* while using gyp
93 + sed -i -e "s/python/${EPYTHON}/" deps/npm/node_modules/node-gyp/gyp/gyp || die
94 + sed -i -e "s/|| 'python'/|| '${EPYTHON}'/" deps/npm/node_modules/node-gyp/lib/configure.js || die
95 +
96 + # less verbose install output (stating the same as portage, basically)
97 + sed -i -e "/print/d" tools/install.py || die
98 +
99 + # proper libdir, hat tip @ryanpcmcquen https://github.com/iojs/io.js/issues/504
100 + local LIBDIR=$(get_libdir)
101 + sed -i \
102 + -e "s|lib/|${LIBDIR}/|g" \
103 + -e 's|share/doc/node/|share/doc/'"${PF}"'/|g' \
104 + tools/install.py || die
105 + sed -i -e "s/'lib'/'${LIBDIR}'/" lib/module.js || 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 + # 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 + local myarch=""
129 + local myconf=( --shared-libuv --shared-http-parser --shared-zlib )
130 + use debug && myconf+=( --debug )
131 + use icu && myconf+=( --with-intl=system-icu )
132 + use inspector || myconf+=( --without-inspector )
133 + use npm || myconf+=( --without-npm )
134 + use snapshot && myconf+=( --with-snapshot )
135 + use ssl && myconf+=( --shared-openssl ) || myconf+=( --without-ssl )
136 +
137 + case ${ABI} in
138 + amd64) myarch="x64";;
139 + arm) myarch="arm";;
140 + arm64) myarch="arm64";;
141 + ppc64) myarch="ppc64";;
142 + x32) myarch="x32";;
143 + x86) myarch="ia32";;
144 + *) myarch="${ABI}";;
145 + esac
146 +
147 + GYP_DEFINES="linux_use_gold_flags=0
148 + linux_use_bundled_binutils=0
149 + linux_use_bundled_gold=0" \
150 + "${PYTHON}" configure \
151 + --prefix="${EPREFIX}"/usr \
152 + --dest-cpu=${myarch} \
153 + --without-dtrace \
154 + "${myconf[@]}" || die
155 +}
156 +
157 +src_compile() {
158 + emake -C out mksnapshot
159 + pax-mark m "out/${BUILDTYPE}/mksnapshot"
160 + emake -C out
161 +}
162 +
163 +src_install() {
164 + local LIBDIR="${ED}/usr/$(get_libdir)"
165 + emake install DESTDIR="${D}"
166 + pax-mark -m "${ED}"usr/bin/node
167 +
168 + # set up a symlink structure that node-gyp expects..
169 + dodir /usr/include/node/deps/{v8,uv}
170 + dosym . /usr/include/node/src
171 + for var in deps/{uv,v8}/include; do
172 + dosym ../.. /usr/include/node/${var}
173 + done
174 +
175 + if use doc; then
176 + # Patch docs to make them offline readable
177 + for i in `grep -rl 'fonts.googleapis.com' "${S}"/out/doc/api/*`; do
178 + sed -i '/fonts.googleapis.com/ d' $i;
179 + done
180 + # Install docs!
181 + dohtml -r "${S}"/doc/*
182 + fi
183 +
184 + if use npm; then
185 + dodir /etc/npm
186 +
187 + # Install bash completion for `npm`
188 + # We need to temporarily replace default config path since
189 + # npm otherwise tries to write outside of the sandbox
190 + local npm_config="usr/$(get_libdir)/node_modules/npm/lib/config/core.js"
191 + sed -i -e "s|'/etc'|'${ED}/etc'|g" "${ED}/${npm_config}" || die
192 + local tmp_npm_completion_file="$(emktemp)"
193 + "${ED}/usr/bin/npm" completion > "${tmp_npm_completion_file}"
194 + newbashcomp "${tmp_npm_completion_file}" npm
195 + sed -i -e "s|'${ED}/etc'|'/etc'|g" "${ED}/${npm_config}" || die
196 +
197 + # Move man pages
198 + doman "${LIBDIR}"/node_modules/npm/man/man{1,5,7}/*
199 +
200 + # Clean up
201 + rm "${LIBDIR}"/node_modules/npm/{.mailmap,.npmignore,Makefile} || die
202 + rm -rf "${LIBDIR}"/node_modules/npm/{doc,html,man} || die
203 +
204 + local find_exp="-or -name"
205 + local find_name=()
206 + for match in "AUTHORS*" "CHANGELOG*" "CONTRIBUT*" "README*" \
207 + ".travis.yml" ".eslint*" ".wercker.yml" ".npmignore" \
208 + "*.md" "*.markdown" "*.bat" "*.cmd"; do
209 + find_name+=( ${find_exp} "${match}" )
210 + done
211 +
212 + # Remove various development and/or inappropriate files and
213 + # useless docs of dependend packages.
214 + find "${LIBDIR}"/node_modules \
215 + \( -type d -name examples \) -or \( -type f \( \
216 + -iname "LICEN?E*" \
217 + "${find_name[@]}" \
218 + \) \) -exec rm -rf "{}" \;
219 + fi
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 +}