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