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