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