]> git.pld-linux.org Git - packages/nodejs.git/blob - nodejs.spec
ab9c907e3a6cc34f9808273299184c65b99a2c6d
[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 # NOTES:
11 # - https://nodejs.org/en/download/releases/
12
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.
18 %define         node_module_version     72
19 Summary:        Asynchronous JavaScript Engine
20 Summary(pl.UTF-8):      Asynchroniczny silnik JavaScriptu
21 Name:           nodejs
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
26 Version:        12.18.3
27 Release:        1
28 License:        BSD and MIT and Apache v2.0 and GPL v3
29 Group:          Development/Languages
30 Source0:        https://nodejs.org/dist/v%{version}/node-v%{version}.tar.gz
31 # Source0-md5:  28bf6a4d98b238403fa58a0805f4a979
32
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
37 Patch4:         0001-Disable-running-gyp-on-shared-deps.patch
38 Patch5:         0002-Install-both-binaries-and-use-libdir.patch
39 URL:            https://nodejs.org/
40 BuildRequires:  c-ares-devel >= 1.16.0
41 BuildRequires:  gcc >= 6:4.8
42 %if %{with http_parser}
43 BuildRequires:  http-parser-devel >= 2.9.3
44 BuildRequires:  llhttp-devel >= 2.0.4
45 %endif
46 %{?with_system_brotli:BuildRequires:    libbrotli-devel >= 1.0.7}
47 BuildRequires:  libicu-devel >= 0.64
48 BuildRequires:  libstdc++-devel >= 6:4.8
49 %{?with_system_uv:BuildRequires:        libuv-devel >= 1.38.0}
50 BuildRequires:  nghttp2-devel >= 1.41.0
51 BuildRequires:  openssl-devel >= 1.0.1
52 BuildRequires:  pkgconfig
53 BuildRequires:  python >= 1:2.7
54 BuildRequires:  python-jsmin
55 BuildRequires:  python-modules >= 1:2.7
56 BuildRequires:  rpm >= 4.4.9-56
57 BuildRequires:  rpmbuild(macros) >= 1.219
58 BuildRequires:  sed >= 4.0
59 BuildRequires:  zlib-devel >= 1.2.11
60 Requires:       c-ares >= 1.16.0
61 Requires:       ca-certificates
62 %{?with_http_parser:Requires:   http-parser >= 2.9.3}
63 %{?with_system_brotli:Requires: libbrotli >= 1.0.7}
64 %{?with_system_uv:Requires:     libuv >= 1.38.0}
65 Requires:       nghttp2-libs >= 1.41.0
66 Requires:       zlib >= 1.2.11
67 Provides:       nodejs(engine) = %{version}
68 Provides:       nodejs(module-version) = %{node_module_version}
69 Obsoletes:      nodejs-waf
70 ExclusiveArch:  %{ix86} %{x8664} %{arm} aarch64
71 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
72
73 %define         sover   %(echo %{version} | cut -d. -f2)
74 # add macro, so adapter won't replace it back literal
75 %define         doc_ver %{version}
76
77 %description
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.
83
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
93 %package devel
94 Summary:        Development headers for nodejs
95 Summary(pl.UTF-8):      Pliki nagłówkowe nodejs
96 Group:          Development/Libraries
97 Requires:       %{name} = %{version}-%{release}
98 Requires:       gcc
99 %{?with_http_parser:Requires:   http-parser-devel >= 2.9.3}
100 Requires:       libstdc++-devel
101 %{?with_system_uv:Requires:     libuv-devel >= 1.38.0}
102 Requires:       openssl-devel
103 Requires:       zlib-devel >= 1.2.11
104
105 %description devel
106 Development headers for nodejs.
107
108 %description devel -l pl.UTF-8
109 Pliki nagłówkowe nodejs.
110
111 %package doc
112 Summary:        Documentation for Node.js engine
113 Summary(pl.UTF-8):      Dokumentacja silnika Node.js
114 Group:          Documentation
115 URL:            https://nodejs.org/dist/v%{doc_ver}/docs/api
116 %if "%{_rpmversion}" >= "4.6"
117 BuildArch:      noarch
118 %endif
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
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.
134
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
148 %prep
149 %setup -q -n node-v%{version}
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,#!%{__python},'
159
160 %{__rm} -r deps/npm
161 %{?with_http_parser:%{__rm} -r deps/http_parser}
162 %{__rm} -r deps/openssl
163 %{?with_system_uv:%{__rm} -r deps/uv}
164 %{__rm} -r deps/zlib
165
166 %build
167 ver=$(awk '/#define NODE_MODULE_VERSION/{print $3}' src/node_version.h)
168 test "$ver" = "%{node_module_version}"
169
170 # CC used only to detect if CC is clang, not used for compiling
171 CC="%{__cc}" \
172 CXX="%{__cxx}" \
173 GYP_DEFINES="soname_version=%{sover}" \
174 ./configure \
175         --prefix=%{_prefix} \
176         --libdir=%{_lib} \
177         --openssl-use-def-ca-store \
178         --shared \
179         %{?with_system_brotli:--shared-brotli} \
180         --shared-cares \
181         %{?with_http_parser:--shared-http-parser} \
182         %{?with_system_uv:--shared-libuv} \
183         --shared-nghttp2 \
184         --shared-openssl \
185         --shared-zlib \
186         --with-intl=system-icu \
187         --without-dtrace \
188         --without-npm
189
190 # add LFS defines from libuv (RHBZ#892601)
191 # CXXFLAGS must be exported, as it is needed for make, not gyp
192 CXXFLAGS="%{rpmcxxflags} -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC" \
193 LDFLAGS="%{rpmldflags}" \
194 %{__make} -C out \
195         BUILDTYPE=Release \
196         V=1
197
198 %install
199 rm -rf $RPM_BUILD_ROOT
200
201 %{__python} tools/install.py install "$RPM_BUILD_ROOT" "%{_prefix}"
202
203 ln -s libnode.so.%{node_module_version} $RPM_BUILD_ROOT%{_libdir}/libnode.so
204
205 echo '.so man1/node.1' > $RPM_BUILD_ROOT%{_mandir}/man1/nodejs.1
206
207 install -d $RPM_BUILD_ROOT%{_includedir}/node
208 cp -p src/*.h $RPM_BUILD_ROOT%{_includedir}/node
209
210 # install for node-gyp
211 install -d $RPM_BUILD_ROOT%{_usrsrc}/%{name}
212 cp -p common.gypi $RPM_BUILD_ROOT%{_usrsrc}/%{name}
213 ln -s %{_includedir}/node $RPM_BUILD_ROOT%{_usrsrc}/%{name}/src
214
215 # for compat of fedora derivered scripts (shebangs)
216 ln -s node $RPM_BUILD_ROOT%{_bindir}/nodejs
217
218 # globally installed node modules (noarch)
219 install -d $RPM_BUILD_ROOT%{_prefix}/lib/node_modules
220
221 # default searchpaths
222 install -d $RPM_BUILD_ROOT{%{_libdir},%{_prefix}/lib}/node
223
224 # create pkgconfig
225 install -d $RPM_BUILD_ROOT%{_pkgconfigdir}
226 cat <<'EOF' > $RPM_BUILD_ROOT%{_pkgconfigdir}/%{name}.pc
227 version=%{version}
228 prefix=%{_prefix}
229 libdir=${prefix}/%{_lib}
230 includedir=${prefix}/include/node
231
232 Name: nodejs
233 Description: Evented I/O for V8 JavaScript.
234 Version: ${version}
235 Cflags: -I${includedir}
236 EOF
237
238 # install documentation
239 install -d $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
240 cp -a doc/api/* $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
241 %{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.md
242 %{__rm} $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.json
243
244 %clean
245 rm -rf $RPM_BUILD_ROOT
246
247 %post   -p /sbin/ldconfig
248 %postun -p /sbin/ldconfig
249
250 %files
251 %defattr(644,root,root,755)
252 %doc AUTHORS CHANGELOG.md LICENSE README.md SECURITY.md
253 %attr(755,root,root) %{_bindir}/node
254 %attr(755,root,root) %{_bindir}/nodejs
255 %attr(755,root,root) %{_libdir}/libnode.so.%{node_module_version}
256 %if "%{_lib}" != "lib"
257 %dir %{_libdir}/node
258 %endif
259 %dir %{_prefix}/lib/node
260 %dir %{_prefix}/lib/node_modules
261 %{_mandir}/man1/node.1*
262 %{_mandir}/man1/nodejs.1*
263
264 %files devel
265 %defattr(644,root,root,755)
266 %attr(755,root,root) %{_libdir}/libnode.so
267 %{_includedir}/node
268 %{_pkgconfigdir}/nodejs.pc
269 %{_usrsrc}/%{name}
270
271 %files doc
272 %defattr(644,root,root,755)
273 %doc %{_docdir}/%{name}-doc-%{version}
274
275 %files -n systemtap-nodejs
276 %defattr(644,root,root,755)
277 %{_datadir}/systemtap/tapset/node.stp
This page took 0.11392 seconds and 3 git commands to generate.