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