1 |
commit: e118cba234ace45cab0afd5857dedeb07513bd97 |
2 |
Author: Marek Szuba <marecki <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Apr 22 15:24:45 2021 +0000 |
4 |
Commit: Marek Szuba <marecki <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Apr 22 15:27:22 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e118cba2 |
7 |
|
8 |
net-libs/nodejs-14.16.1: implement IUSE=lto |
9 |
|
10 |
No patching necessary as although node-v14 does have |
11 |
"PushAllRegistersAndIterateStack", it is linked differently |
12 |
than in v16. |
13 |
|
14 |
Signed-off-by: Marek Szuba <marecki <AT> gentoo.org> |
15 |
|
16 |
net-libs/nodejs/nodejs-14.16.1-r1.ebuild | 217 +++++++++++++++++++++++++++++++ |
17 |
1 file changed, 217 insertions(+) |
18 |
|
19 |
diff --git a/net-libs/nodejs/nodejs-14.16.1-r1.ebuild b/net-libs/nodejs/nodejs-14.16.1-r1.ebuild |
20 |
new file mode 100644 |
21 |
index 00000000000..481182d7756 |
22 |
--- /dev/null |
23 |
+++ b/net-libs/nodejs/nodejs-14.16.1-r1.ebuild |
24 |
@@ -0,0 +1,217 @@ |
25 |
+# Copyright 1999-2021 Gentoo Authors |
26 |
+# Distributed under the terms of the GNU General Public License v2 |
27 |
+ |
28 |
+EAPI=7 |
29 |
+ |
30 |
+PYTHON_COMPAT=( python3_{7..9} ) |
31 |
+PYTHON_REQ_USE="threads(+)" |
32 |
+ |
33 |
+inherit bash-completion-r1 pax-utils python-any-r1 toolchain-funcs xdg-utils |
34 |
+ |
35 |
+DESCRIPTION="A JavaScript runtime built on Chrome's V8 JavaScript engine" |
36 |
+HOMEPAGE="https://nodejs.org/" |
37 |
+SRC_URI="https://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz" |
38 |
+ |
39 |
+LICENSE="Apache-1.1 Apache-2.0 BSD BSD-2 MIT" |
40 |
+SLOT="0/$(ver_cut 1)" |
41 |
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86 ~amd64-linux ~x64-macos" |
42 |
+ |
43 |
+IUSE="cpu_flags_x86_sse2 debug doc +icu inspector lto +npm pax_kernel +snapshot +ssl system-icu +system-ssl systemtap test" |
44 |
+REQUIRED_USE="inspector? ( icu ssl ) |
45 |
+ npm? ( ssl ) |
46 |
+ system-icu? ( icu ) |
47 |
+ system-ssl? ( ssl )" |
48 |
+ |
49 |
+# FIXME: test-fs-mkdir fails with "no such file or directory". Investigate. |
50 |
+RESTRICT="test" |
51 |
+ |
52 |
+RDEPEND=">=app-arch/brotli-1.0.9 |
53 |
+ >=dev-libs/libuv-1.40.0:= |
54 |
+ >=net-dns/c-ares-1.16.1 |
55 |
+ >=net-libs/nghttp2-1.41.0 |
56 |
+ sys-libs/zlib |
57 |
+ system-icu? ( >=dev-libs/icu-67:= ) |
58 |
+ system-ssl? ( >=dev-libs/openssl-1.1.1:0= )" |
59 |
+BDEPEND="${PYTHON_DEPS} |
60 |
+ sys-apps/coreutils |
61 |
+ virtual/pkgconfig |
62 |
+ systemtap? ( dev-util/systemtap ) |
63 |
+ test? ( net-misc/curl ) |
64 |
+ pax_kernel? ( sys-apps/elfix )" |
65 |
+DEPEND="${RDEPEND}" |
66 |
+ |
67 |
+PATCHES=( |
68 |
+ "${FILESDIR}"/${PN}-10.3.0-global-npm-config.patch |
69 |
+ "${FILESDIR}"/${PN}-14.15.0-fix_ppc64_crashes.patch |
70 |
+ "${FILESDIR}"/${PN}-14.16.1-v8_icu69.patch |
71 |
+) |
72 |
+ |
73 |
+S="${WORKDIR}/node-v${PV}" |
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 |
+ if [[ ${MERGE_TYPE} != "binary" ]]; then |
80 |
+ if use lto; then |
81 |
+ tc-is-gcc || die "${PN} only supports LTO for gcc" |
82 |
+ fi |
83 |
+ fi |
84 |
+} |
85 |
+ |
86 |
+src_prepare() { |
87 |
+ tc-export AR CC CXX PKG_CONFIG |
88 |
+ export V=1 |
89 |
+ export BUILDTYPE=Release |
90 |
+ |
91 |
+ # fix compilation on Darwin |
92 |
+ # https://code.google.com/p/gyp/issues/detail?id=260 |
93 |
+ sed -i -e "/append('-arch/d" tools/gyp/pylib/gyp/xcode_emulation.py || 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}'/" 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 node.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 |
+ # We need to disable mprotect on two files when it builds Bug 694100. |
122 |
+ use pax_kernel && PATCHES+=( "${FILESDIR}"/${PN}-13.8.0-paxmarking.patch ) |
123 |
+ |
124 |
+ default |
125 |
+} |
126 |
+ |
127 |
+src_configure() { |
128 |
+ xdg_environment_reset |
129 |
+ |
130 |
+ local myconf=( |
131 |
+ --shared-brotli |
132 |
+ --shared-cares |
133 |
+ --shared-libuv |
134 |
+ --shared-nghttp2 |
135 |
+ --shared-zlib |
136 |
+ ) |
137 |
+ use debug && myconf+=( --debug ) |
138 |
+ use lto && myconf+=( --enable-lto ) |
139 |
+ if use system-icu; then |
140 |
+ myconf+=( --with-intl=system-icu ) |
141 |
+ elif use icu; then |
142 |
+ myconf+=( --with-intl=full-icu ) |
143 |
+ else |
144 |
+ myconf+=( --with-intl=none ) |
145 |
+ fi |
146 |
+ use inspector || myconf+=( --without-inspector ) |
147 |
+ use npm || myconf+=( --without-npm ) |
148 |
+ use snapshot || myconf+=( --without-node-snapshot ) |
149 |
+ if use ssl; then |
150 |
+ use system-ssl && myconf+=( --shared-openssl --openssl-use-def-ca-store ) |
151 |
+ else |
152 |
+ myconf+=( --without-ssl ) |
153 |
+ fi |
154 |
+ |
155 |
+ local myarch="" |
156 |
+ case ${ABI} in |
157 |
+ amd64) myarch="x64";; |
158 |
+ arm) myarch="arm";; |
159 |
+ arm64) myarch="arm64";; |
160 |
+ ppc64) myarch="ppc64";; |
161 |
+ x32) myarch="x32";; |
162 |
+ x86) myarch="ia32";; |
163 |
+ *) myarch="${ABI}";; |
164 |
+ esac |
165 |
+ |
166 |
+ GYP_DEFINES="linux_use_gold_flags=0 |
167 |
+ linux_use_bundled_binutils=0 |
168 |
+ linux_use_bundled_gold=0" \ |
169 |
+ "${EPYTHON}" configure.py \ |
170 |
+ --prefix="${EPREFIX}"/usr \ |
171 |
+ --dest-cpu=${myarch} \ |
172 |
+ $(use_with systemtap dtrace) \ |
173 |
+ "${myconf[@]}" || die |
174 |
+} |
175 |
+ |
176 |
+src_compile() { |
177 |
+ emake -C out |
178 |
+} |
179 |
+ |
180 |
+src_install() { |
181 |
+ local LIBDIR="${ED}/usr/$(get_libdir)" |
182 |
+ default |
183 |
+ |
184 |
+ pax-mark -m "${ED}"/usr/bin/node |
185 |
+ |
186 |
+ # set up a symlink structure that node-gyp expects.. |
187 |
+ dodir /usr/include/node/deps/{v8,uv} |
188 |
+ dosym . /usr/include/node/src |
189 |
+ for var in deps/{uv,v8}/include; do |
190 |
+ dosym ../.. /usr/include/node/${var} |
191 |
+ done |
192 |
+ |
193 |
+ if use doc; then |
194 |
+ docinto html |
195 |
+ dodoc -r "${S}"/doc/* |
196 |
+ fi |
197 |
+ |
198 |
+ if use npm; then |
199 |
+ dodir /etc/npm |
200 |
+ |
201 |
+ # Install bash completion for `npm` |
202 |
+ # We need to temporarily replace default config path since |
203 |
+ # npm otherwise tries to write outside of the sandbox |
204 |
+ local npm_config="usr/$(get_libdir)/node_modules/npm/lib/config/core.js" |
205 |
+ sed -i -e "s|'/etc'|'${ED}/etc'|g" "${ED}/${npm_config}" || die |
206 |
+ local tmp_npm_completion_file="$(TMPDIR="${T}" mktemp -t npm.XXXXXXXXXX)" |
207 |
+ "${ED}/usr/bin/npm" completion > "${tmp_npm_completion_file}" |
208 |
+ newbashcomp "${tmp_npm_completion_file}" npm |
209 |
+ sed -i -e "s|'${ED}/etc'|'/etc'|g" "${ED}/${npm_config}" || die |
210 |
+ |
211 |
+ # Move man pages |
212 |
+ doman "${LIBDIR}"/node_modules/npm/man/man{1,5,7}/* |
213 |
+ |
214 |
+ # Clean up |
215 |
+ rm -f "${LIBDIR}"/node_modules/npm/{.mailmap,.npmignore,Makefile} |
216 |
+ rm -rf "${LIBDIR}"/node_modules/npm/{doc,html,man} |
217 |
+ |
218 |
+ local find_exp="-or -name" |
219 |
+ local find_name=() |
220 |
+ for match in "AUTHORS*" "CHANGELOG*" "CONTRIBUT*" "README*" \ |
221 |
+ ".travis.yml" ".eslint*" ".wercker.yml" ".npmignore" \ |
222 |
+ "*.md" "*.markdown" "*.bat" "*.cmd"; do |
223 |
+ find_name+=( ${find_exp} "${match}" ) |
224 |
+ done |
225 |
+ |
226 |
+ # Remove various development and/or inappropriate files and |
227 |
+ # useless docs of dependend packages. |
228 |
+ find "${LIBDIR}"/node_modules \ |
229 |
+ \( -type d -name examples \) -or \( -type f \( \ |
230 |
+ -iname "LICEN?E*" \ |
231 |
+ "${find_name[@]}" \ |
232 |
+ \) \) -exec rm -rf "{}" \; |
233 |
+ fi |
234 |
+ |
235 |
+ mv "${ED}"/usr/share/doc/node "${ED}"/usr/share/doc/${PF} || die |
236 |
+} |
237 |
+ |
238 |
+src_test() { |
239 |
+ out/${BUILDTYPE}/cctest || die |
240 |
+ "${EPYTHON}" tools/test.py --mode=${BUILDTYPE,,} -J message parallel sequential || die |
241 |
+} |