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