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