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, 22 Sep 2018 12:58:51
Message-Id: 1537621122.7b999bbe202b574533cddeab6640528d6196df16.jer@gentoo
1 commit: 7b999bbe202b574533cddeab6640528d6196df16
2 Author: Jeroen Roovers <jer <AT> gentoo <DOT> org>
3 AuthorDate: Sat Sep 22 12:50:01 2018 +0000
4 Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org>
5 CommitDate: Sat Sep 22 12:58:42 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7b999bbe
7
8 net-libs/nodejs: Version 10.11.0.
9
10 Package-Manager: Portage-2.3.49, Repoman-2.3.10
11
12 net-libs/nodejs/Manifest | 1 +
13 net-libs/nodejs/nodejs-10.11.0.ebuild | 201 ++++++++++++++++++++++++++++++++++
14 2 files changed, 202 insertions(+)
15
16 diff --git a/net-libs/nodejs/Manifest b/net-libs/nodejs/Manifest
17 index 00eae559385..fb8d90f6d4a 100644
18 --- a/net-libs/nodejs/Manifest
19 +++ b/net-libs/nodejs/Manifest
20 @@ -1,5 +1,6 @@
21 DIST node-v0.12.18.tar.gz 19842591 BLAKE2B f94f4de6e2875267be194580c645087a262b90da99f10d651a22838c041da07056df81204bb04ce8da083a080062509dcca4d1e3ac2250d651ead8a4cc025028 SHA512 6866608a43eb213f3b715ea0fcc28983fd959ab679c567a1b464f62acd936506f2bce88ea48a60209d8ef8d98259f4b47cd3434893eb4ff82a132775edb37b7b
22 DIST node-v10.10.0.tar.xz 19960760 BLAKE2B dc16e2afba4be727c5169ac5cd77324e0e8d7270c96da141da21a175cfbd64a38f7b51b86264396f3866174abc9095f7c840303208f7193739a1970818d4ff3a SHA512 482518a72cb0bdd5d987a7855856eadaa4fecea933ff7791918edf3097588246782d86b27568c06764ef9f2bca62b64a4d65e4cbd0e934931a72dc5719db7446
23 +DIST node-v10.11.0.tar.xz 20144576 BLAKE2B 956d940554748f420589adab0f14bd6fcc6a4781cdecd537abd6eb9aa43e9cf754ef009b20d416f1ef4c9a01ef91a27a59a8c080c1c0a49a59388f75713d6286 SHA512 00a678a829de9b836e77dd0806799029b657cf000369ca653540d7e1b82c3895da43dbbfe4d3c2b3b2b1e711bf55b3835a351fad18affdd0c25dcceea8e3406c
24 DIST node-v10.9.0.tar.xz 19987812 BLAKE2B 4a5bd257cd527500b691b15d177bde53158b5e46e710ffeaa45224bae821cfaffdf59f24ad6bdc822cf468b90c1a4422a2f82d29e1d4b2dc0f838e3e0ab5b4ac SHA512 19c7366b4c9d1e255b5ac56e974ff86b9ca87c363534b467ecc3c59e170b891e86c479a2bcda6647c6df686b018caaedea84270e848b93a4f1c80ff04af12461
25 DIST node-v4.8.7.tar.xz 13370828 BLAKE2B b1ee93a586b66f8582783b1be50667547afe4bf48038ebc0b8148db55542cbc0520ac84ef88e4a7f453cabc245f484c32dbc238c1932bbc708791ceeb5c9d2ab SHA512 25837a31023747723b146c45984a5b2096b61c0aa43cbf45fc8ff50b4bd5079bd0bc9f1dfd3fb076817448dc5537eb93ffb2f345280b7756ba93b67ad757c696
26 DIST node-v4.9.1.tar.xz 13250164 BLAKE2B 7a689b99bb4bf507f7f21dd2c096a5766d023a8174c0f468cab37365af1920b8700da04157e1a406917790524255ef32c243a74662fd50ef7d3567d189dac9cf SHA512 690c9fdf608e5194069a10955bdd94ec87cb1c308f13bc4d2cae92fa01436ace10fadf58f2e51d477dde6c570b23edc1c71fafea79bfc9cab2903eb2fa5f87aa
27
28 diff --git a/net-libs/nodejs/nodejs-10.11.0.ebuild b/net-libs/nodejs/nodejs-10.11.0.ebuild
29 new file mode 100644
30 index 00000000000..6590a0a5927
31 --- /dev/null
32 +++ b/net-libs/nodejs/nodejs-10.11.0.ebuild
33 @@ -0,0 +1,201 @@
34 +# Copyright 1999-2018 Gentoo Foundation
35 +# Distributed under the terms of the GNU General Public License v2
36 +
37 +EAPI=6
38 +
39 +PYTHON_COMPAT=( python2_7 )
40 +PYTHON_REQ_USE="threads"
41 +
42 +inherit bash-completion-r1 eutils flag-o-matic pax-utils python-single-r1 toolchain-funcs
43 +
44 +DESCRIPTION="A JavaScript runtime built on Chrome's V8 JavaScript engine"
45 +HOMEPAGE="https://nodejs.org/"
46 +SRC_URI="https://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz"
47 +
48 +LICENSE="Apache-1.1 Apache-2.0 BSD BSD-2 MIT"
49 +SLOT="0"
50 +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x64-macos"
51 +IUSE="cpu_flags_x86_sse2 debug doc icu inspector +npm +snapshot +ssl systemtap test"
52 +REQUIRED_USE="
53 + ${PYTHON_REQUIRED_USE}
54 + inspector? ( icu ssl )
55 + npm? ( ssl )
56 +"
57 +
58 +RDEPEND="
59 + >=dev-libs/libuv-1.23.0:=
60 + >=net-libs/http-parser-2.8.0:=
61 + >=net-libs/nghttp2-1.33.0
62 + sys-libs/zlib
63 + icu? ( >=dev-libs/icu-62.1:= )
64 + ssl? ( >=dev-libs/openssl-1.1.0:0=[-bindist] )
65 +"
66 +DEPEND="
67 + ${RDEPEND}
68 + ${PYTHON_DEPS}
69 + systemtap? ( dev-util/systemtap )
70 + test? ( net-misc/curl )
71 +"
72 +S="${WORKDIR}/node-v${PV}"
73 +PATCHES=(
74 + "${FILESDIR}"/${PN}-10.3.0-global-npm-config.patch
75 +)
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}'/" lib/module.js 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 + local myconf=( --shared-http-parser --shared-libuv --shared-nghttp2 --shared-zlib )
129 + use debug && myconf+=( --debug )
130 + use icu && myconf+=( --with-intl=system-icu ) || myconf+=( --with-intl=none )
131 + use inspector || myconf+=( --without-inspector )
132 + use npm || myconf+=( --without-npm )
133 + use snapshot && myconf+=( --with-snapshot )
134 + use ssl && myconf+=( --shared-openssl ) || myconf+=( --without-ssl )
135 +
136 + local myarch=""
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 + $(use_with systemtap 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 +}