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