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