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