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