Gentoo Archives: gentoo-commits

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