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: Fri, 07 Sep 2018 10:03:58
Message-Id: 1536314631.1ac5f50908ed0ce3e40b5d141cdb61a160fd38fa.jer@gentoo
1 commit: 1ac5f50908ed0ce3e40b5d141cdb61a160fd38fa
2 Author: Jeroen Roovers <jer <AT> gentoo <DOT> org>
3 AuthorDate: Fri Sep 7 10:01:47 2018 +0000
4 Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org>
5 CommitDate: Fri Sep 7 10:03:51 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1ac5f509
7
8 net-libs/nodejs: Version 10.10.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.10.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 88fabd20c0e..a806292f595 100644
18 --- a/net-libs/nodejs/Manifest
19 +++ b/net-libs/nodejs/Manifest
20 @@ -1,4 +1,5 @@
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.9.0.tar.xz 19987812 BLAKE2B 4a5bd257cd527500b691b15d177bde53158b5e46e710ffeaa45224bae821cfaffdf59f24ad6bdc822cf468b90c1a4422a2f82d29e1d4b2dc0f838e3e0ab5b4ac SHA512 19c7366b4c9d1e255b5ac56e974ff86b9ca87c363534b467ecc3c59e170b891e86c479a2bcda6647c6df686b018caaedea84270e848b93a4f1c80ff04af12461
24 DIST node-v4.8.7.tar.xz 13370828 BLAKE2B b1ee93a586b66f8582783b1be50667547afe4bf48038ebc0b8148db55542cbc0520ac84ef88e4a7f453cabc245f484c32dbc238c1932bbc708791ceeb5c9d2ab SHA512 25837a31023747723b146c45984a5b2096b61c0aa43cbf45fc8ff50b4bd5079bd0bc9f1dfd3fb076817448dc5537eb93ffb2f345280b7756ba93b67ad757c696
25 DIST node-v4.9.1.tar.xz 13250164 BLAKE2B 7a689b99bb4bf507f7f21dd2c096a5766d023a8174c0f468cab37365af1920b8700da04157e1a406917790524255ef32c243a74662fd50ef7d3567d189dac9cf SHA512 690c9fdf608e5194069a10955bdd94ec87cb1c308f13bc4d2cae92fa01436ace10fadf58f2e51d477dde6c570b23edc1c71fafea79bfc9cab2903eb2fa5f87aa
26
27 diff --git a/net-libs/nodejs/nodejs-10.10.0.ebuild b/net-libs/nodejs/nodejs-10.10.0.ebuild
28 new file mode 100644
29 index 00000000000..6590a0a5927
30 --- /dev/null
31 +++ b/net-libs/nodejs/nodejs-10.10.0.ebuild
32 @@ -0,0 +1,201 @@
33 +# Copyright 1999-2018 Gentoo Foundation
34 +# Distributed under the terms of the GNU General Public License v2
35 +
36 +EAPI=6
37 +
38 +PYTHON_COMPAT=( python2_7 )
39 +PYTHON_REQ_USE="threads"
40 +
41 +inherit bash-completion-r1 eutils flag-o-matic pax-utils python-single-r1 toolchain-funcs
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 + ${PYTHON_REQUIRED_USE}
53 + inspector? ( icu ssl )
54 + npm? ( ssl )
55 +"
56 +
57 +RDEPEND="
58 + >=dev-libs/libuv-1.23.0:=
59 + >=net-libs/http-parser-2.8.0:=
60 + >=net-libs/nghttp2-1.33.0
61 + sys-libs/zlib
62 + icu? ( >=dev-libs/icu-62.1:= )
63 + ssl? ( >=dev-libs/openssl-1.1.0:0=[-bindist] )
64 +"
65 +DEPEND="
66 + ${RDEPEND}
67 + ${PYTHON_DEPS}
68 + systemtap? ( dev-util/systemtap )
69 + test? ( net-misc/curl )
70 +"
71 +S="${WORKDIR}/node-v${PV}"
72 +PATCHES=(
73 + "${FILESDIR}"/${PN}-10.3.0-global-npm-config.patch
74 +)
75 +
76 +pkg_pretend() {
77 + (use x86 && ! use cpu_flags_x86_sse2) && \
78 + die "Your CPU doesn't support the required SSE2 instruction."
79 +
80 + ( [[ ${MERGE_TYPE} != "binary" ]] && ! test-flag-CXX -std=c++11 ) && \
81 + die "Your compiler doesn't support C++11. Use GCC 4.8, Clang 3.3 or newer."
82 +}
83 +
84 +src_prepare() {
85 + tc-export CC CXX PKG_CONFIG
86 + export V=1
87 + export BUILDTYPE=Release
88 +
89 + # fix compilation on Darwin
90 + # https://code.google.com/p/gyp/issues/detail?id=260
91 + sed -i -e "/append('-arch/d" tools/gyp/pylib/gyp/xcode_emulation.py || die
92 +
93 + # make sure we use python2.* while using gyp
94 + sed -i -e "s/python/${EPYTHON}/" deps/npm/node_modules/node-gyp/gyp/gyp || die
95 + sed -i -e "s/|| 'python2'/|| '${EPYTHON}'/" deps/npm/node_modules/node-gyp/lib/configure.js || die
96 +
97 + # less verbose install output (stating the same as portage, basically)
98 + sed -i -e "/print/d" tools/install.py || die
99 +
100 + # proper libdir, hat tip @ryanpcmcquen https://github.com/iojs/io.js/issues/504
101 + local LIBDIR=$(get_libdir)
102 + sed -i -e "s|lib/|${LIBDIR}/|g" tools/install.py || die
103 + sed -i -e "s/'lib'/'${LIBDIR}'/" lib/module.js deps/npm/lib/npm.js || die
104 +
105 + # Avoid writing a depfile, not useful
106 + sed -i -e "/DEPFLAGS =/d" tools/gyp/pylib/gyp/generator/make.py || die
107 +
108 + sed -i -e "/'-O3'/d" common.gypi deps/v8/gypfiles/toolchain.gypi || die
109 +
110 + # Avoid a test that I've only been able to reproduce from emerge. It doesnt
111 + # seem sandbox related either (invoking it from a sandbox works fine).
112 + # The issue is that no stdin handle is openened when asked for one.
113 + # It doesn't really belong upstream , so it'll just be removed until someone
114 + # with more gentoo-knowledge than me (jbergstroem) figures it out.
115 + rm test/parallel/test-stdout-close-unref.js || die
116 +
117 + # debug builds. change install path, remove optimisations and override buildtype
118 + if use debug; then
119 + sed -i -e "s|out/Release/|out/Debug/|g" tools/install.py || die
120 + BUILDTYPE=Debug
121 + fi
122 +
123 + default
124 +}
125 +
126 +src_configure() {
127 + local myconf=( --shared-http-parser --shared-libuv --shared-nghttp2 --shared-zlib )
128 + use debug && myconf+=( --debug )
129 + use icu && myconf+=( --with-intl=system-icu ) || myconf+=( --with-intl=none )
130 + use inspector || myconf+=( --without-inspector )
131 + use npm || myconf+=( --without-npm )
132 + use snapshot && myconf+=( --with-snapshot )
133 + use ssl && myconf+=( --shared-openssl ) || myconf+=( --without-ssl )
134 +
135 + local myarch=""
136 + case ${ABI} in
137 + amd64) myarch="x64";;
138 + arm) myarch="arm";;
139 + arm64) myarch="arm64";;
140 + ppc64) myarch="ppc64";;
141 + x32) myarch="x32";;
142 + x86) myarch="ia32";;
143 + *) myarch="${ABI}";;
144 + esac
145 +
146 + GYP_DEFINES="linux_use_gold_flags=0
147 + linux_use_bundled_binutils=0
148 + linux_use_bundled_gold=0" \
149 + "${PYTHON}" configure \
150 + --prefix="${EPREFIX}"/usr \
151 + --dest-cpu=${myarch} \
152 + $(use_with systemtap dtrace) \
153 + "${myconf[@]}" || die
154 +}
155 +
156 +src_compile() {
157 + emake -C out mksnapshot
158 + pax-mark m "out/${BUILDTYPE}/mksnapshot"
159 + emake -C out
160 +}
161 +
162 +src_install() {
163 + local LIBDIR="${ED}/usr/$(get_libdir)"
164 + emake install DESTDIR="${D}"
165 + pax-mark -m "${ED}"usr/bin/node
166 +
167 + # set up a symlink structure that node-gyp expects..
168 + dodir /usr/include/node/deps/{v8,uv}
169 + dosym . /usr/include/node/src
170 + for var in deps/{uv,v8}/include; do
171 + dosym ../.. /usr/include/node/${var}
172 + done
173 +
174 + if use doc; then
175 + # Patch docs to make them offline readable
176 + for i in `grep -rl 'fonts.googleapis.com' "${S}"/out/doc/api/*`; do
177 + sed -i '/fonts.googleapis.com/ d' $i;
178 + done
179 + # Install docs!
180 + dohtml -r "${S}"/doc/*
181 + fi
182 +
183 + if use npm; then
184 + dodir /etc/npm
185 +
186 + # Install bash completion for `npm`
187 + # We need to temporarily replace default config path since
188 + # npm otherwise tries to write outside of the sandbox
189 + local npm_config="usr/$(get_libdir)/node_modules/npm/lib/config/core.js"
190 + sed -i -e "s|'/etc'|'${ED}/etc'|g" "${ED}/${npm_config}" || die
191 + local tmp_npm_completion_file="$(emktemp)"
192 + "${ED}/usr/bin/npm" completion > "${tmp_npm_completion_file}"
193 + newbashcomp "${tmp_npm_completion_file}" npm
194 + sed -i -e "s|'${ED}/etc'|'/etc'|g" "${ED}/${npm_config}" || die
195 +
196 + # Move man pages
197 + doman "${LIBDIR}"/node_modules/npm/man/man{1,5,7}/*
198 +
199 + # Clean up
200 + rm "${LIBDIR}"/node_modules/npm/{.mailmap,.npmignore,Makefile} || die
201 + rm -rf "${LIBDIR}"/node_modules/npm/{doc,html,man} || die
202 +
203 + local find_exp="-or -name"
204 + local find_name=()
205 + for match in "AUTHORS*" "CHANGELOG*" "CONTRIBUT*" "README*" \
206 + ".travis.yml" ".eslint*" ".wercker.yml" ".npmignore" \
207 + "*.md" "*.markdown" "*.bat" "*.cmd"; do
208 + find_name+=( ${find_exp} "${match}" )
209 + done
210 +
211 + # Remove various development and/or inappropriate files and
212 + # useless docs of dependend packages.
213 + find "${LIBDIR}"/node_modules \
214 + \( -type d -name examples \) -or \( -type f \( \
215 + -iname "LICEN?E*" \
216 + "${find_name[@]}" \
217 + \) \) -exec rm -rf "{}" \;
218 + fi
219 +}
220 +
221 +src_test() {
222 + out/${BUILDTYPE}/cctest || die
223 + "${PYTHON}" tools/test.py --mode=${BUILDTYPE,,} -J message parallel sequential || die
224 +}
225 +
226 +pkg_postinst() {
227 + einfo "The global npm config lives in /etc/npm. This deviates slightly"
228 + einfo "from upstream which otherwise would have it live in /usr/etc/."
229 + einfo ""
230 + einfo "Protip: When using node-gyp to install native modules, you can"
231 + einfo "avoid having to download extras by doing the following:"
232 + einfo "$ node-gyp --nodedir /usr/include/node <command>"
233 +}