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, 27 Oct 2016 17:51:45
Message-Id: 1477590694.552fc28d936428988feebad47226fda909508c37.patrick@gentoo
1 commit: 552fc28d936428988feebad47226fda909508c37
2 Author: Patrick Lauer <patrick <AT> gentoo <DOT> org>
3 AuthorDate: Thu Oct 27 17:50:51 2016 +0000
4 Commit: Patrick Lauer <patrick <AT> gentoo <DOT> org>
5 CommitDate: Thu Oct 27 17:51:34 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=552fc28d
7
8 net-libs/nodejs: Bump
9
10 Package-Manager: portage-2.3.2
11
12 net-libs/nodejs/Manifest | 1 +
13 net-libs/nodejs/nodejs-7.0.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 280c25f..ae38a1d 100644
18 --- a/net-libs/nodejs/Manifest
19 +++ b/net-libs/nodejs/Manifest
20 @@ -5,3 +5,4 @@ DIST node-v4.6.0.tar.xz 13295184 SHA256 42910dbd34e49bfc40580e06753947c30d311014
21 DIST node-v4.6.1.tar.xz 13295568 SHA256 fe2a85df8758001878abb5bbaf17a6b6cdc12b3e465b1d3bace83b37fdf0345a SHA512 4eb2acbe13ee2373922420e3238be63d2108dacba640438bddbdea12ec2de9c655f33db611e4c0654b66bf4fdb844a7b6554a823aac73171b17599096856abdb WHIRLPOOL a6d21cce7ab8c430528682f78a6e6492f753c87949b7b1bdc15dc02911559cd89deb45329c2ba32da57b776dd4feaabec8a3e7a59a78094cfb079261b6475c76
22 DIST node-v6.9.0.tar.xz 15615224 SHA256 656342ed8a84c95a36af902f309aeeca7103b16d61c02925bd37bd47d2194915 SHA512 c8dc6899e8ec9d97d37b72a0ff6483069c494b05020ff6cf101c2b8b2774ed2673138fc260dc90b7317123d77daf89d0ba3321deda47457fa892456054f93337 WHIRLPOOL e65031667b619e0449924272359db01fd846dc68238e45a2bc4890d6f539b32dc173bab282c858412f2d34b73cdf68371a5677d081f9b56fb19791a9354ad740
23 DIST node-v6.9.1.tar.xz 15617228 SHA256 0bdd8d1305777cc8cd206129ea494d6c6ce56001868dd80147aff531d6df0729 SHA512 3f1c724dfc9f76f101064be6ef222482f3b7e53d8d6c026b3d166dfbdd104f05055cf04a3205679793fa12f946548fc06e3272527655b28002d0bf0e7eccdf1b WHIRLPOOL dd1607b4c193f7ef05f7d0571f31c72133464e2ebd023278cf055d7156daa6e194e5170948f32cae8027f1ef5c6eaef6a89bf7271ed386d45c787b30e57880fb
24 +DIST node-v7.0.0.tar.xz 16296516 SHA256 e16c3c76c2d6756bbfd711189cbdaf5676049b443e6817007bb537f243ca899a SHA512 775b3a786ca6975b1913f048ea9a969e674d6d8ca58094557fe21e7c821e10f8d4bd8d484ca3617b553587449020ecf1d3d8c8d912c46725bab7f7561c2fbdda WHIRLPOOL e9068c49181151ebcf1dd75f5ecb8ee87b89abc7695cb9158bbfa701de9344bc5c2b59b5363d5be4a65bb4df1c37b8f6285b6c584f43ad3f933628a7e175ff1f
25
26 diff --git a/net-libs/nodejs/nodejs-7.0.0.ebuild b/net-libs/nodejs/nodejs-7.0.0.ebuild
27 new file mode 100644
28 index 00000000..4e76890
29 --- /dev/null
30 +++ b/net-libs/nodejs/nodejs-7.0.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 +}