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