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