up to 16.13.2 (fixes CVE-2021-44531 CVE-2021-44532 CVE-2021-44533 CVE-2022-21824)
[packages/nodejs.git] / nodejs.spec
CommitLineData
cc3de6db
ER
1# TODO
2# - unpackaged files
3# /usr/share/doc/node/gdbinit
cc3de6db 4
29d6d704 5# Conditional build:
ab77d514 6%bcond_without system_brotli # system brotli
4a5eff4b 7%bcond_without system_uv # system uv
ab77d514 8%bcond_with http_parser # system http-parser and llhttp
29d6d704 9
5e8b83c0
JP
10%define _enable_debug_packages 0
11
8611106e
ER
12# NOTES:
13# - https://nodejs.org/en/download/releases/
14
e9b6043f
ER
15# NODE_MODULE_VERSION refers to the ABI (application binary interface) version
16# number of Node.js, used to determine which versions of Node.js compiled C++
17# add-on binaries can be loaded in to without needing to be re-compiled. It
18# used to be stored as hex value in earlier versions, but is now represented as
19# an integer.
2ae41f2b 20%define node_module_version 93
210abff9 21Summary: Asynchronous JavaScript Engine
9a1229ff 22Summary(pl.UTF-8): Asynchroniczny silnik JavaScriptu
210abff9 23Name: nodejs
ab907bdb
JP
24# 14.x LTS - https://github.com/nodejs/Release
25# Active start: 2020-10-27
c2768f1e 26# Maintenance start: October 2020
ab907bdb 27# Maintenance end: April 2023
9e604087 28Version: 16.13.2
4ad24d02 29Release: 1
d5764a43 30License: BSD and MIT and Apache v2.0 and GPL v3
e85103e0 31Group: Development/Languages
8611106e 32Source0: https://nodejs.org/dist/v%{version}/node-v%{version}.tar.gz
9e604087 33# Source0-md5: ae3a05fc273536f83c685a7425a7882d
4ad24d02 34Patch0: system_cares.patch
a6070ceb
ER
35# force node to use /usr/lib/node as the systemwide module directory
36Patch2: %{name}-libpath.patch
37# use /usr/lib64/node as an arch-specific module dir when appropriate
38Patch3: %{name}-lib64path.patch
c2768f1e
AM
39Patch4: 0001-Disable-running-gyp-on-shared-deps.patch
40Patch5: 0002-Install-both-binaries-and-use-libdir.patch
8611106e 41URL: https://nodejs.org/
4ad24d02 42BuildRequires: c-ares-devel >= 1.17.2
ab907bdb 43BuildRequires: gcc >= 6:6.3
4398233e
JB
44%if %{with http_parser}
45BuildRequires: http-parser-devel >= 2.9.3
ab907bdb 46BuildRequires: llhttp-devel >= 2.1.3
c2768f1e 47%endif
10c99409
JP
48%ifarch mips mipsel mips64 mips64el ppc %{arm}
49BuildRequires: libatomic-devel
50%endif
ab907bdb 51%{?with_system_brotli:BuildRequires: libbrotli-devel >= 1.0.9}
2ae41f2b 52BuildRequires: libicu-devel >= 69.1
8c0b403f 53BuildRequires: libstdc++-devel >= 6:4.8
2ae41f2b 54%{?with_system_uv:BuildRequires: libuv-devel >= 1.42.0}
c3bd1d59 55BuildRequires: nghttp2-devel >= 1.42.0
94f7bd52 56BuildRequires: openssl-devel >= 1.0.1
cd4c73aa 57BuildRequires: pkgconfig
2ae41f2b
JP
58BuildRequires: python3 >= 1:3.6
59BuildRequires: python3-modules >= 1:3.6
12a49d35 60BuildRequires: rpm >= 4.4.9-56
d047ca74 61BuildRequires: rpmbuild(macros) >= 1.752
536f9f5a 62BuildRequires: sed >= 4.0
ab77d514 63BuildRequires: zlib-devel >= 1.2.11
c3bd1d59 64Requires: c-ares >= 1.17.1
ab77d514 65Requires: ca-certificates
4398233e 66%{?with_http_parser:Requires: http-parser >= 2.9.3}
ab907bdb 67%{?with_system_brotli:Requires: libbrotli >= 1.0.9}
2ae41f2b 68%{?with_system_uv:Requires: libuv >= 1.42.0}
c3bd1d59 69Requires: nghttp2-libs >= 1.42.0
ab77d514 70Requires: zlib >= 1.2.11
8d8e2928 71Provides: nodejs(engine) = %{version}
56d9fb33 72Provides: nodejs(module-version) = %{node_module_version}
5ef76b51 73Obsoletes: nodejs-waf
a7c6ab18 74ExclusiveArch: %{ix86} %{x8664} %{arm} aarch64
210abff9 75BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
76
dc60a63b 77%define sover %(echo %{version} | cut -d. -f2)
05e85ef1
ER
78# add macro, so adapter won't replace it back literal
79%define doc_ver %{version}
dc60a63b 80
210abff9 81%description
c3b531ba
ER
82Node.js is a platform built on Chrome's JavaScript runtime for easily
83building fast, scalable network applications. Node.js uses an
84event-driven, non-blocking I/O model that makes it lightweight and
85efficient, perfect for data-intensive real-time applications that run
86across distributed devices.
210abff9 87
9a1229ff
JB
88%description -l pl.UTF-8
89Node.js to platforma zbudowana w opacriu o silnik JavaScriptu
90przeglądarki Chrome, służąca do tworzenia szybkich, skalowalnych
91aplikacji sieciowych. Node.js wykorzystuje nieblokujący model
92wejścia/wyjścia sterowany zdarzeniami, dzięki czemu jest lekki i
93wydajny, dobrze nadający się do aplikacji przetwarzających duże
94ilości danych w czasie rzeczywistym, uruchamianych na rozproszonych
95urządzeniach.
96
210abff9 97%package devel
12a49d35 98Summary: Development headers for nodejs
9a1229ff 99Summary(pl.UTF-8): Pliki nagłówkowe nodejs
210abff9 100Group: Development/Libraries
a8f57a3f 101Requires: %{name} = %{version}-%{release}
d44c8857 102Requires: gcc
4398233e 103%{?with_http_parser:Requires: http-parser-devel >= 2.9.3}
d44c8857 104Requires: libstdc++-devel
2ae41f2b 105%{?with_system_uv:Requires: libuv-devel >= 1.42.0}
96f19ba5 106Requires: openssl-devel
ab77d514 107Requires: zlib-devel >= 1.2.11
210abff9 108
109%description devel
12a49d35 110Development headers for nodejs.
210abff9 111
9a1229ff
JB
112%description devel -l pl.UTF-8
113Pliki nagłówkowe nodejs.
114
a6070ceb 115%package doc
9a1229ff
JB
116Summary: Documentation for Node.js engine
117Summary(pl.UTF-8): Dokumentacja silnika Node.js
a6070ceb 118Group: Documentation
05e85ef1 119URL: https://nodejs.org/dist/v%{doc_ver}/docs/api
0f608c78 120BuildArch: noarch
a6070ceb
ER
121
122%description doc
123Node.js is a server-side JavaScript environment that uses an
124asynchronous event-driven model. Node's goal is to provide an easy way
125to build scalable network programs.
126
9a1229ff
JB
127This package contains the documentation for Node.js.
128
129%description doc -l pl.UTF-8
130Node.js to serwerowe środowisko JavaScriptu wykorzystujące
131asynchroniczny model sterowany zdarzeniami. Celem Node jest
132zapewnienie łatwego sposobu tworzenia skalowalnych programów
133sieciowych.
134
135Ten pakiet zawiera dokumentację Node.js.
a6070ceb 136
8c0b403f
JB
137%package -n systemtap-nodejs
138Summary: systemtap/dtrace probes for Node.js
139Summary(pl.UTF-8): Sondy systemtap/dtrace dla Node.js
140Group: Development/Tools
141Requires: %{name} = %{version}-%{release}
142Requires: systemtap-client
143
144%description -n systemtap-nodejs
145systemtap/dtrace probes for Node.js.
146
147%description -n systemtap-nodejs -l pl.UTF-8
148Sondy systemtap/dtrace dla Node.js.
149
210abff9 150%prep
151%setup -q -n node-v%{version}
4ad24d02 152%patch0 -p1
d23cf2d6 153%if "%{_lib}" == "lib64"
a6070ceb
ER
154%patch3 -p1
155%else
156%patch2 -p1
157%endif
c2768f1e
AM
158%patch4 -p1
159%patch5 -p1
c4aa3bb0 160
fbdba246 161grep -r '#!.*env python' -l . | xargs %{__sed} -i -e '1 s,#!.*env python$,#!%{__python3},'
536f9f5a 162
a6b4cff8
JP
163%{?with_system_brotli:%{__rm} -r deps/brotli}
164%{__rm} -r deps/cares
165%if %{with http_parser}
166%{__rm} -r deps/http_parser
167%{__rm} -r deps/llhttp
168%endif
169%{__rm} -r deps/icu-small
170%{__rm} -r deps/nghttp2
9a1229ff 171%{__rm} -r deps/npm
9a1229ff
JB
172%{__rm} -r deps/openssl
173%{?with_system_uv:%{__rm} -r deps/uv}
174%{__rm} -r deps/zlib
e3e8568d 175
210abff9 176%build
c8ef6556 177ver=$(awk '/#define NODE_MODULE_VERSION/{print $3}' src/node_version.h)
145d5ed0 178test "$ver" = "%{node_module_version}"
56d9fb33 179
a11025a6
ER
180# CC used only to detect if CC is clang, not used for compiling
181CC="%{__cc}" \
182CXX="%{__cxx}" \
dc60a63b 183GYP_DEFINES="soname_version=%{sover}" \
a6070ceb 184./configure \
4398233e
JB
185 --prefix=%{_prefix} \
186 --libdir=%{_lib} \
e2a62df7 187 --openssl-use-def-ca-store \
c2768f1e 188 --shared \
ab77d514 189 %{?with_system_brotli:--shared-brotli} \
c2768f1e 190 --shared-cares \
4398233e 191 %{?with_http_parser:--shared-http-parser} \
8c0b403f 192 %{?with_system_uv:--shared-libuv} \
4398233e
JB
193 --shared-nghttp2 \
194 --shared-openssl \
8c0b403f 195 --shared-zlib \
4398233e 196 --with-intl=system-icu \
c1c359b8 197 --without-dtrace \
4398233e 198 --without-npm
210abff9 199
a11025a6
ER
200# add LFS defines from libuv (RHBZ#892601)
201# CXXFLAGS must be exported, as it is needed for make, not gyp
202CXXFLAGS="%{rpmcxxflags} -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC" \
203LDFLAGS="%{rpmldflags}" \
fbdba246 204PATH="$(pwd)/out/tools/bin:$PATH" \
9a1229ff
JB
205%{__make} -C out \
206 BUILDTYPE=Release \
207 V=1
210abff9 208
209%install
210rm -rf $RPM_BUILD_ROOT
9a1229ff 211
ab907bdb 212%{__python3} tools/install.py install "$RPM_BUILD_ROOT" "%{_prefix}"
4174c079 213
c2768f1e 214ln -s libnode.so.%{node_module_version} $RPM_BUILD_ROOT%{_libdir}/libnode.so
a6070ceb 215
c7898157
ER
216echo '.so man1/node.1' > $RPM_BUILD_ROOT%{_mandir}/man1/nodejs.1
217
1ed21df5 218install -d $RPM_BUILD_ROOT%{_includedir}/node
4174c079 219cp -p src/*.h $RPM_BUILD_ROOT%{_includedir}/node
d5764a43
ER
220
221# install for node-gyp
222install -d $RPM_BUILD_ROOT%{_usrsrc}/%{name}
223cp -p common.gypi $RPM_BUILD_ROOT%{_usrsrc}/%{name}
224ln -s %{_includedir}/node $RPM_BUILD_ROOT%{_usrsrc}/%{name}/src
1ed21df5 225
e85103e0 226# for compat of fedora derivered scripts (shebangs)
c3b531ba
ER
227ln -s node $RPM_BUILD_ROOT%{_bindir}/nodejs
228
e85103e0
ER
229# globally installed node modules (noarch)
230install -d $RPM_BUILD_ROOT%{_prefix}/lib/node_modules
231
232# default searchpaths
233install -d $RPM_BUILD_ROOT{%{_libdir},%{_prefix}/lib}/node
234
a6070ceb
ER
235# create pkgconfig
236install -d $RPM_BUILD_ROOT%{_pkgconfigdir}
237cat <<'EOF' > $RPM_BUILD_ROOT%{_pkgconfigdir}/%{name}.pc
238version=%{version}
c3b531ba 239prefix=%{_prefix}
87c4fdf2 240libdir=${prefix}/%{_lib}
a6070ceb
ER
241includedir=${prefix}/include/node
242
243Name: nodejs
244Description: Evented I/O for V8 JavaScript.
245Version: ${version}
246Cflags: -I${includedir}
247EOF
a752c1c0 248
a6070ceb 249# install documentation
6f7eebb5
ER
250install -d $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
251cp -a doc/api/* $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
9a1229ff
JB
252%{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.md
253%{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.json
a6070ceb 254
210abff9 255%clean
256rm -rf $RPM_BUILD_ROOT
257
4174c079 258%post -p /sbin/ldconfig
7372d27d 259%postun -p /sbin/ldconfig
260
210abff9 261%files
262%defattr(644,root,root,755)
4398233e 263%doc AUTHORS CHANGELOG.md LICENSE README.md SECURITY.md
210abff9 264%attr(755,root,root) %{_bindir}/node
c3b531ba 265%attr(755,root,root) %{_bindir}/nodejs
c2768f1e 266%attr(755,root,root) %{_libdir}/libnode.so.%{node_module_version}
a600c300 267%if "%{_lib}" != "lib"
8791ea86 268%dir %{_libdir}/node
a600c300
ŁC
269%endif
270%dir %{_prefix}/lib/node
e85103e0 271%dir %{_prefix}/lib/node_modules
210abff9 272%{_mandir}/man1/node.1*
9a1229ff 273%{_mandir}/man1/nodejs.1*
210abff9 274
210abff9 275%files devel
276%defattr(644,root,root,755)
9a1229ff 277%attr(755,root,root) %{_libdir}/libnode.so
58494f0c 278%{_includedir}/node
a6070ceb 279%{_pkgconfigdir}/nodejs.pc
d5764a43 280%{_usrsrc}/%{name}
a6070ceb
ER
281
282%files doc
283%defattr(644,root,root,755)
284%doc %{_docdir}/%{name}-doc-%{version}
8c0b403f
JB
285
286%files -n systemtap-nodejs
287%defattr(644,root,root,755)
288%{_datadir}/systemtap/tapset/node.stp
This page took 0.296775 seconds and 4 git commands to generate.