1 |
# This package is synced with Fedora. |
2 |
|
3 |
# This package is tricky since it requires a working nodejs to build nodejs |
4 |
# This causes problems if a broken nodejs gets into the repo |
5 |
|
6 |
# To build it from bootstrap |
7 |
# build a version with bootstrap. Change nodejs-tarball.sh to not strip out |
8 |
# the bundled libraries |
9 |
# |
10 |
# Once you have a working bootstrapped version, turn off bootstrap and |
11 |
# build with a nodejs-tarball.sh that strips out the bundled directories |
12 |
|
13 |
# bundle dependencies that are not available as Mageia modules |
14 |
# %%{!?_with_bootstrap: %%global bootstrap 1} |
15 |
# use bcond for building modules |
16 |
%bcond_without bootstrap |
17 |
|
18 |
%{?!_pkgdocdir:%global _pkgdocdir %{_docdir}/%{name}-%{version}} |
19 |
|
20 |
# == Node.js Version == |
21 |
# Note: Mageia should only ship LTS versions of Node.js (currently expected |
22 |
# to be major versions with even numbers). The odd-numbered versions are new |
23 |
# feature releases that are only supported for nine months, which is shorter |
24 |
# than a Mageia release lifecycle. |
25 |
%global nodejs_epoch 1 |
26 |
%global nodejs_major 14 |
27 |
%global nodejs_minor 4 |
28 |
%global nodejs_patch 0 |
29 |
%global nodejs_abi %{nodejs_major}.%{nodejs_minor} |
30 |
%global nodejs_soversion 83 |
31 |
%global nodejs_version %{nodejs_major}.%{nodejs_minor}.%{nodejs_patch} |
32 |
%global nodejs_release %{rel} |
33 |
# ensure compatibility with the mass_rebuild bot |
34 |
%define rel 1 |
35 |
|
36 |
# == Bundled Dependency Versions == |
37 |
# v8 - from deps/v8/include/v8-version.h |
38 |
# Epoch is set to ensure clean upgrades from the old v8 package |
39 |
%global v8_epoch 2 |
40 |
%global v8_major 8 |
41 |
%global v8_minor 1 |
42 |
%global v8_build 307 |
43 |
%global v8_patch 31 |
44 |
# V8 presently breaks ABI at least every x.y release while never bumping SONAME |
45 |
%global v8_abi %{v8_major}.%{v8_minor} |
46 |
%global v8_version %{v8_major}.%{v8_minor}.%{v8_build}.%{v8_patch} |
47 |
|
48 |
# c-ares - from deps/cares/include/ares_version.h |
49 |
# https://github.com/nodejs/node/pull/9332 |
50 |
%global c_ares_major 1 |
51 |
%global c_ares_minor 16 |
52 |
%global c_ares_patch 0 |
53 |
%global c_ares_version %{c_ares_major}.%{c_ares_minor}.%{c_ares_patch} |
54 |
|
55 |
# llhttp - from deps/llhttp/include/llhttp.h |
56 |
%global llhttp_major 2 |
57 |
%global llhttp_minor 0 |
58 |
%global llhttp_patch 4 |
59 |
%global llhttp_version %{llhttp_major}.%{llhttp_minor}.%{llhttp_patch} |
60 |
|
61 |
# libuv - from deps/uv/include/uv/version.h |
62 |
%global libuv_major 1 |
63 |
%global libuv_minor 37 |
64 |
%global libuv_patch 0 |
65 |
%global libuv_version %{libuv_major}.%{libuv_minor}.%{libuv_patch} |
66 |
|
67 |
# nghttp2 - from deps/nghttp2/lib/includes/nghttp2/nghttp2ver.h |
68 |
%global nghttp2_major 1 |
69 |
%global nghttp2_minor 41 |
70 |
%global nghttp2_patch 0 |
71 |
%global nghttp2_version %{nghttp2_major}.%{nghttp2_minor}.%{nghttp2_patch} |
72 |
|
73 |
# ICU - from tools/icu/current_ver.dep |
74 |
%global icu_major 67 |
75 |
%global icu_minor 1 |
76 |
%global icu_version %{icu_major}.%{icu_minor} |
77 |
|
78 |
# uvwasi - from deps/uvwasi/include/uvwasi.h |
79 |
%global uvwasi_major 0 |
80 |
%global uvwasi_minor 0 |
81 |
%global uvwasi_patch 8 |
82 |
%global uvwasi_version %{uvwasi_major}.%{uvwasi_minor}.%{uvwasi_patch} |
83 |
|
84 |
# histogram_c - assumed from timestamps |
85 |
%global histogram_major 0 |
86 |
%global histogram_minor 9 |
87 |
%global histogram_patch 7 |
88 |
%global histogram_version %{histogram_major}.%{histogram_minor}.%{histogram_patch} |
89 |
|
90 |
|
91 |
#%if 0%{?mageia} >= 7 |
92 |
#%global icu_flag system-icu |
93 |
#%else |
94 |
%global icu_flag small-icu |
95 |
#%endif |
96 |
|
97 |
|
98 |
# punycode - from lib/punycode.js |
99 |
# Note: this was merged into the mainline since 0.6.x |
100 |
# Note: this will be unmerged in an upcoming major release |
101 |
%global punycode_major 2 |
102 |
%global punycode_minor 1 |
103 |
%global punycode_patch 0 |
104 |
%global punycode_version %{punycode_major}.%{punycode_minor}.%{punycode_patch} |
105 |
|
106 |
# npm - from deps/npm/package.json |
107 |
%global npm_epoch 1 |
108 |
%global npm_major 6 |
109 |
%global npm_minor 14 |
110 |
%global npm_patch 5 |
111 |
%global npm_version %{npm_major}.%{npm_minor}.%{npm_patch} |
112 |
|
113 |
# In order to avoid needing to keep incrementing the release version for the |
114 |
# main package forever, we will just construct one for npm that is guaranteed |
115 |
# to increment safely. Changing this can only be done during an update when the |
116 |
# base npm version number is increasing. |
117 |
%global npm_release %{nodejs_epoch}.%{nodejs_major}.%{nodejs_minor}.%{nodejs_patch}.%{nodejs_release} |
118 |
|
119 |
|
120 |
Name: nodejs |
121 |
Epoch: %{nodejs_epoch} |
122 |
Version: %{nodejs_version} |
123 |
Release: %mkrel %{nodejs_release} |
124 |
Summary: JavaScript runtime |
125 |
License: MIT and ASL 2.0 and ISC and BSD |
126 |
Group: Development/Other |
127 |
URL: https://nodejs.org/ |
128 |
|
129 |
# ExclusiveArch: %{nodejs_arches} |
130 |
|
131 |
# nodejs bundles openssl, but we use the system version in Mageia |
132 |
# because openssl contains prohibited code, we remove openssl completely from |
133 |
# the tarball, using the script in Source100 |
134 |
|
135 |
Source0: node-v%{nodejs_version}-stripped.tar.xz |
136 |
Source100: %{name}-tarball.sh |
137 |
|
138 |
# The native module Requires generator remains in the nodejs SRPM, so it knows |
139 |
# the nodejs and v8 versions. The remainder has migrated to the |
140 |
# nodejs-packaging SRPM. |
141 |
Source7: nodejs_native.attr |
142 |
|
143 |
# Disable running gyp on bundled deps we don't use |
144 |
Patch1: 0001-Disable-running-gyp-on-shared-deps.patch |
145 |
Patch3: 0002-Install-both-binaries-and-use-libdir.patch |
146 |
|
147 |
BuildRequires: python3-devel |
148 |
BuildRequires: zlib-devel |
149 |
BuildRequires: brotli-devel |
150 |
BuildRequires: gcc >= 4.9.4 |
151 |
BuildRequires: gcc-c++ >= 4.9.4 |
152 |
BuildRequires: chrpath |
153 |
BuildRequires: libatomic-devel |
154 |
|
155 |
#%if ! 0%%{?bootstrap} |
156 |
%if %{with bootstrap} |
157 |
Provides: bundled(http-parser) = %{http_parser_version} |
158 |
Provides: bundled(libuv) = %{libuv_version} |
159 |
Provides: bundled(nghttp2) = %{nghttp2_version} |
160 |
%else |
161 |
BuildRequires: nodejs-packaging |
162 |
BuildRequires: systemtap |
163 |
BuildRequires: http-parser-devel >= 2.9.2 |
164 |
BuildRequires: libuv-devel >= %{libuv_version} |
165 |
BuildRequires: pkgconfig(libnghttp2) >= %{nghttp2_version} |
166 |
%endif |
167 |
|
168 |
BuildRequires: libicu-devel >= 63.1 |
169 |
BuildRequires: openssl-devel >= 1.1.1c |
170 |
|
171 |
# we need the system certificate store |
172 |
Requires: ca-certificates |
173 |
|
174 |
Requires: nodejs-libs = %{epoch}:%{nodejs_version}-%{nodejs_release}%{?dist} |
175 |
|
176 |
|
177 |
#we need ABI virtual provides where SONAMEs aren't enough/not present so deps |
178 |
#break when binary compatibility is broken |
179 |
Provides: nodejs(abi) = %{nodejs_abi} |
180 |
Provides: nodejs(abi%{nodejs_major}) = %{nodejs_abi} |
181 |
Provides: nodejs(v8-abi) = %{v8_abi} |
182 |
Provides: nodejs(v8-abi%{v8_major}) = %{v8_abi} |
183 |
|
184 |
#this corresponds to the "engine" requirement in package.json |
185 |
Provides: nodejs(engine) = %{nodejs_version} |
186 |
|
187 |
# Node.js currently has a conflict with the 'node' package in Mageia |
188 |
# The ham-radio group has agreed to rename their binary for us, but |
189 |
# in the meantime, we're setting an explicit Conflicts: here |
190 |
Conflicts: node <= 0.3.2-12 |
191 |
|
192 |
# The punycode module was absorbed into the standard library in v0.6. |
193 |
# It still exists as a seperate package for the benefit of users of older |
194 |
# versions. Since we've never shipped anything older than v0.10 in Mageia, |
195 |
# we don't need the seperate nodejs-punycode package, so we Provide it here so |
196 |
# dependent packages don't need to override the dependency generator. |
197 |
# See also: RHBZ#11511811 |
198 |
# UPDATE: punycode will be deprecated and so we should unbundle it in Node v8 |
199 |
# and use upstream module instead |
200 |
# https://github.com/nodejs/node/commit/29e49fc286080215031a81effbd59eac092fff2f |
201 |
Provides: nodejs-punycode = %{punycode_version} |
202 |
Provides: npm(punycode) = %{punycode_version} |
203 |
|
204 |
|
205 |
# Node.js has forked c-ares from upstream in an incompatible way, so we need |
206 |
# to carry the bundled version internally. |
207 |
# See https://github.com/nodejs/node/commit/766d063e0578c0f7758c3a965c971763f43fec85 |
208 |
Provides: bundled(c-ares) = %{c_ares_version} |
209 |
|
210 |
# Node.js is closely tied to the version of v8 that is used with it. It makes |
211 |
# sense to use the bundled version because upstream consistently breaks ABI |
212 |
# even in point releases. Node.js upstream has now removed the ability to build |
213 |
# against a shared system version entirely. |
214 |
# See https://github.com/nodejs/node/commit/d726a177ed59c37cf5306983ed00ecd858cfbbef |
215 |
Provides: bundled(v8) = %{v8_version} |
216 |
|
217 |
# Node.js is bound to a specific version of ICU which may not match the OS |
218 |
# We cannot pin the OS to this version of ICU because every update includes |
219 |
# an ABI-break, so we'll use the bundled copy. |
220 |
Provides: bundled(icu) = %{icu_version} |
221 |
|
222 |
# Upstream added new dependencies, but so far they are not available in Fedora |
223 |
# or there's no option to built it as a shared dependency, so we bundle them |
224 |
Provides: bundled(uvwasi) = %{uvwasi_version} |
225 |
Provides: bundled(histogram) = %{histogram_version} |
226 |
|
227 |
# Make sure we keep NPM up to date when we update Node.js |
228 |
Requires: npm = %{npm_epoch}:%{npm_version}-%{npm_release}%{?dist} |
229 |
|
230 |
%description |
231 |
Node.js is a platform built on Chrome's JavaScript runtime |
232 |
for easily building fast, scalable network applications. |
233 |
Node.js uses an event-driven, non-blocking I/O model that |
234 |
makes it lightweight and efficient, perfect for data-intensive |
235 |
real-time applications that run across distributed devices. |
236 |
|
237 |
%package devel |
238 |
Summary: JavaScript runtime - development headers |
239 |
Group: Development/Other |
240 |
Requires: %{name} = %{epoch}:%{nodejs_version}-%{nodejs_release}%{?dist} |
241 |
Requires: openssl-devel |
242 |
Requires: zlib-devel |
243 |
Requires: nodejs-packaging |
244 |
|
245 |
#%if ! 0%%{?bootstrap} |
246 |
%if %{with bootstrap} |
247 |
# deps are bundled |
248 |
%else |
249 |
Requires: http-parser-devel |
250 |
Requires: libuv-devel |
251 |
%endif |
252 |
|
253 |
%description devel |
254 |
Development headers for the Node.js JavaScript runtime. |
255 |
|
256 |
%package libs |
257 |
Summary: Node.js and v8 libraries |
258 |
|
259 |
# Compatibility for obsolete v8 package |
260 |
%if 0%{?__isa_bits} == 64 |
261 |
Provides: libv8.so.%{v8_major}()(64bit) |
262 |
Provides: libv8_libbase.so.%{v8_major}()(64bit) |
263 |
Provides: libv8_libplatform.so.%{v8_major}()(64bit) |
264 |
%else # 32-bits |
265 |
Provides: libv8.so.%{v8_major} |
266 |
Provides: libv8_libbase.so.%{v8_major} |
267 |
Provides: libv8_libplatform.so.%{v8_major} |
268 |
%endif |
269 |
|
270 |
Provides: v8 = %{v8_epoch}:%{v8_version}-%{nodejs_release}%{?dist} |
271 |
Provides: v8 = %{v8_epoch}:%{v8_version}-%{nodejs_release}%{?dist} |
272 |
Obsoletes: v8 < 1:6.7.17-10 |
273 |
|
274 |
%description libs |
275 |
Libraries to support Node.js and provide stable v8 interfaces. |
276 |
|
277 |
%package -n v8-devel |
278 |
Summary: v8 - development headers |
279 |
Epoch: %{v8_epoch} |
280 |
Version: %{v8_version}%{?dist} |
281 |
Requires: %{name}-devel = %{nodejs_epoch}:%{nodejs_version}-%{nodejs_release}%{?dist} |
282 |
|
283 |
%description -n v8-devel |
284 |
Development headers for the v8 runtime. |
285 |
|
286 |
%package -n npm |
287 |
Summary: Node.js Package Manager |
288 |
Epoch: %{npm_epoch} |
289 |
Version: %{npm_version} |
290 |
Release: %{npm_release}%{?dist} |
291 |
|
292 |
# We used to ship npm separately, but it is so tightly integrated with Node.js |
293 |
# (and expected to be present on all Node.js systems) that we ship it bundled |
294 |
# now. |
295 |
Obsoletes: npm < 0:3.5.4-6 |
296 |
Provides: npm = %{npm_epoch}:%{npm_version} |
297 |
Requires: nodejs = %{epoch}:%{nodejs_version}-%{nodejs_release}%{?dist} |
298 |
|
299 |
# Do not add epoch to the virtual NPM provides or it will break |
300 |
# the automatic dependency-generation script. |
301 |
Provides: npm(npm) = %{npm_version} |
302 |
|
303 |
%description -n npm |
304 |
npm is a package manager for node.js. You can use it to install and publish |
305 |
your node programs. It manages dependencies and does other cool stuff. |
306 |
|
307 |
%package docs |
308 |
Summary: Node.js API documentation |
309 |
Group: Documentation |
310 |
BuildArch: noarch |
311 |
|
312 |
# We don't require that the main package be installed to |
313 |
# use the docs, but if it is installed, make sure the |
314 |
# version always matches |
315 |
Conflicts: %{name} > %{epoch}:%{nodejs_version}-%{nodejs_release}%{?dist} |
316 |
Conflicts: %{name} < %{epoch}:%{nodejs_version}-%{nodejs_release}%{?dist} |
317 |
|
318 |
%description docs |
319 |
The API documentation for the Node.js JavaScript runtime. |
320 |
|
321 |
|
322 |
%prep |
323 |
%autosetup -p1 -n node-v%{nodejs_version} |
324 |
|
325 |
# remove bundled dependencies that we aren't building |
326 |
rm -rf deps/zlib |
327 |
rm -rf deps/brotli |
328 |
|
329 |
# Replace any instances of unversioned python' with python3 |
330 |
pathfix.py -i %{__python3} -pn $(find -type f ! -name "*.js") |
331 |
find . -type f -exec sed -i "s~/usr\/bin\/env python~/usr/bin/python3~" {} \; |
332 |
find . -type f -exec sed -i "s~/usr\/bin\/python\W~/usr/bin/python3~" {} \; |
333 |
sed -i "s~python~python3~" $(find . -type f | grep "gyp$") |
334 |
sed -i "s~usr\/bin\/python2~usr\/bin\/python3~" ./deps/v8/tools/gen-inlining-tests.py |
335 |
sed -i "s~usr\/bin\/python.*$~usr\/bin\/python3~" ./deps/v8/tools/mb/mb_unittest.py |
336 |
find . -type f -exec sed -i "s~python -c~python3 -c~" {} \; |
337 |
|
338 |
%build |
339 |
|
340 |
%ifarch s390 s390x %{arm} %ix86 |
341 |
# Decrease debuginfo verbosity to reduce memory consumption during final |
342 |
# library linking |
343 |
%global optflags %(echo %{optflags} | sed 's/-g /-g1 /') |
344 |
%endif |
345 |
|
346 |
# build with debugging symbols and add defines from libuv (#892601) |
347 |
# Node's v8 breaks with GCC 6 because of incorrect usage of methods on |
348 |
# NULL objects. We need to pass -fno-delete-null-pointer-checks |
349 |
export CFLAGS='%{optflags} -g \ |
350 |
-D_LARGEFILE_SOURCE \ |
351 |
-D_FILE_OFFSET_BITS=64 \ |
352 |
-DZLIB_CONST \ |
353 |
-fno-delete-null-pointer-checks' |
354 |
export CXXFLAGS='%{optflags} -g \ |
355 |
-D_LARGEFILE_SOURCE \ |
356 |
-D_FILE_OFFSET_BITS=64 \ |
357 |
-DZLIB_CONST \ |
358 |
-fno-delete-null-pointer-checks' |
359 |
|
360 |
# Explicit new lines in C(XX)FLAGS can break naive build scripts |
361 |
export CFLAGS="$(echo ${CFLAGS} | tr '\n\\' ' ')" |
362 |
export CXXFLAGS="$(echo ${CXXFLAGS} | tr '\n\\' ' ')" |
363 |
|
364 |
#export LDFLAGS="%{build_ldflags}" |
365 |
|
366 |
#%if ! 0%%{?bootstrap} |
367 |
%if %{with bootstrap} |
368 |
%{__python3} configure.py --prefix=%{_prefix} \ |
369 |
--shared \ |
370 |
--libdir=%{_lib} \ |
371 |
--shared-openssl \ |
372 |
--shared-zlib \ |
373 |
--shared-brotli \ |
374 |
--without-dtrace \ |
375 |
--with-intl=small-icu \ |
376 |
--debug-nghttp2 \ |
377 |
--openssl-use-def-ca-store |
378 |
%else |
379 |
%{__python3} configure.py --prefix=%{_prefix} \ |
380 |
--shared \ |
381 |
--libdir=%{_lib} \ |
382 |
--shared-openssl \ |
383 |
--shared-zlib \ |
384 |
--shared-brotli \ |
385 |
--shared-libuv \ |
386 |
--shared-nghttp2 \ |
387 |
--with-dtrace \ |
388 |
--with-intl=%{icu_flag} \ |
389 |
--debug-nghttp2 \ |
390 |
--openssl-use-def-ca-store |
391 |
%endif |
392 |
|
393 |
%__make BUILDTYPE=Release |
394 |
|
395 |
|
396 |
%install |
397 |
./tools/install.py install %{buildroot} %{_prefix} |
398 |
|
399 |
# Set the binary permissions properly |
400 |
chmod 0755 %{buildroot}/%{_bindir}/node |
401 |
chrpath --delete %{buildroot}%{_bindir}/node |
402 |
|
403 |
# Install library symlink |
404 |
ln -s %{_libdir}/libnode.so.%{nodejs_soversion} %{buildroot}%{_libdir}/libnode.so |
405 |
|
406 |
# Install v8 compatibility symlinks |
407 |
for header in %{buildroot}%{_includedir}/node/libplatform %{buildroot}%{_includedir}/node/v8*.h; do |
408 |
header=$(basename ${header}) |
409 |
ln -s %{_includedir}/node/${header} %{buildroot}%{_includedir}/${header} |
410 |
done |
411 |
for soname in libv8 libv8_libbase libv8_libplatform; do |
412 |
ln -s %{_libdir}/libnode.so.%{nodejs_soversion} %{buildroot}%{_libdir}/${soname}.so |
413 |
ln -s %{_libdir}/libnode.so.%{nodejs_soversion} %{buildroot}%{_libdir}/${soname}.so.%{v8_major} |
414 |
done |
415 |
|
416 |
# own the sitelib directory |
417 |
mkdir -p %{buildroot}%{_prefix}/lib/node_modules |
418 |
|
419 |
# ensure Requires are added to every native module that match the Provides from |
420 |
# the nodejs build in the buildroot |
421 |
install -Dpm0644 %{SOURCE7} %{buildroot}%{_rpmconfigdir}/fileattrs/nodejs_native.attr |
422 |
cat << EOF > %{buildroot}%{_rpmconfigdir}/nodejs_native.req |
423 |
#!/bin/sh |
424 |
echo 'nodejs(abi%{nodejs_major}) >= %nodejs_abi' |
425 |
echo 'nodejs(v8-abi%{v8_major}) >= %v8_abi' |
426 |
EOF |
427 |
chmod 0755 %{buildroot}%{_rpmconfigdir}/nodejs_native.req |
428 |
|
429 |
#install documentation |
430 |
mkdir -p %{buildroot}%{_pkgdocdir}/html |
431 |
cp -pr doc/* %{buildroot}%{_pkgdocdir}/html |
432 |
rm -f %{buildroot}%{_pkgdocdir}/html/nodejs.1 |
433 |
|
434 |
#node-gyp needs common.gypi too |
435 |
mkdir -p %{buildroot}%{_datadir}/node |
436 |
cp -p common.gypi %{buildroot}%{_datadir}/node |
437 |
|
438 |
# Install the GDB init tool into the documentation directory |
439 |
mv %{buildroot}/%{_datadir}/doc/node/gdbinit %{buildroot}/%{_pkgdocdir}/gdbinit |
440 |
|
441 |
# install NPM docs to mandir |
442 |
mkdir -p %{buildroot}%{_mandir} \ |
443 |
%{buildroot}%{_pkgdocdir}/npm |
444 |
|
445 |
cp -pr deps/npm/man/* %{buildroot}%{_mandir}/ |
446 |
rm -rf %{buildroot}%{_prefix}/lib/node_modules/npm/man |
447 |
ln -sf %{_mandir} %{buildroot}%{_prefix}/lib/node_modules/npm/man |
448 |
|
449 |
|
450 |
# Install Gatsby HTML documentation to %{_pkgdocdir} |
451 |
cp -pr deps/npm/docs %{buildroot}%{_pkgdocdir}/npm/ |
452 |
rm -rf %{buildroot}%{_prefix}/lib/node_modules/npm/docs |
453 |
|
454 |
ln -sf %{_pkgdocdir}/npm %{buildroot}%{_prefix}/lib/node_modules/npm/docs |
455 |
|
456 |
# Node tries to install some python files into a documentation directory |
457 |
# (and not the proper one). Remove them for now until we figure out what to |
458 |
# do with them. |
459 |
rm -f %{buildroot}/%{_defaultdocdir}/node/lldb_commands.py \ |
460 |
%{buildroot}/%{_defaultdocdir}/node/lldbinit |
461 |
|
462 |
# Some NPM bundled deps are executable but should not be. This causes |
463 |
# unnecessary automatic dependencies to be added. Make them not executable. |
464 |
# Skip the npm bin directory or the npm binary will not work. |
465 |
find %{buildroot}%{_prefix}/lib/node_modules/npm \ |
466 |
-not -path "%{buildroot}%{_prefix}/lib/node_modules/npm/bin/*" \ |
467 |
-executable -type f \ |
468 |
-exec chmod -x {} \; |
469 |
|
470 |
# The above command is a little overzealous. Add a few permissions back. |
471 |
chmod 0755 %{buildroot}%{_prefix}/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin/node-gyp |
472 |
chmod 0755 %{buildroot}%{_prefix}/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js |
473 |
|
474 |
|
475 |
%check |
476 |
# Fail the build if the versions don't match |
477 |
LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node -e "require('assert').equal(process.versions.node, '%{nodejs_version}')" |
478 |
LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node -e "require('assert').equal(process.versions.v8.replace(/-node\.\d+$/, ''), '%{v8_version}')" |
479 |
LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node -e "require('assert').equal(process.versions.ares.replace(/-DEV$/, ''), '%{c_ares_version}')" |
480 |
|
481 |
# Ensure we have punycode and that the version matches |
482 |
LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node -e "require(\"assert\").equal(require(\"punycode\").version, '%{punycode_version}')" |
483 |
|
484 |
# Ensure we have npm and that the version matches |
485 |
NODE_PATH=%{buildroot}%{_prefix}/lib/node_modules:%{buildroot}%{_prefix}/lib/node_modules/npm/node_modules LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node -e "require(\"assert\").equal(require(\"npm\").version, '%{npm_version}')" |
486 |
|
487 |
|
488 |
%pretrans -n npm -p <lua> |
489 |
-- Remove all of the symlinks from the bundled npm node_modules directory |
490 |
-- This scriptlet can be removed in Mageia 31 |
491 |
base_path = "%{_prefix}/lib/node_modules/npm/node_modules/" |
492 |
d_st = posix.stat(base_path) |
493 |
if d_st then |
494 |
for f in posix.files(base_path) do |
495 |
path = base_path..f |
496 |
st = posix.stat(path) |
497 |
if st and st.type == "link" then |
498 |
os.remove(path) |
499 |
end |
500 |
end |
501 |
end |
502 |
|
503 |
%files |
504 |
%{_bindir}/node |
505 |
%dir %{_prefix}/lib/node_modules |
506 |
%dir %{_datadir}/node |
507 |
%dir %{_datadir}/systemtap |
508 |
%dir %{_datadir}/systemtap/tapset |
509 |
%{_datadir}/systemtap/tapset/node.stp |
510 |
|
511 |
#%if ! 0%%{?bootstrap} |
512 |
%if %{with bootstrap} |
513 |
# no dtrace |
514 |
%else |
515 |
%dir %{_usr}/lib/dtrace |
516 |
%{_usr}/lib/dtrace/node.d |
517 |
%endif |
518 |
|
519 |
%{_rpmconfigdir}/fileattrs/nodejs_native.attr |
520 |
%{_rpmconfigdir}/nodejs_native.req |
521 |
%license LICENSE |
522 |
%doc AUTHORS CHANGELOG.md GOVERNANCE.md README.md |
523 |
%doc %{_mandir}/man1/node.1* |
524 |
|
525 |
|
526 |
%files devel |
527 |
%{_includedir}/node |
528 |
%{_libdir}/libnode.so |
529 |
%{_datadir}/node/common.gypi |
530 |
%{_pkgdocdir}/gdbinit |
531 |
|
532 |
|
533 |
%files libs |
534 |
%{_libdir}/libnode.so.%{nodejs_soversion} |
535 |
%{_libdir}/libv8.so.%{v8_major} |
536 |
%{_libdir}/libv8_libbase.so.%{v8_major} |
537 |
%{_libdir}/libv8_libplatform.so.%{v8_major} |
538 |
|
539 |
|
540 |
%files -n v8-devel |
541 |
%{_includedir}/libplatform |
542 |
%{_includedir}/v8*.h |
543 |
%{_libdir}/libv8.so |
544 |
%{_libdir}/libv8_libbase.so |
545 |
%{_libdir}/libv8_libplatform.so |
546 |
|
547 |
|
548 |
%files -n npm |
549 |
%{_bindir}/npm |
550 |
%{_bindir}/npx |
551 |
%{_prefix}/lib/node_modules/npm |
552 |
%ghost %{_sysconfdir}/npmrc |
553 |
%ghost %{_sysconfdir}/npmignore |
554 |
%doc %{_mandir}/man*/npm* |
555 |
%doc %{_mandir}/man*/npx* |
556 |
%doc %{_mandir}/man7/semver.7* |
557 |
%doc %{_mandir}/man5/*.5.xz |
558 |
%doc %{_mandir}/man7/*.7.xz |
559 |
|
560 |
%files docs |
561 |
%dir %{_pkgdocdir} |
562 |
%{_pkgdocdir}/html |
563 |
%{_pkgdocdir}/npm/docs |