Gentoo Archives: gentoo-commits

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