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