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