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 12 |
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 4 |
42 |
%global v8_build 371 |
43 |
%global v8_patch 19 |
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 |
%global v8_release 4 |
48 |
|
49 |
# c-ares - from deps/cares/include/ares_version.h |
50 |
# https://github.com/nodejs/node/pull/9332 |
51 |
%global c_ares_major 1 |
52 |
%global c_ares_minor 16 |
53 |
%global c_ares_patch 0 |
54 |
%global c_ares_version %{c_ares_major}.%{c_ares_minor}.%{c_ares_patch} |
55 |
|
56 |
# llhttp - from deps/llhttp/include/llhttp.h |
57 |
%global llhttp_major 2 |
58 |
%global llhttp_minor 1 |
59 |
%global llhttp_patch 2 |
60 |
%global llhttp_version %{llhttp_major}.%{llhttp_minor}.%{llhttp_patch} |
61 |
|
62 |
# libuv - from deps/uv/include/uv/version.h |
63 |
%global libuv_major 1 |
64 |
%global libuv_minor 39 |
65 |
%global libuv_patch 0 |
66 |
%global libuv_version %{libuv_major}.%{libuv_minor}.%{libuv_patch} |
67 |
|
68 |
# nghttp2 - from deps/nghttp2/lib/includes/nghttp2/nghttp2ver.h |
69 |
%global nghttp2_major 1 |
70 |
%global nghttp2_minor 41 |
71 |
%global nghttp2_patch 0 |
72 |
%global nghttp2_version %{nghttp2_major}.%{nghttp2_minor}.%{nghttp2_patch} |
73 |
|
74 |
# ICU - from tools/icu/current_ver.dep |
75 |
%global icu_major 67 |
76 |
%global icu_minor 1 |
77 |
%global icu_version %{icu_major}.%{icu_minor} |
78 |
|
79 |
# uvwasi - from deps/uvwasi/include/uvwasi.h |
80 |
%global uvwasi_major 0 |
81 |
%global uvwasi_minor 0 |
82 |
%global uvwasi_patch 11 |
83 |
%global uvwasi_version %{uvwasi_major}.%{uvwasi_minor}.%{uvwasi_patch} |
84 |
|
85 |
# histogram_c - assumed from timestamps |
86 |
%global histogram_major 0 |
87 |
%global histogram_minor 9 |
88 |
%global histogram_patch 7 |
89 |
%global histogram_version %{histogram_major}.%{histogram_minor}.%{histogram_patch} |
90 |
|
91 |
|
92 |
#%if 0%{?mageia} >= 7 |
93 |
#%global icu_flag system-icu |
94 |
#%else |
95 |
%global icu_flag small-icu |
96 |
#%endif |
97 |
|
98 |
|
99 |
# punycode - from lib/punycode.js |
100 |
# Note: this was merged into the mainline since 0.6.x |
101 |
# Note: this will be unmerged in an upcoming major release |
102 |
%global punycode_major 2 |
103 |
%global punycode_minor 1 |
104 |
%global punycode_patch 0 |
105 |
%global punycode_version %{punycode_major}.%{punycode_minor}.%{punycode_patch} |
106 |
|
107 |
# npm - from deps/npm/package.json |
108 |
%global npm_epoch 1 |
109 |
%global npm_major 6 |
110 |
%global npm_minor 14 |
111 |
%global npm_patch 8 |
112 |
%global npm_version %{npm_major}.%{npm_minor}.%{npm_patch} |
113 |
|
114 |
# In order to avoid needing to keep incrementing the release version for the |
115 |
# main package forever, we will just construct one for npm that is guaranteed |
116 |
# to increment safely. Changing this can only be done during an update when the |
117 |
# base npm version number is increasing. |
118 |
%global npm_release %{nodejs_epoch}.%{nodejs_major}.%{nodejs_minor}.%{nodejs_patch}.%{nodejs_release} |
119 |
|
120 |
|
121 |
Name: nodejs |
122 |
Epoch: %{nodejs_epoch} |
123 |
Version: %{nodejs_version} |
124 |
Release: %mkrel %{nodejs_release} |
125 |
Summary: JavaScript runtime |
126 |
License: MIT and ASL 2.0 and ISC and BSD |
127 |
Group: Development/Other |
128 |
URL: https://nodejs.org/ |
129 |
|
130 |
# ExclusiveArch: %{nodejs_arches} |
131 |
|
132 |
# nodejs bundles openssl, but we use the system version in Mageia |
133 |
# because openssl contains prohibited code, we remove openssl completely from |
134 |
# the tarball, using the script in Source100 |
135 |
|
136 |
Source0: node-v%{nodejs_version}-stripped.tar.xz |
137 |
Source100: %{name}-tarball.sh |
138 |
|
139 |
# The native module Requires generator remains in the nodejs SRPM, so it knows |
140 |
# the nodejs and v8 versions. The remainder has migrated to the |
141 |
# nodejs-packaging SRPM. |
142 |
Source7: nodejs_native.attr |
143 |
|
144 |
# Disable running gyp on bundled deps we don't use |
145 |
Patch1: 0001-Disable-running-gyp-on-shared-deps.patch |
146 |
Patch3: 0002-Install-both-binaries-and-use-libdir.patch |
147 |
|
148 |
BuildRequires: python3-devel |
149 |
BuildRequires: zlib-devel |
150 |
BuildRequires: brotli-devel |
151 |
BuildRequires: gcc >= 4.9.4 |
152 |
BuildRequires: gcc-c++ >= 4.9.4 |
153 |
BuildRequires: chrpath |
154 |
BuildRequires: libatomic-devel |
155 |
|
156 |
#%if ! 0%%{?bootstrap} |
157 |
%if %{with bootstrap} |
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 |
Release: %{v8_release}%{?dist} |
282 |
Requires: %{name}-devel = %{nodejs_epoch}:%{nodejs_version}-%{nodejs_release}%{?dist} |
283 |
|
284 |
%description -n v8-devel |
285 |
Development headers for the v8 runtime. |
286 |
|
287 |
%package -n npm |
288 |
Summary: Node.js Package Manager |
289 |
Epoch: %{npm_epoch} |
290 |
Version: %{npm_version} |
291 |
Release: %{npm_release}%{?dist} |
292 |
|
293 |
# We used to ship npm separately, but it is so tightly integrated with Node.js |
294 |
# (and expected to be present on all Node.js systems) that we ship it bundled |
295 |
# now. |
296 |
Obsoletes: npm < 0:3.5.4-6 |
297 |
Provides: npm = %{npm_epoch}:%{npm_version} |
298 |
Requires: nodejs = %{epoch}:%{nodejs_version}-%{nodejs_release}%{?dist} |
299 |
|
300 |
# Do not add epoch to the virtual NPM provides or it will break |
301 |
# the automatic dependency-generation script. |
302 |
Provides: npm(npm) = %{npm_version} |
303 |
|
304 |
%description -n npm |
305 |
npm is a package manager for node.js. You can use it to install and publish |
306 |
your node programs. It manages dependencies and does other cool stuff. |
307 |
|
308 |
%package docs |
309 |
Summary: Node.js API documentation |
310 |
Group: Documentation |
311 |
BuildArch: noarch |
312 |
|
313 |
# We don't require that the main package be installed to |
314 |
# use the docs, but if it is installed, make sure the |
315 |
# version always matches |
316 |
Conflicts: %{name} > %{epoch}:%{nodejs_version}-%{nodejs_release}%{?dist} |
317 |
Conflicts: %{name} < %{epoch}:%{nodejs_version}-%{nodejs_release}%{?dist} |
318 |
|
319 |
%description docs |
320 |
The API documentation for the Node.js JavaScript runtime. |
321 |
|
322 |
|
323 |
%prep |
324 |
%autosetup -p1 -n node-v%{nodejs_version} |
325 |
|
326 |
# remove bundled dependencies that we aren't building |
327 |
rm -rf deps/zlib |
328 |
rm -rf deps/brotli |
329 |
|
330 |
# Replace any instances of unversioned python' with python3 |
331 |
pathfix.py -i %{__python3} -pn $(find -type f ! -name "*.js") |
332 |
find . -type f -exec sed -i "s~/usr\/bin\/env python~/usr/bin/python3~" {} \; |
333 |
find . -type f -exec sed -i "s~/usr\/bin\/python\W~/usr/bin/python3~" {} \; |
334 |
sed -i "s~python~python3~" $(find . -type f | grep "gyp$") |
335 |
sed -i "s~usr\/bin\/python2~usr\/bin\/python3~" ./deps/v8/tools/gen-inlining-tests.py |
336 |
sed -i "s~usr\/bin\/python.*$~usr\/bin\/python3~" ./deps/v8/tools/mb/mb_unittest.py |
337 |
find . -type f -exec sed -i "s~python -c~python3 -c~" {} \; |
338 |
|
339 |
%build |
340 |
|
341 |
%ifarch s390 s390x %{arm} %ix86 |
342 |
# Decrease debuginfo verbosity to reduce memory consumption during final |
343 |
# library linking |
344 |
%global optflags %(echo %{optflags} | sed 's/-g /-g1 /') |
345 |
%endif |
346 |
|
347 |
export CC='%{__cc}' |
348 |
export CXX='%{__cxx}' |
349 |
|
350 |
# build with debugging symbols and add defines from libuv (#892601) |
351 |
# Node's v8 breaks with GCC 6 because of incorrect usage of methods on |
352 |
# NULL objects. We need to pass -fno-delete-null-pointer-checks |
353 |
export CFLAGS='%{optflags} \ |
354 |
-D_LARGEFILE_SOURCE \ |
355 |
-D_FILE_OFFSET_BITS=64 \ |
356 |
-DZLIB_CONST \ |
357 |
-fno-delete-null-pointer-checks' |
358 |
export CXXFLAGS='%{optflags} \ |
359 |
-D_LARGEFILE_SOURCE \ |
360 |
-D_FILE_OFFSET_BITS=64 \ |
361 |
-DZLIB_CONST \ |
362 |
-fno-delete-null-pointer-checks' |
363 |
|
364 |
# Explicit new lines in C(XX)FLAGS can break naive build scripts |
365 |
export CFLAGS="$(echo ${CFLAGS} | tr '\n\\' ' ')" |
366 |
export CXXFLAGS="$(echo ${CXXFLAGS} | tr '\n\\' ' ')" |
367 |
export LDFLAGS="%{build_ldflags}" |
368 |
|
369 |
#%if ! 0%%{?bootstrap} |
370 |
%if %{with bootstrap} |
371 |
%{__python3} configure.py --prefix=%{_prefix} \ |
372 |
--shared \ |
373 |
--libdir=%{_lib} \ |
374 |
--shared-openssl \ |
375 |
--shared-zlib \ |
376 |
--shared-brotli \ |
377 |
--without-dtrace \ |
378 |
--with-intl=small-icu \ |
379 |
--debug-nghttp2 \ |
380 |
--openssl-use-def-ca-store |
381 |
%else |
382 |
%{__python3} configure.py --prefix=%{_prefix} \ |
383 |
--shared \ |
384 |
--libdir=%{_lib} \ |
385 |
--shared-openssl \ |
386 |
--shared-zlib \ |
387 |
--shared-brotli \ |
388 |
--shared-libuv \ |
389 |
--shared-nghttp2 \ |
390 |
--with-dtrace \ |
391 |
--with-intl=%{icu_flag} \ |
392 |
--debug-nghttp2 \ |
393 |
--openssl-use-def-ca-store |
394 |
%endif |
395 |
|
396 |
%__make BUILDTYPE=Release %{?_smp_mflags} |
397 |
|
398 |
|
399 |
%install |
400 |
./tools/install.py install %{buildroot} %{_prefix} |
401 |
|
402 |
# Set the binary permissions properly |
403 |
chmod 0755 %{buildroot}/%{_bindir}/node |
404 |
chrpath --delete %{buildroot}%{_bindir}/node |
405 |
|
406 |
# Install library symlink |
407 |
ln -s %{_libdir}/libnode.so.%{nodejs_soversion} %{buildroot}%{_libdir}/libnode.so |
408 |
|
409 |
# Install v8 compatibility symlinks |
410 |
for header in %{buildroot}%{_includedir}/node/libplatform %{buildroot}%{_includedir}/node/v8*.h; do |
411 |
header=$(basename ${header}) |
412 |
ln -s %{_includedir}/node/${header} %{buildroot}%{_includedir}/${header} |
413 |
done |
414 |
for soname in libv8 libv8_libbase libv8_libplatform; do |
415 |
ln -s %{_libdir}/libnode.so.%{nodejs_soversion} %{buildroot}%{_libdir}/${soname}.so |
416 |
ln -s %{_libdir}/libnode.so.%{nodejs_soversion} %{buildroot}%{_libdir}/${soname}.so.%{v8_major} |
417 |
done |
418 |
|
419 |
# own the sitelib directory |
420 |
mkdir -p %{buildroot}%{_prefix}/lib/node_modules |
421 |
|
422 |
# ensure Requires are added to every native module that match the Provides from |
423 |
# the nodejs build in the buildroot |
424 |
install -Dpm0644 %{SOURCE7} %{buildroot}%{_rpmconfigdir}/fileattrs/nodejs_native.attr |
425 |
cat << EOF > %{buildroot}%{_rpmconfigdir}/nodejs_native.req |
426 |
#!/bin/sh |
427 |
echo 'nodejs(abi%{nodejs_major}) >= %nodejs_abi' |
428 |
echo 'nodejs(v8-abi%{v8_major}) >= %v8_abi' |
429 |
EOF |
430 |
chmod 0755 %{buildroot}%{_rpmconfigdir}/nodejs_native.req |
431 |
|
432 |
#install documentation |
433 |
mkdir -p %{buildroot}%{_pkgdocdir}/html |
434 |
cp -pr doc/* %{buildroot}%{_pkgdocdir}/html |
435 |
rm -f %{buildroot}%{_pkgdocdir}/html/nodejs.1 |
436 |
|
437 |
#node-gyp needs common.gypi too |
438 |
mkdir -p %{buildroot}%{_datadir}/node |
439 |
cp -p common.gypi %{buildroot}%{_datadir}/node |
440 |
|
441 |
# Install the GDB init tool into the documentation directory |
442 |
mv %{buildroot}/%{_datadir}/doc/node/gdbinit %{buildroot}/%{_pkgdocdir}/gdbinit |
443 |
|
444 |
# install NPM docs to mandir |
445 |
mkdir -p %{buildroot}%{_mandir} \ |
446 |
%{buildroot}%{_pkgdocdir}/npm |
447 |
|
448 |
cp -pr deps/npm/man/* %{buildroot}%{_mandir}/ |
449 |
rm -rf %{buildroot}%{_prefix}/lib/node_modules/npm/man |
450 |
ln -sf %{_mandir} %{buildroot}%{_prefix}/lib/node_modules/npm/man |
451 |
|
452 |
|
453 |
# Install Gatsby HTML documentation to %{_pkgdocdir} |
454 |
cp -pr deps/npm/docs %{buildroot}%{_pkgdocdir}/npm/ |
455 |
rm -rf %{buildroot}%{_prefix}/lib/node_modules/npm/docs |
456 |
|
457 |
ln -sf %{_pkgdocdir}/npm %{buildroot}%{_prefix}/lib/node_modules/npm/docs |
458 |
|
459 |
# Node tries to install some python files into a documentation directory |
460 |
# (and not the proper one). Remove them for now until we figure out what to |
461 |
# do with them. |
462 |
rm -f %{buildroot}/%{_defaultdocdir}/node/lldb_commands.py \ |
463 |
%{buildroot}/%{_defaultdocdir}/node/lldbinit |
464 |
|
465 |
# Some NPM bundled deps are executable but should not be. This causes |
466 |
# unnecessary automatic dependencies to be added. Make them not executable. |
467 |
# Skip the npm bin directory or the npm binary will not work. |
468 |
find %{buildroot}%{_prefix}/lib/node_modules/npm \ |
469 |
-not -path "%{buildroot}%{_prefix}/lib/node_modules/npm/bin/*" \ |
470 |
-executable -type f \ |
471 |
-exec chmod -x {} \; |
472 |
|
473 |
# The above command is a little overzealous. Add a few permissions back. |
474 |
chmod 0755 %{buildroot}%{_prefix}/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin/node-gyp |
475 |
chmod 0755 %{buildroot}%{_prefix}/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js |
476 |
|
477 |
|
478 |
%check |
479 |
# Fail the build if the versions don't match |
480 |
LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node -e "require('assert').equal(process.versions.node, '%{nodejs_version}')" |
481 |
LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node -e "require('assert').equal(process.versions.v8.replace(/-node\.\d+$/, ''), '%{v8_version}')" |
482 |
LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node -e "require('assert').equal(process.versions.ares.replace(/-DEV$/, ''), '%{c_ares_version}')" |
483 |
|
484 |
# Ensure we have punycode and that the version matches |
485 |
LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node -e "require(\"assert\").equal(require(\"punycode\").version, '%{punycode_version}')" |
486 |
|
487 |
# Ensure we have npm and that the version matches |
488 |
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}')" |
489 |
|
490 |
|
491 |
%pretrans -n npm -p <lua> |
492 |
-- Remove all of the symlinks from the bundled npm node_modules directory |
493 |
-- This scriptlet can be removed in Mageia 31 |
494 |
base_path = "%{_prefix}/lib/node_modules/npm/node_modules/" |
495 |
d_st = posix.stat(base_path) |
496 |
if d_st then |
497 |
for f in posix.files(base_path) do |
498 |
path = base_path..f |
499 |
st = posix.stat(path) |
500 |
if st and st.type == "link" then |
501 |
os.remove(path) |
502 |
end |
503 |
end |
504 |
end |
505 |
|
506 |
%files |
507 |
%{_bindir}/node |
508 |
%dir %{_prefix}/lib/node_modules |
509 |
%dir %{_datadir}/node |
510 |
%dir %{_datadir}/systemtap |
511 |
%dir %{_datadir}/systemtap/tapset |
512 |
%{_datadir}/systemtap/tapset/node.stp |
513 |
|
514 |
#%if ! 0%%{?bootstrap} |
515 |
%if %{with bootstrap} |
516 |
# no dtrace |
517 |
%else |
518 |
%dir %{_usr}/lib/dtrace |
519 |
%{_usr}/lib/dtrace/node.d |
520 |
%endif |
521 |
|
522 |
%{_rpmconfigdir}/fileattrs/nodejs_native.attr |
523 |
%{_rpmconfigdir}/nodejs_native.req |
524 |
%license LICENSE |
525 |
%doc AUTHORS CHANGELOG.md GOVERNANCE.md README.md |
526 |
%doc %{_mandir}/man1/node.1* |
527 |
|
528 |
|
529 |
%files devel |
530 |
%{_includedir}/node |
531 |
%{_libdir}/libnode.so |
532 |
%{_datadir}/node/common.gypi |
533 |
%{_pkgdocdir}/gdbinit |
534 |
|
535 |
|
536 |
%files libs |
537 |
%{_libdir}/libnode.so.%{nodejs_soversion} |
538 |
%{_libdir}/libv8.so.%{v8_major} |
539 |
%{_libdir}/libv8_libbase.so.%{v8_major} |
540 |
%{_libdir}/libv8_libplatform.so.%{v8_major} |
541 |
|
542 |
|
543 |
%files -n v8-devel |
544 |
%{_includedir}/libplatform |
545 |
%{_includedir}/v8*.h |
546 |
%{_libdir}/libv8.so |
547 |
%{_libdir}/libv8_libbase.so |
548 |
%{_libdir}/libv8_libplatform.so |
549 |
|
550 |
|
551 |
%files -n npm |
552 |
%{_bindir}/npm |
553 |
%{_bindir}/npx |
554 |
%{_prefix}/lib/node_modules/npm |
555 |
%ghost %{_sysconfdir}/npmrc |
556 |
%ghost %{_sysconfdir}/npmignore |
557 |
%doc %{_mandir}/man*/npm* |
558 |
%doc %{_mandir}/man*/npx* |
559 |
%doc %{_mandir}/man7/semver.7* |
560 |
%doc %{_mandir}/man5/*.5.xz |
561 |
%doc %{_mandir}/man7/*.7.xz |
562 |
|
563 |
%files docs |
564 |
%dir %{_pkgdocdir} |
565 |
%{_pkgdocdir}/html |
566 |
%{_pkgdocdir}/npm/docs |