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