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: Fri, 02 Mar 2018 07:12:30
Message-Id: 1519974742.fb29945877071bce9a66ac66cf20d190e930826b.jer@gentoo
1 commit: fb29945877071bce9a66ac66cf20d190e930826b
2 Author: Jeroen Roovers <jer <AT> gentoo <DOT> org>
3 AuthorDate: Fri Mar 2 07:10:38 2018 +0000
4 Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org>
5 CommitDate: Fri Mar 2 07:12:22 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fb299458
7
8 net-libs/nodejs: Version 9.7.1.
9
10 Package-Manager: Portage-2.3.24, Repoman-2.3.6
11
12 net-libs/nodejs/Manifest | 1 +
13 net-libs/nodejs/nodejs-9.7.1.ebuild | 200 ++++++++++++++++++++++++++++++++++++
14 2 files changed, 201 insertions(+)
15
16 diff --git a/net-libs/nodejs/Manifest b/net-libs/nodejs/Manifest
17 index efdc6934a4f..4b634039a81 100644
18 --- a/net-libs/nodejs/Manifest
19 +++ b/net-libs/nodejs/Manifest
20 @@ -7,3 +7,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.5.0.tar.xz 18456216 BLAKE2B 8e0f00be0e03af50c8d84ec3f647f8946312f60e78a6a3762d09e918f1467fcb3239a8cb9d8cfab263b96749f307cead8c9e4a383378dca6538e85aea9aad576 SHA512 f2f4d78e7c70ab32357bd35af7afeb59feca8839fb7e652421c4ac4d0c55c1c1c78cf9a2e433f3ed714be45e658c9e04cf465e751eb5a40a67d2b1afdebae4a9
23 DIST node-v9.6.1.tar.xz 18501328 BLAKE2B f107f8cb01c9e4a4ba983798b0d613b8db3c2bf3bc0294d5ff85bd4bf31630f0df4c9b0ab7f8d75ad601633150a45980b8e47c2802016077f25428ab51869d9e SHA512 488d1a0ed28128e6db63be29ac575cf8899a00bf8972aee1f9d6b1b0224a29a34b3915d2b0106156fbdb82df61985ee998e4861475df1c0504789f51ec4c0711
24 +DIST node-v9.7.1.tar.xz 18503976 BLAKE2B 9648142590a73989efe08993c6c99447f66a92b67c43cd2ba3807ca5e31c63bd89fb7dfb8964632dee0aa02ceaea80bae908634cb5b498037e6870f45c053869 SHA512 618bd9f576182f72f18adc36469ef8785f458fddba8a0bfb02b2b388112ca6b0c25507dbb61f9211ca8427add8002ec25f0aa1fec081379e7e14980a88d4924a
25
26 diff --git a/net-libs/nodejs/nodejs-9.7.1.ebuild b/net-libs/nodejs/nodejs-9.7.1.ebuild
27 new file mode 100644
28 index 00000000000..e73e3ad0251
29 --- /dev/null
30 +++ b/net-libs/nodejs/nodejs-9.7.1.ebuild
31 @@ -0,0 +1,200 @@
32 +# Copyright 1999-2018 Gentoo Foundation
33 +# Distributed under the terms of the GNU General Public License v2
34 +
35 +EAPI=6
36 +
37 +PYTHON_COMPAT=( python2_7 )
38 +PYTHON_REQ_USE="threads"
39 +
40 +inherit bash-completion-r1 eutils flag-o-matic pax-utils python-single-r1 toolchain-funcs
41 +
42 +DESCRIPTION="A JavaScript runtime built on Chrome's V8 JavaScript engine"
43 +HOMEPAGE="https://nodejs.org/"
44 +SRC_URI="https://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz"
45 +
46 +LICENSE="Apache-1.1 Apache-2.0 BSD BSD-2 MIT"
47 +SLOT="0"
48 +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x64-macos"
49 +IUSE="cpu_flags_x86_sse2 debug doc icu inspector +npm +snapshot +ssl systemtap test"
50 +REQUIRED_USE="
51 + ${PYTHON_REQUIRED_USE}
52 + inspector? ( icu ssl )
53 +"
54 +
55 +RDEPEND="
56 + >=dev-libs/libuv-1.19.2:=
57 + >=net-libs/http-parser-2.7.0:=
58 + >=net-libs/nghttp2-1.29.0
59 + sys-libs/zlib
60 + icu? ( >=dev-libs/icu-60.1:= )
61 + ssl? ( >=dev-libs/openssl-1.0.2n:0=[-bindist] )
62 +"
63 +DEPEND="
64 + ${RDEPEND}
65 + ${PYTHON_DEPS}
66 + systemtap? ( dev-util/systemtap )
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/|| 'python2'/|| '${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 deps/npm/lib/npm.js || die
102 +
103 + # Avoid writing a depfile, not useful
104 + sed -i -e "/DEPFLAGS =/d" tools/gyp/pylib/gyp/generator/make.py || die
105 +
106 + sed -i -e "/'-O3'/d" common.gypi deps/v8/gypfiles/toolchain.gypi || die
107 +
108 + # Avoid a test that I've only been able to reproduce from emerge. It doesnt
109 + # seem sandbox related either (invoking it from a sandbox works fine).
110 + # The issue is that no stdin handle is openened when asked for one.
111 + # It doesn't really belong upstream , so it'll just be removed until someone
112 + # with more gentoo-knowledge than me (jbergstroem) figures it out.
113 + rm test/parallel/test-stdout-close-unref.js || die
114 +
115 + # debug builds. change install path, remove optimisations and override buildtype
116 + if use debug; then
117 + sed -i -e "s|out/Release/|out/Debug/|g" tools/install.py || die
118 + BUILDTYPE=Debug
119 + fi
120 +
121 + default
122 +}
123 +
124 +src_configure() {
125 + local myconf=( --shared-http-parser --shared-libuv --shared-nghttp2 --shared-zlib )
126 + use debug && myconf+=( --debug )
127 + use icu && myconf+=( --with-intl=system-icu ) || myconf+=( --with-intl=none )
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 + local myarch=""
134 + case ${ABI} in
135 + amd64) myarch="x64";;
136 + arm) myarch="arm";;
137 + arm64) myarch="arm64";;
138 + ppc64) myarch="ppc64";;
139 + x32) myarch="x32";;
140 + x86) myarch="ia32";;
141 + *) myarch="${ABI}";;
142 + esac
143 +
144 + GYP_DEFINES="linux_use_gold_flags=0
145 + linux_use_bundled_binutils=0
146 + linux_use_bundled_gold=0" \
147 + "${PYTHON}" configure \
148 + --prefix="${EPREFIX}"/usr \
149 + --dest-cpu=${myarch} \
150 + $(use_with systemtap dtrace) \
151 + "${myconf[@]}" || die
152 +}
153 +
154 +src_compile() {
155 + emake -C out mksnapshot
156 + pax-mark m "out/${BUILDTYPE}/mksnapshot"
157 + emake -C out
158 +}
159 +
160 +src_install() {
161 + local LIBDIR="${ED}/usr/$(get_libdir)"
162 + emake install DESTDIR="${D}"
163 + pax-mark -m "${ED}"usr/bin/node
164 +
165 + # set up a symlink structure that node-gyp expects..
166 + dodir /usr/include/node/deps/{v8,uv}
167 + dosym . /usr/include/node/src
168 + for var in deps/{uv,v8}/include; do
169 + dosym ../.. /usr/include/node/${var}
170 + done
171 +
172 + if use doc; then
173 + # Patch docs to make them offline readable
174 + for i in `grep -rl 'fonts.googleapis.com' "${S}"/out/doc/api/*`; do
175 + sed -i '/fonts.googleapis.com/ d' $i;
176 + done
177 + # Install docs!
178 + dohtml -r "${S}"/doc/*
179 + fi
180 +
181 + if use npm; then
182 + dodir /etc/npm
183 +
184 + # Install bash completion for `npm`
185 + # We need to temporarily replace default config path since
186 + # npm otherwise tries to write outside of the sandbox
187 + local npm_config="usr/$(get_libdir)/node_modules/npm/lib/config/core.js"
188 + sed -i -e "s|'/etc'|'${ED}/etc'|g" "${ED}/${npm_config}" || die
189 + local tmp_npm_completion_file="$(emktemp)"
190 + "${ED}/usr/bin/npm" completion > "${tmp_npm_completion_file}"
191 + newbashcomp "${tmp_npm_completion_file}" npm
192 + sed -i -e "s|'${ED}/etc'|'/etc'|g" "${ED}/${npm_config}" || die
193 +
194 + # Move man pages
195 + doman "${LIBDIR}"/node_modules/npm/man/man{1,5,7}/*
196 +
197 + # Clean up
198 + rm "${LIBDIR}"/node_modules/npm/{.mailmap,.npmignore,Makefile} || die
199 + rm -rf "${LIBDIR}"/node_modules/npm/{doc,html,man} || die
200 +
201 + local find_exp="-or -name"
202 + local find_name=()
203 + for match in "AUTHORS*" "CHANGELOG*" "CONTRIBUT*" "README*" \
204 + ".travis.yml" ".eslint*" ".wercker.yml" ".npmignore" \
205 + "*.md" "*.markdown" "*.bat" "*.cmd"; do
206 + find_name+=( ${find_exp} "${match}" )
207 + done
208 +
209 + # Remove various development and/or inappropriate files and
210 + # useless docs of dependend packages.
211 + find "${LIBDIR}"/node_modules \
212 + \( -type d -name examples \) -or \( -type f \( \
213 + -iname "LICEN?E*" \
214 + "${find_name[@]}" \
215 + \) \) -exec rm -rf "{}" \;
216 + fi
217 +}
218 +
219 +src_test() {
220 + out/${BUILDTYPE}/cctest || die
221 + "${PYTHON}" tools/test.py --mode=${BUILDTYPE,,} -J message parallel sequential || die
222 +}
223 +
224 +pkg_postinst() {
225 + einfo "The global npm config lives in /etc/npm. This deviates slightly"
226 + einfo "from upstream which otherwise would have it live in /usr/etc/."
227 + einfo ""
228 + einfo "Protip: When using node-gyp to install native modules, you can"
229 + einfo "avoid having to download extras by doing the following:"
230 + einfo "$ node-gyp --nodedir /usr/include/node <command>"
231 +}