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, 05 Jul 2018 10:03:58
Message-Id: 1530785027.b64c9709c5e53a3e010c833ad9eec30ab5ef72a1.jer@gentoo
1 commit: b64c9709c5e53a3e010c833ad9eec30ab5ef72a1
2 Author: Jeroen Roovers <jer <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jul 5 09:53:51 2018 +0000
4 Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org>
5 CommitDate: Thu Jul 5 10:03:47 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b64c9709
7
8 net-libs/nodejs: Version 10.6.0.
9
10 Package-Manager: Portage-2.3.41, Repoman-2.3.9
11
12 net-libs/nodejs/Manifest | 1 +
13 net-libs/nodejs/nodejs-10.6.0.ebuild | 200 +++++++++++++++++++++++++++++++++++
14 2 files changed, 201 insertions(+)
15
16 diff --git a/net-libs/nodejs/Manifest b/net-libs/nodejs/Manifest
17 index cce000050a2..fe8165273ca 100644
18 --- a/net-libs/nodejs/Manifest
19 +++ b/net-libs/nodejs/Manifest
20 @@ -1,6 +1,7 @@
21 DIST node-v0.12.18.tar.gz 19842591 BLAKE2B f94f4de6e2875267be194580c645087a262b90da99f10d651a22838c041da07056df81204bb04ce8da083a080062509dcca4d1e3ac2250d651ead8a4cc025028 SHA512 6866608a43eb213f3b715ea0fcc28983fd959ab679c567a1b464f62acd936506f2bce88ea48a60209d8ef8d98259f4b47cd3434893eb4ff82a132775edb37b7b
22 DIST node-v10.4.1.tar.xz 19663396 BLAKE2B 2490ba251c1a10fa2b4a9b0601e512a3c2d8e7ac6711b1a207f2abccc49bbe8623f8428cf86d20311fb6127ff95110c7b5590b0c39ccdc0625dc31127e3af0da SHA512 83f4a4b630d930ec1a05ca72cba0cf3e89ba07b6e928e5b9913fe6ee8032927a6f03575253514c6a081d26cbbfd865ea2da64ff3935813a06615f16af2af2a9f
23 DIST node-v10.5.0.tar.xz 19700916 BLAKE2B eb687776a4e51f9eba30ba0ff293bfb9a7f30443191bd2023edd6d41e973e58c13c8d783a48fa34e500769e9b8846b45abf28e5406bb443e9df1409a382a15bf SHA512 f22774d604e552fc105054aea531486ec84995e3e20c482c098dff5ddbcda41674423a98ee86f3a44245d3cb3e57a9c7c7ff31baf9539576bb1d3b74cf1a983d
24 +DIST node-v10.6.0.tar.xz 19741864 BLAKE2B f94ba788b4510b93e4ec556d0452da713e380621d9b3cc65a47fb0ac91766b4b25ec1f6dd06f35f621dd2d18781186a2a90aae7d728803ae221c08dd015139ba SHA512 c9434d8ea362aa8ea41053013bbd69fc5b5f4e133f9662419947919d29c246950ffad4d262cf9a252bc9f8a0cc63676947c8f0b83135a120c031d71ca37f4fd8
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 DIST node-v6.11.5.tar.xz 15699404 BLAKE2B ba2df91bf5ef38cedb60b42919cf56f16807e619a81876fc92a5741e49da7ec91c4239d00f549c5e80d0bb8282bb9b396dd984507916cd18d61b403a3a7cef94 SHA512 62490725ef7957294c1bddf21ef0626c7472876791210168116501255ecee58457e9de9b044e10033706243299bbfd1495efeca169596fbf26f5eeba6d8fa4c9
28
29 diff --git a/net-libs/nodejs/nodejs-10.6.0.ebuild b/net-libs/nodejs/nodejs-10.6.0.ebuild
30 new file mode 100644
31 index 00000000000..b02e635479a
32 --- /dev/null
33 +++ b/net-libs/nodejs/nodejs-10.6.0.ebuild
34 @@ -0,0 +1,200 @@
35 +# Copyright 1999-2018 Gentoo Foundation
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 ~amd64-linux ~x64-macos"
52 +IUSE="cpu_flags_x86_sse2 debug doc icu inspector +npm +snapshot +ssl systemtap test"
53 +REQUIRED_USE="
54 + ${PYTHON_REQUIRED_USE}
55 + inspector? ( icu ssl )
56 +"
57 +
58 +RDEPEND="
59 + >=dev-libs/libuv-1.21.0:=
60 + >=net-libs/http-parser-2.8.0:=
61 + >=net-libs/nghttp2-1.29.0
62 + sys-libs/zlib
63 + icu? ( >=dev-libs/icu-61.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 +}