]> git.pld-linux.org Git - packages/nodejs.git/blame - nodejs.spec
icu rebuild
[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
846a6389 32Version: 16.15.0
e3d8494a 33Release: 2
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
846a6389 37# Source0-md5: 1be414cdf553b0772e1048e03ffa741b
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
d1db1c48 65BuildRequires: rpm-build >= 4.6
d047ca74 66BuildRequires: rpmbuild(macros) >= 1.752
536f9f5a 67BuildRequires: sed >= 4.0
ab77d514 68BuildRequires: zlib-devel >= 1.2.11
c3bd1d59 69Requires: c-ares >= 1.17.1
ab77d514 70Requires: ca-certificates
4398233e 71%{?with_http_parser:Requires: http-parser >= 2.9.3}
ab907bdb 72%{?with_system_brotli:Requires: libbrotli >= 1.0.9}
2ae41f2b 73%{?with_system_uv:Requires: libuv >= 1.42.0}
c3bd1d59 74Requires: nghttp2-libs >= 1.42.0
ab77d514 75Requires: zlib >= 1.2.11
8d8e2928 76Provides: nodejs(engine) = %{version}
56d9fb33 77Provides: nodejs(module-version) = %{node_module_version}
5ef76b51 78Obsoletes: nodejs-waf
a7c6ab18 79ExclusiveArch: %{ix86} %{x8664} %{arm} aarch64
210abff9 80BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
81
dc60a63b 82%define sover %(echo %{version} | cut -d. -f2)
05e85ef1
ER
83# add macro, so adapter won't replace it back literal
84%define doc_ver %{version}
dc60a63b 85
210abff9 86%description
c3b531ba
ER
87Node.js is a platform built on Chrome's JavaScript runtime for easily
88building fast, scalable network applications. Node.js uses an
89event-driven, non-blocking I/O model that makes it lightweight and
90efficient, perfect for data-intensive real-time applications that run
91across distributed devices.
210abff9 92
9a1229ff
JB
93%description -l pl.UTF-8
94Node.js to platforma zbudowana w opacriu o silnik JavaScriptu
95przeglądarki Chrome, służąca do tworzenia szybkich, skalowalnych
96aplikacji sieciowych. Node.js wykorzystuje nieblokujący model
97wejścia/wyjścia sterowany zdarzeniami, dzięki czemu jest lekki i
98wydajny, dobrze nadający się do aplikacji przetwarzających duże
99ilości danych w czasie rzeczywistym, uruchamianych na rozproszonych
100urządzeniach.
101
210abff9 102%package devel
12a49d35 103Summary: Development headers for nodejs
9a1229ff 104Summary(pl.UTF-8): Pliki nagłówkowe nodejs
210abff9 105Group: Development/Libraries
a8f57a3f 106Requires: %{name} = %{version}-%{release}
d44c8857 107Requires: gcc
4398233e 108%{?with_http_parser:Requires: http-parser-devel >= 2.9.3}
d44c8857 109Requires: libstdc++-devel
2ae41f2b 110%{?with_system_uv:Requires: libuv-devel >= 1.42.0}
96f19ba5 111Requires: openssl-devel
ab77d514 112Requires: zlib-devel >= 1.2.11
210abff9 113
114%description devel
12a49d35 115Development headers for nodejs.
210abff9 116
9a1229ff
JB
117%description devel -l pl.UTF-8
118Pliki nagłówkowe nodejs.
119
a6070ceb 120%package doc
9a1229ff
JB
121Summary: Documentation for Node.js engine
122Summary(pl.UTF-8): Dokumentacja silnika Node.js
a6070ceb 123Group: Documentation
05e85ef1 124URL: https://nodejs.org/dist/v%{doc_ver}/docs/api
0f608c78 125BuildArch: noarch
a6070ceb
ER
126
127%description doc
128Node.js is a server-side JavaScript environment that uses an
129asynchronous event-driven model. Node's goal is to provide an easy way
130to build scalable network programs.
131
9a1229ff
JB
132This package contains the documentation for Node.js.
133
134%description doc -l pl.UTF-8
135Node.js to serwerowe środowisko JavaScriptu wykorzystujące
136asynchroniczny model sterowany zdarzeniami. Celem Node jest
137zapewnienie łatwego sposobu tworzenia skalowalnych programów
138sieciowych.
139
140Ten pakiet zawiera dokumentację Node.js.
a6070ceb 141
8c0b403f
JB
142%package -n systemtap-nodejs
143Summary: systemtap/dtrace probes for Node.js
144Summary(pl.UTF-8): Sondy systemtap/dtrace dla Node.js
145Group: Development/Tools
146Requires: %{name} = %{version}-%{release}
147Requires: systemtap-client
148
149%description -n systemtap-nodejs
150systemtap/dtrace probes for Node.js.
151
152%description -n systemtap-nodejs -l pl.UTF-8
153Sondy systemtap/dtrace dla Node.js.
154
210abff9 155%prep
156%setup -q -n node-v%{version}
4ad24d02 157%patch0 -p1
d23cf2d6 158%if "%{_lib}" == "lib64"
a6070ceb
ER
159%patch3 -p1
160%else
161%patch2 -p1
162%endif
c2768f1e
AM
163%patch4 -p1
164%patch5 -p1
c4aa3bb0 165
fbdba246 166grep -r '#!.*env python' -l . | xargs %{__sed} -i -e '1 s,#!.*env python$,#!%{__python3},'
536f9f5a 167
a6b4cff8
JP
168%{?with_system_brotli:%{__rm} -r deps/brotli}
169%{__rm} -r deps/cares
170%if %{with http_parser}
171%{__rm} -r deps/http_parser
172%{__rm} -r deps/llhttp
173%endif
174%{__rm} -r deps/icu-small
175%{__rm} -r deps/nghttp2
9a1229ff 176%{__rm} -r deps/npm
9a1229ff
JB
177%{__rm} -r deps/openssl
178%{?with_system_uv:%{__rm} -r deps/uv}
179%{__rm} -r deps/zlib
e3e8568d 180
210abff9 181%build
c8ef6556 182ver=$(awk '/#define NODE_MODULE_VERSION/{print $3}' src/node_version.h)
145d5ed0 183test "$ver" = "%{node_module_version}"
56d9fb33 184
a11025a6
ER
185# CC used only to detect if CC is clang, not used for compiling
186CC="%{__cc}" \
187CXX="%{__cxx}" \
dc60a63b 188GYP_DEFINES="soname_version=%{sover}" \
a6070ceb 189./configure \
4398233e
JB
190 --prefix=%{_prefix} \
191 --libdir=%{_lib} \
e2a62df7 192 --openssl-use-def-ca-store \
c2768f1e 193 --shared \
ab77d514 194 %{?with_system_brotli:--shared-brotli} \
c2768f1e 195 --shared-cares \
4398233e 196 %{?with_http_parser:--shared-http-parser} \
8c0b403f 197 %{?with_system_uv:--shared-libuv} \
4398233e
JB
198 --shared-nghttp2 \
199 --shared-openssl \
8c0b403f 200 --shared-zlib \
4398233e 201 --with-intl=system-icu \
47f90cc9 202 --without-corepack \
c1c359b8 203 --without-dtrace \
4398233e 204 --without-npm
210abff9 205
a11025a6
ER
206# add LFS defines from libuv (RHBZ#892601)
207# CXXFLAGS must be exported, as it is needed for make, not gyp
208CXXFLAGS="%{rpmcxxflags} -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC" \
209LDFLAGS="%{rpmldflags}" \
fbdba246 210PATH="$(pwd)/out/tools/bin:$PATH" \
9a1229ff
JB
211%{__make} -C out \
212 BUILDTYPE=Release \
213 V=1
210abff9 214
215%install
216rm -rf $RPM_BUILD_ROOT
9a1229ff 217
ab907bdb 218%{__python3} tools/install.py install "$RPM_BUILD_ROOT" "%{_prefix}"
4174c079 219
c2768f1e 220ln -s libnode.so.%{node_module_version} $RPM_BUILD_ROOT%{_libdir}/libnode.so
a6070ceb 221
c7898157
ER
222echo '.so man1/node.1' > $RPM_BUILD_ROOT%{_mandir}/man1/nodejs.1
223
1ed21df5 224install -d $RPM_BUILD_ROOT%{_includedir}/node
4174c079 225cp -p src/*.h $RPM_BUILD_ROOT%{_includedir}/node
d5764a43
ER
226
227# install for node-gyp
228install -d $RPM_BUILD_ROOT%{_usrsrc}/%{name}
229cp -p common.gypi $RPM_BUILD_ROOT%{_usrsrc}/%{name}
230ln -s %{_includedir}/node $RPM_BUILD_ROOT%{_usrsrc}/%{name}/src
1ed21df5 231
e85103e0 232# for compat of fedora derivered scripts (shebangs)
c3b531ba
ER
233ln -s node $RPM_BUILD_ROOT%{_bindir}/nodejs
234
e85103e0
ER
235# globally installed node modules (noarch)
236install -d $RPM_BUILD_ROOT%{_prefix}/lib/node_modules
237
238# default searchpaths
239install -d $RPM_BUILD_ROOT{%{_libdir},%{_prefix}/lib}/node
240
a6070ceb
ER
241# create pkgconfig
242install -d $RPM_BUILD_ROOT%{_pkgconfigdir}
243cat <<'EOF' > $RPM_BUILD_ROOT%{_pkgconfigdir}/%{name}.pc
244version=%{version}
c3b531ba 245prefix=%{_prefix}
87c4fdf2 246libdir=${prefix}/%{_lib}
a6070ceb
ER
247includedir=${prefix}/include/node
248
249Name: nodejs
250Description: Evented I/O for V8 JavaScript.
251Version: ${version}
252Cflags: -I${includedir}
253EOF
a752c1c0 254
a6070ceb 255# install documentation
6f7eebb5
ER
256install -d $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
257cp -a doc/api/* $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
9a1229ff
JB
258%{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.md
259%{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.json
a6070ceb 260
210abff9 261%clean
262rm -rf $RPM_BUILD_ROOT
263
4174c079 264%post -p /sbin/ldconfig
7372d27d 265%postun -p /sbin/ldconfig
266
210abff9 267%files
268%defattr(644,root,root,755)
4398233e 269%doc AUTHORS CHANGELOG.md LICENSE README.md SECURITY.md
210abff9 270%attr(755,root,root) %{_bindir}/node
c3b531ba 271%attr(755,root,root) %{_bindir}/nodejs
c2768f1e 272%attr(755,root,root) %{_libdir}/libnode.so.%{node_module_version}
a600c300 273%if "%{_lib}" != "lib"
8791ea86 274%dir %{_libdir}/node
a600c300
ŁC
275%endif
276%dir %{_prefix}/lib/node
e85103e0 277%dir %{_prefix}/lib/node_modules
210abff9 278%{_mandir}/man1/node.1*
9a1229ff 279%{_mandir}/man1/nodejs.1*
210abff9 280
210abff9 281%files devel
282%defattr(644,root,root,755)
9a1229ff 283%attr(755,root,root) %{_libdir}/libnode.so
58494f0c 284%{_includedir}/node
a6070ceb 285%{_pkgconfigdir}/nodejs.pc
d5764a43 286%{_usrsrc}/%{name}
a6070ceb
ER
287
288%files doc
289%defattr(644,root,root,755)
290%doc %{_docdir}/%{name}-doc-%{version}
8c0b403f
JB
291
292%files -n systemtap-nodejs
293%defattr(644,root,root,755)
294%{_datadir}/systemtap/tapset/node.stp
This page took 0.112665 seconds and 4 git commands to generate.