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